Compare commits
62 Commits
c222b303df
...
2c2e61a2fa
Author | SHA1 | Date | |
---|---|---|---|
|
2c2e61a2fa | ||
|
6d3e6623a0 | ||
|
2047df9309 | ||
|
4507c0ef2a | ||
|
50c3329793 | ||
|
b302df4664 | ||
|
5a062351e3 | ||
|
40cb1f3251 | ||
|
72158d6d33 | ||
|
9a458096a2 | ||
|
8fe24cca7c | ||
|
135bb79bf6 | ||
|
681f4d625f | ||
|
8dbae5c66b | ||
|
17239f3305 | ||
|
fce255a75d | ||
|
df71333d2c | ||
|
eeb3993c71 | ||
|
6440cff928 | ||
|
40b7437c87 | ||
|
bd1ea0857c | ||
|
54f3974527 | ||
|
c2c23d85fb | ||
|
8726cf35b9 | ||
|
b6ba770a8a | ||
|
64d56d3df6 | ||
|
bc8a786db7 | ||
|
6a8bdba849 | ||
|
a9dddfca2c | ||
|
86655f5632 | ||
|
c224025c52 | ||
|
ad0fb09595 | ||
|
8519a6d273 | ||
|
ce82d48a7e | ||
|
ddcc5f053b | ||
|
9046017df5 | ||
|
84dbd0cc59 | ||
|
5b1b5a029b | ||
|
85e2fa240a | ||
|
199d41fd83 | ||
|
7c6ef56ecb | ||
|
d119c976eb | ||
|
5c1a23306c | ||
|
b41c02ca76 | ||
|
bf7e113862 | ||
|
e1414eef06 | ||
|
0a14cfc9f7 | ||
|
83bfe00ba0 | ||
|
994c99df51 | ||
|
91ebec6040 | ||
|
8dff8c1510 | ||
|
bb1d173160 | ||
|
9f4f8eb2c4 | ||
|
540225d04d | ||
|
2538b49399 | ||
|
248f621605 | ||
|
ddd33a8b18 | ||
|
b2d85e2934 | ||
|
96fa5275fc | ||
|
0c5cc7d278 | ||
|
30393c0fd4 | ||
|
6653cbf65a |
@ -1,5 +1,5 @@
|
||||
export default [
|
||||
{"Station_JP" : "徳島", "Station_EN" : "Tokushima", "MyStation" : "0", "StationNumber" : "T00", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tokushima.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074642,134.550764", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/tokushima/"},
|
||||
{"Station_JP" : "徳島", "Station_EN" : "Tokushima", "MyStation" : "0", "StationNumber" : "B00", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tokushima.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074642,134.550764", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/tokushima/"},
|
||||
{"Station_JP" : "佐古", "Station_EN" : "Sako", "MyStation" : "0", "StationNumber" : "B01", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/sako.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.080616,134.538576", "JrHpUrl" : ""},
|
||||
{"Station_JP" : "蔵本", "Station_EN" : "Kuramoto", "MyStation" : "1", "StationNumber" : "B02", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/kuramoto.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.079332,134.518705", "JrHpUrl" : ""},
|
||||
{"Station_JP" : "府中", "Station_EN" : "Kō", "MyStation" : "2", "StationNumber" : "B04", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/ko.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074134,134.482939", "JrHpUrl" : ""},
|
||||
|
@ -10,7 +10,9 @@ export const EachStopList = ({
|
||||
points,
|
||||
currentTrainData,
|
||||
openStationACFromEachTrainInfo,
|
||||
showThrew,
|
||||
}) => {
|
||||
if (!showThrew && i.split(",")[1] == "通過") return null;
|
||||
const [station, se, time] = i.split(","); // 阿波池田,発,6:21
|
||||
const Stations = stationList
|
||||
.map((a) => a.filter((d) => d.StationName == station))
|
||||
@ -43,7 +45,7 @@ export const EachStopList = ({
|
||||
.set("hour", parseInt(time.split(":")[0]))
|
||||
.set("minute", parseInt(time.split(":")[1]))
|
||||
.add(isNaN(currentTrainData?.delay) ? 0 : currentTrainData.delay, "minute");
|
||||
const timeString = dates.format("HH:mm").split(":");
|
||||
const timeString = se == "通過" ? "" : dates.format("HH:mm").split(":");
|
||||
|
||||
return (
|
||||
<TouchableWithoutFeedback
|
||||
@ -66,7 +68,9 @@ export const EachStopList = ({
|
||||
{lineIDs.map((lineID, index) => (
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: lineColorList[lineID],
|
||||
backgroundColor: `${lineColorList[lineID]}${
|
||||
se == "通過" ? "80" : ""
|
||||
}`,
|
||||
flex: 1,
|
||||
}}
|
||||
key={lineID}
|
||||
@ -97,11 +101,20 @@ export const EachStopList = ({
|
||||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<Text style={{ fontSize: 20 }}>{station}</Text>
|
||||
<Text
|
||||
style={{ fontSize: 20, color: `#000${se == "通過" ? "5" : ""}` }}
|
||||
>
|
||||
{station}
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
{points && points.findIndex((d) => d == index) >= 0 ? (
|
||||
<Text style={{ fontSize: 20, marginRight: 70 }}>🚊</Text>
|
||||
) : null}
|
||||
<View style={{ position: "relative", width: 0 }}>
|
||||
{points ? (
|
||||
<Text style={{ fontSize: 20, position: "absolute", left: -60 }}>
|
||||
🚊
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
|
||||
{!isNaN(currentTrainData?.delay) && currentTrainData?.delay != 0 && (
|
||||
<Text
|
||||
style={{
|
||||
@ -128,7 +141,7 @@ export const EachStopList = ({
|
||||
width: 60,
|
||||
}}
|
||||
>
|
||||
{timeString[0]}:{timeString[1]}
|
||||
{se == "通過" ? "レ" : `${timeString[0]}:${timeString[1]}`}
|
||||
</Text>
|
||||
<Text style={{ fontSize: 18, width: 50 }}>
|
||||
{se?.replace("発", "出発").replace("着", "到着")}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { View, Text, LayoutAnimation, TouchableOpacity } from "react-native";
|
||||
|
||||
export const ScrollStickyContent = ({ currentTrainData }) => {
|
||||
export const ScrollStickyContent = (props) => {
|
||||
const { currentTrainData, showThrew, setShowThrew, haveThrough } = props;
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
@ -49,7 +50,32 @@ export const ScrollStickyContent = ({ currentTrainData }) => {
|
||||
>
|
||||
見込
|
||||
</Text>
|
||||
<Text style={{ fontSize: 20, width: 50 }}></Text>
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
if (!haveThrough) return;
|
||||
LayoutAnimation.configureNext({
|
||||
duration: 200,
|
||||
update: { type: "easeInEaseOut", springDamping: 0.6 },
|
||||
});
|
||||
setShowThrew(!showThrew);
|
||||
}}
|
||||
>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 12,
|
||||
width: 50,
|
||||
paddingBottom: 0,
|
||||
margin: "auto",
|
||||
textAlign: "center",
|
||||
textAlignVertical: "center",
|
||||
opacity: haveThrough ? 1 : 0,
|
||||
}}
|
||||
>
|
||||
(通過{showThrew ? "▼" : "▶"})
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -5,6 +5,7 @@ import { useDeviceOrientationChange } from "../../../stateBox/useDeviceOrientati
|
||||
import { getStationList2 } from "../../../lib/getStationList2";
|
||||
import { useCurrentTrain } from "../../../stateBox/useCurrentTrain";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { trainPosition } from "../../../lib/trainPositionTextArray";
|
||||
|
||||
export const TrainDataView = ({
|
||||
currentTrainData,
|
||||
@ -16,12 +17,17 @@ export const TrainDataView = ({
|
||||
}) => {
|
||||
const { width, height } = useWindowDimensions();
|
||||
const { isLandscape } = useDeviceOrientationChange();
|
||||
const { webview, getCurrentTrain, inject } = useCurrentTrain();
|
||||
const { inject } = useCurrentTrain();
|
||||
const [mapsStationData, setMapsStationData] = useState(undefined);
|
||||
useEffect(() => {
|
||||
getStationList2().then(setMapsStationData);
|
||||
}, []);
|
||||
const onLine = !!currentPosition?.toString().length;
|
||||
const trainPositionText = (trainData) => {
|
||||
const { isBetween, Pos } = trainPosition(trainData);
|
||||
if (isBetween === true) return `${Pos.from}~${Pos.to}`;
|
||||
else return Pos.Pos == "" ? "" : `${Pos.Pos}`;
|
||||
};
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
@ -60,19 +66,7 @@ export const TrainDataView = ({
|
||||
<StateBox
|
||||
mode={mode}
|
||||
title={`現在地 ${currentPosition?.toString()}${onLine ? "▶️" : ""}`}
|
||||
text={
|
||||
currentTrainData?.Pos.match("~")
|
||||
? `${
|
||||
currentTrainData?.Pos.replace("(下り)", "")
|
||||
.replace("(上り)", "")
|
||||
.split("~")[currentTrainData?.Direction == 1 ? 0 : 1]
|
||||
}~${
|
||||
currentTrainData?.Pos.replace("(下り)", "")
|
||||
.replace("(上り)", "")
|
||||
.split("~")[currentTrainData?.Direction == 1 ? 1 : 0]
|
||||
}`
|
||||
: currentTrainData?.Pos
|
||||
}
|
||||
text={trainPositionText(currentTrainData)}
|
||||
style={
|
||||
onLine
|
||||
? { borderWidth: 1, borderColor: "red", borderStyle: "solid" }
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
@ -7,11 +7,12 @@ import {
|
||||
useWindowDimensions,
|
||||
BackHandler,
|
||||
Linking,
|
||||
LayoutAnimation,
|
||||
} from "react-native";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { AS } from "../../storageControl";
|
||||
import trainList from "../../assets/originData/trainList";
|
||||
import { lineList } from "../../lib/getStationList";
|
||||
import { lineList, lineListPair } from "../../lib/getStationList";
|
||||
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
|
||||
import { checkDuplicateTrainData } from "../../lib/checkDuplicateTrainData";
|
||||
import { getTrainType } from "../../lib/getTrainType";
|
||||
@ -34,6 +35,7 @@ import { ShowSpecialTrain } from "./EachTrainInfo/ShowSpecialTrain";
|
||||
import { useTrainMenu } from "../../stateBox/useTrainMenu";
|
||||
import { HeaderText } from "./EachTrainInfoCore/HeaderText";
|
||||
import { useStationList } from "../../stateBox/useStationList";
|
||||
import { stationIDPair } from "../../lib/getStationList2";
|
||||
|
||||
export const EachTrainInfoCore = ({
|
||||
actionSheetRef,
|
||||
@ -80,6 +82,9 @@ export const EachTrainInfoCore = ({
|
||||
const [trainPositionSwitch, setTrainPositionSwitch] = useState("false");
|
||||
const [currentPosition, setCurrentPosition] = useState([]);
|
||||
const [trainData, setTrainData] = useState([]);
|
||||
const [trainDataWidhThrough, setTrainDataWithThrough] = useState([]);
|
||||
const [showThrew, setShowThrew] = useState(false);
|
||||
const [haveThrough, setHaveThrough] = useState(false);
|
||||
|
||||
const stationList =
|
||||
originalStationList &&
|
||||
@ -91,7 +96,7 @@ export const EachTrainInfoCore = ({
|
||||
);
|
||||
|
||||
// 使用例
|
||||
const stopStationIDList = trainData.map((i) => {
|
||||
const stopStationIDList = trainDataWidhThrough.map((i) => {
|
||||
const [station, se, time] = i.split(",");
|
||||
const Stations = stationList.map((a) =>
|
||||
a.filter((d) => d.StationName == station)
|
||||
@ -100,15 +105,103 @@ export const EachTrainInfoCore = ({
|
||||
Stations &&
|
||||
Stations.reduce((newArray, e) => {
|
||||
return newArray.concat(e);
|
||||
}, [])
|
||||
.filter((d) => d.StationNumber)
|
||||
.map((d) => d.StationNumber);
|
||||
return StationNumbers[0];
|
||||
}, []).map((d) => d.StationNumber);
|
||||
return StationNumbers;
|
||||
});
|
||||
useEffect(() => {
|
||||
const stopStationList = trainData.map((i) => {
|
||||
const [station, se, time] = i.split(",");
|
||||
return stationList.map((a) => a.filter((d) => d.StationName == station));
|
||||
});
|
||||
const allThroughStationList = stopStationList.map((i, index, array) => {
|
||||
let allThroughStation = [];
|
||||
if (index == array.length - 1) return;
|
||||
|
||||
const firstItem = array[index];
|
||||
const secondItem = array[index + 1];
|
||||
let betweenStationLine = "";
|
||||
let baseStationNumberFirst = "";
|
||||
let baseStationNumberSecond = "";
|
||||
Object.keys(stationIDPair).forEach((d, index2, array) => {
|
||||
if (!d) return;
|
||||
const haveFirst = firstItem[index2];
|
||||
const haveSecond = secondItem[index2];
|
||||
if (haveFirst.length && haveSecond.length) {
|
||||
betweenStationLine = d;
|
||||
baseStationNumberFirst = haveFirst[0].StationNumber;
|
||||
baseStationNumberSecond = haveSecond[0].StationNumber;
|
||||
}
|
||||
});
|
||||
if (!betweenStationLine) return;
|
||||
let reverse = false;
|
||||
originalStationList[
|
||||
lineListPair[stationIDPair[betweenStationLine]]
|
||||
].forEach((d) => {
|
||||
if (
|
||||
d.StationNumber > baseStationNumberFirst &&
|
||||
d.StationNumber < baseStationNumberSecond
|
||||
) {
|
||||
allThroughStation.push(`${d.Station_JP},通過,`);
|
||||
setHaveThrough(true);
|
||||
reverse = false;
|
||||
} else {
|
||||
if (
|
||||
d.StationNumber < baseStationNumberFirst &&
|
||||
d.StationNumber > baseStationNumberSecond
|
||||
) {
|
||||
allThroughStation.push(`${d.Station_JP},通過,`);
|
||||
setHaveThrough(true);
|
||||
reverse = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (reverse) allThroughStation.reverse();
|
||||
return allThroughStation;
|
||||
});
|
||||
let mainArray = [...trainData];
|
||||
let indexs = 0;
|
||||
trainData.forEach((d, index, array) => {
|
||||
indexs = indexs + 1;
|
||||
if (!allThroughStationList[index]) return;
|
||||
if (allThroughStationList[index].length == 0) return;
|
||||
mainArray.splice(indexs, 0, ...allThroughStationList[index]);
|
||||
indexs = indexs + allThroughStationList[index].length;
|
||||
});
|
||||
setTrainDataWithThrough(mainArray);
|
||||
}, [trainData]);
|
||||
|
||||
const points =
|
||||
trainPositionSwitch == "true"
|
||||
? findReversalPoints(currentPosition, stopStationIDList)
|
||||
: [];
|
||||
: stopStationIDList.map(() => false);
|
||||
const [isJumped, setIsJumped] = useState(false);
|
||||
useEffect(() => {
|
||||
if (isJumped) return () => {};
|
||||
if (!points) return () => {};
|
||||
if (points.length == 0) return () => {};
|
||||
const position = points.findIndex((d) => d == true);
|
||||
let isThrew = false;
|
||||
if (position == -1) return () => {};
|
||||
if (trainDataWidhThrough[position].split(",")[1] == "通過") {
|
||||
LayoutAnimation.configureNext({
|
||||
duration: 400,
|
||||
update: { type: "easeInEaseOut", springDamping: 0.6 },
|
||||
});
|
||||
setShowThrew(true);
|
||||
isThrew = true;
|
||||
}
|
||||
if (position < 5) {
|
||||
} // 5駅以内の場合はスクロールしない
|
||||
else {
|
||||
const count = position * 44 - 50;
|
||||
// 0.5秒待機してからスクロール
|
||||
setTimeout(
|
||||
() => ScrollViewRef.current?.scrollTo({ y: count, animated: true }),
|
||||
400
|
||||
);
|
||||
}
|
||||
setIsJumped(true);
|
||||
}, [points]);
|
||||
const trainName = useMemo(() => {
|
||||
if (!data.limited) return "";
|
||||
const limitedArray = data.limited.split(":");
|
||||
@ -134,6 +227,7 @@ export const EachTrainInfoCore = ({
|
||||
|
||||
const { height } = useWindowDimensions();
|
||||
const { isLandscape } = useDeviceOrientationChange();
|
||||
const ScrollViewRef = useRef();
|
||||
|
||||
const [trueTrainID, setTrueTrainID] = useState();
|
||||
useEffect(() => {
|
||||
@ -193,9 +287,41 @@ export const EachTrainInfoCore = ({
|
||||
if (currentTrainData?.Pos.match("~")) {
|
||||
const pos = currentTrainData?.Pos.replace("(下り)", "")
|
||||
.replace("(上り)", "")
|
||||
.replace("(徳島線)", "")
|
||||
.replace("(高徳線)", "")
|
||||
.split("~");
|
||||
const direction = parseInt(currentTrainData?.Direction) || 0;
|
||||
if (direction == 0) {
|
||||
if (pos[0] == "児島" && pos[1] == "宇多津") {
|
||||
setCurrentPosition(["M12", "Y09"]);
|
||||
return;
|
||||
} else if (pos[1] == "児島" && pos[0] == "宇多津") {
|
||||
setCurrentPosition(["Y09", "M12"]);
|
||||
return;
|
||||
}
|
||||
const currentPosID = Object.keys(originalStationList).map((key) => {
|
||||
let firstStation = false;
|
||||
let firstStationID = "";
|
||||
let secondStation = false;
|
||||
let secondStationID = "";
|
||||
originalStationList[key].forEach((station) => {
|
||||
if (station.Station_JP === pos[0]) {
|
||||
firstStation = true;
|
||||
firstStationID = station.StationNumber;
|
||||
}
|
||||
if (station.Station_JP === pos[1]) {
|
||||
secondStation = true;
|
||||
secondStationID = station.StationNumber;
|
||||
}
|
||||
});
|
||||
if (firstStation && secondStation) {
|
||||
return [firstStationID, secondStationID];
|
||||
} else return false;
|
||||
});
|
||||
const currentPos = currentPosID.filter((d) => d != false)[0];
|
||||
if (currentPos) {
|
||||
if (direction == 0) setCurrentPosition(currentPos.reverse());
|
||||
else setCurrentPosition(currentPos);
|
||||
} else if (direction == 0) {
|
||||
setCurrentPosition([
|
||||
getStationID(pos[1], stationList),
|
||||
getStationID(pos[0], stationList),
|
||||
@ -293,6 +419,7 @@ export const EachTrainInfoCore = ({
|
||||
from={from}
|
||||
styles={styles}
|
||||
actionSheetRef={actionSheetRef}
|
||||
ScrollViewRef={ScrollViewRef}
|
||||
containerProps={{
|
||||
style: {
|
||||
maxHeight: isLandscape ? height - 94 : (height / 100) * 70,
|
||||
@ -301,7 +428,9 @@ export const EachTrainInfoCore = ({
|
||||
shortHeader={<ShortHeader {...headerItem} />}
|
||||
longHeader={<LongHeader {...headerItem} />}
|
||||
topStickyContent={
|
||||
<ScrollStickyContent currentTrainData={currentTrainData} />
|
||||
<ScrollStickyContent
|
||||
{...{ currentTrainData, showThrew, setShowThrew, haveThrough }}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{headStation.length != 0 &&
|
||||
@ -360,17 +489,20 @@ export const EachTrainInfoCore = ({
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
{trainData.map((i, index) =>
|
||||
{trainDataWidhThrough.map((i, index) =>
|
||||
i.split(",")[1] == "提" ? (
|
||||
<DataFromButton i={i} />
|
||||
) : (
|
||||
<EachStopList
|
||||
i={i}
|
||||
index={index}
|
||||
stationList={stationList}
|
||||
points={points}
|
||||
currentTrainData={currentTrainData}
|
||||
openStationACFromEachTrainInfo={openStationACFromEachTrainInfo}
|
||||
{...{
|
||||
i,
|
||||
index,
|
||||
stationList,
|
||||
points: points ? points[index] : false,
|
||||
currentTrainData,
|
||||
openStationACFromEachTrainInfo,
|
||||
showThrew,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
|
@ -13,14 +13,13 @@ export const DynamicHeaderScrollView = (props) => {
|
||||
topStickyContent,
|
||||
styles,
|
||||
from,
|
||||
ScrollViewRef,
|
||||
} = props;
|
||||
const [headerSize, setHeaderSize] = useState("default");
|
||||
useLayoutEffect(() => {
|
||||
AS.getItem("headerSize")
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
setHeaderSize(res);
|
||||
}
|
||||
if (res) setHeaderSize(res);
|
||||
})
|
||||
.catch((e) => {
|
||||
AS.setItem("headerSize", "default");
|
||||
@ -160,6 +159,7 @@ export const DynamicHeaderScrollView = (props) => {
|
||||
stickyHeaderIndices={[1]}
|
||||
scrollEventThrottle={16}
|
||||
onScroll={onScroll}
|
||||
ref={ScrollViewRef}
|
||||
>
|
||||
<View style={{ height: Scroll_Distance, flexDirection: "column" }} />
|
||||
{topStickyContent && (
|
||||
|
167
components/Menu/StationPagination.tsx
Normal file
167
components/Menu/StationPagination.tsx
Normal file
@ -0,0 +1,167 @@
|
||||
import React, { FC, useState } from "react";
|
||||
import { View, Text, TouchableOpacity } from "react-native";
|
||||
import { Pagination } from "react-native-snap-carousel";
|
||||
import { useInterval } from "../../lib/useInterval";
|
||||
|
||||
import lineColorList from "../../assets/originData/lineColorList";
|
||||
|
||||
type StationProps = {
|
||||
DispNum: string;
|
||||
JrHpUrl: string;
|
||||
MyStation: string;
|
||||
StationMap: string;
|
||||
StationNumber: string | null;
|
||||
StationTimeTable: string;
|
||||
Station_EN: string;
|
||||
Station_JP: string;
|
||||
jslodApi: string;
|
||||
lat: number;
|
||||
lng: number;
|
||||
};
|
||||
type StationPaginationProps = {
|
||||
entries: StationProps[][];
|
||||
activeSlide: number;
|
||||
carouselRef: any;
|
||||
setSelectedCurrentStation: React.Dispatch<React.SetStateAction<number>>;
|
||||
dotButton: boolean;
|
||||
};
|
||||
|
||||
export const Paginations: FC<StationPaginationProps> = (props) => {
|
||||
const {
|
||||
entries,
|
||||
activeSlide,
|
||||
carouselRef,
|
||||
setSelectedCurrentStation,
|
||||
dotButton,
|
||||
} = props;
|
||||
return (
|
||||
<Pagination
|
||||
dotsLength={entries.length}
|
||||
activeDotIndex={activeSlide}
|
||||
carouselRef={carouselRef}
|
||||
containerStyle={{ paddingVertical: 0 }}
|
||||
dotStyle={{
|
||||
width: 12,
|
||||
height: 12,
|
||||
borderRadius: 6,
|
||||
backgroundColor: "#0099CC",
|
||||
}}
|
||||
inactiveDotStyle={
|
||||
{
|
||||
// Define styles for inactive dots here
|
||||
}
|
||||
}
|
||||
tappableDots={true}
|
||||
inactiveDotOpacity={0.4}
|
||||
inactiveDotScale={0.8}
|
||||
inactiveDotElement={
|
||||
dotButton && (
|
||||
<StationNumberMaker
|
||||
currentStations={entries}
|
||||
setSelectedCurrentStation={setSelectedCurrentStation}
|
||||
/>
|
||||
)
|
||||
}
|
||||
dotElement={
|
||||
dotButton && (
|
||||
<StationNumberMaker
|
||||
currentStations={entries}
|
||||
setSelectedCurrentStation={setSelectedCurrentStation}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
type StationNumberMakerProps = {
|
||||
currentStations: StationProps[][];
|
||||
setSelectedCurrentStation: React.Dispatch<React.SetStateAction<number>>;
|
||||
active?: boolean;
|
||||
index?: number;
|
||||
};
|
||||
export const StationNumberMaker: FC<StationNumberMakerProps> = (props) => {
|
||||
const { currentStations, active, index, setSelectedCurrentStation } = props;
|
||||
return (
|
||||
<StationNumber
|
||||
currentStation={currentStations[index]}
|
||||
active={active}
|
||||
onPress={() => setSelectedCurrentStation(index)}
|
||||
key={currentStations[index][0].StationNumber}
|
||||
/>
|
||||
);
|
||||
};
|
||||
type StationNumberProps = {
|
||||
currentStation: StationProps[];
|
||||
active: boolean;
|
||||
onPress: () => void;
|
||||
};
|
||||
export const StationNumber: FC<StationNumberProps> = (props) => {
|
||||
const { currentStation, active, onPress } = props;
|
||||
const [animation, setAnimation] = useState(0);
|
||||
const data = currentStation.filter((d) => (d.StationNumber ? true : false));
|
||||
useInterval(() => {
|
||||
if (!data) return;
|
||||
setAnimation(animation + 1 < data.length ? animation + 1 : 0);
|
||||
}, 2000);
|
||||
|
||||
const lineID = data[animation].StationNumber.slice(0, 1);
|
||||
const lineName = data[animation].StationNumber.slice(1);
|
||||
const size = active ? 24 : 18;
|
||||
const margin = active ? 3 : 6;
|
||||
const border = active ? 2 : 1;
|
||||
return (
|
||||
<>
|
||||
{active && (
|
||||
<View style={{ position: "relative", width: 0, height: 0 }}>
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
position: "absolute",
|
||||
width: 28,
|
||||
height: 28,
|
||||
marginLeft: 1,
|
||||
marginRight: 1,
|
||||
borderRadius: 22,
|
||||
borderColor: "black",
|
||||
borderWidth: 2,
|
||||
left: 0,
|
||||
top: -14,
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
<TouchableOpacity
|
||||
onPress={onPress}
|
||||
style={{
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
width: size,
|
||||
height: size,
|
||||
marginLeft: margin,
|
||||
marginRight: margin,
|
||||
borderColor: lineColorList[lineID],
|
||||
backgroundColor: "white",
|
||||
borderWidth: border,
|
||||
borderRadius: 22,
|
||||
}}
|
||||
key={currentStation[0].StationNumber + lineID}
|
||||
>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text
|
||||
style={{
|
||||
fontSize: active ? 8 : 6,
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
textAlign: "center",
|
||||
color: "black",
|
||||
fontWeight: active ? "bold" : "normal",
|
||||
textAlignVertical: "center",
|
||||
}}
|
||||
>
|
||||
{lineID + "\n" + lineName}
|
||||
</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
</TouchableOpacity>
|
||||
</>
|
||||
);
|
||||
};
|
@ -131,7 +131,7 @@ export const LayoutSettings = ({
|
||||
bool={trainPosition}
|
||||
setBool={setTrainPosition}
|
||||
color="red"
|
||||
str="列車の現在位置をアイコン表示"
|
||||
str="列車の現在地表示/ジャンプ"
|
||||
/>
|
||||
</SwitchArea>
|
||||
</View>
|
||||
|
@ -12,7 +12,7 @@ import * as Updates from "expo-updates";
|
||||
import { useWindowDimensions } from "react-native";
|
||||
import { ListItem } from "native-base";
|
||||
|
||||
const versionCode = "5.4.1";
|
||||
const versionCode = "5.5";
|
||||
|
||||
export const SettingTopPage = ({ navigate, testNFC, updateAndReload }) => {
|
||||
const { width } = useWindowDimensions();
|
||||
|
@ -10,6 +10,8 @@ import { DependTime } from "./LED_inside_Component/DependTime";
|
||||
import { LastStation } from "./LED_inside_Component/LastStation";
|
||||
import { StatusAndDelay } from "./LED_inside_Component/StatusAndDelay";
|
||||
import { TrainName } from "./LED_inside_Component/TrainName";
|
||||
import { customTrainDataDetector } from "../custom-train-data";
|
||||
import { trainDataType, trainPosition } from "../../lib/trainPositionTextArray";
|
||||
|
||||
type Props = {
|
||||
d: {
|
||||
@ -22,12 +24,6 @@ type Props = {
|
||||
station: {
|
||||
Station_JP: string;
|
||||
};
|
||||
customTrainDataDetector: (trainID: string) => {
|
||||
trainName: string;
|
||||
trainNumDistance?: number;
|
||||
type: string;
|
||||
info: string;
|
||||
};
|
||||
navigate: (screen: string, data?: any) => void;
|
||||
openStationACFromEachTrainInfo: (station: string) => void;
|
||||
};
|
||||
@ -37,7 +33,6 @@ export const EachData: FC<Props> = (props) => {
|
||||
trainIDSwitch,
|
||||
trainDescriptionSwitch,
|
||||
station,
|
||||
customTrainDataDetector,
|
||||
navigate,
|
||||
openStationACFromEachTrainInfo,
|
||||
} = props;
|
||||
@ -69,9 +64,28 @@ export const EachData: FC<Props> = (props) => {
|
||||
payload,
|
||||
});
|
||||
};
|
||||
const [train, setTrain] = useState(customTrainDataDetector(d.train));
|
||||
|
||||
const getTrainDataFromCurrentTrain = (trainNum: string) => {
|
||||
const customTrainData = customTrainDataDetector(d.train);
|
||||
if (customTrainData.type != "Normal") return customTrainData;
|
||||
const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
|
||||
if (currentTrainData.length == 0) return customTrainData;
|
||||
else if (currentTrainData[0].Type.includes("rapid:")) {
|
||||
const typeText = currentTrainData[0].Type.split(":");
|
||||
const returnData = {
|
||||
type: "Rapid",
|
||||
trainName: typeText[1].replace("\r", ""),
|
||||
trainIcon: null,
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
return returnData;
|
||||
}
|
||||
return customTrainData;
|
||||
};
|
||||
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
|
||||
useEffect(() => {
|
||||
setTrain(customTrainDataDetector(d.train));
|
||||
setTrain(getTrainDataFromCurrentTrain(d.train));
|
||||
}, [currentTrain, d.train, trainDescriptionSwitch]);
|
||||
// 土讃線複数存在対策
|
||||
const currentTrainData = checkDuplicateTrainData(
|
||||
@ -81,17 +95,27 @@ export const EachData: FC<Props> = (props) => {
|
||||
currentTrainData,
|
||||
station.Station_JP
|
||||
)}`;
|
||||
const trainPositionText = currentTrainData?.Pos.match("~")
|
||||
? `現在地:${
|
||||
currentTrainData?.Pos.replace("(下り)", "")
|
||||
.replace("(上り)", "")
|
||||
.split("~")[currentTrainData?.Direction == 1 ? 0 : 1]
|
||||
}→${
|
||||
currentTrainData?.Pos.replace("(下り)", "")
|
||||
.replace("(上り)", "")
|
||||
.split("~")[currentTrainData?.Direction == 1 ? 1 : 0]
|
||||
}間を走行中`
|
||||
: `現在地:${currentTrainData?.Pos}`;
|
||||
const trainPositionText = (trainData: trainDataType) => {
|
||||
const { isBetween, Pos } = trainPosition(trainData);
|
||||
if (isBetween === true) return `現在地:${Pos.from}→${Pos.to}間を走行中`;
|
||||
else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`;
|
||||
};
|
||||
|
||||
const [platformNumber, setPlatformNumber] = useState<number>();
|
||||
const [platformDescription, setPlatformDescription] = useState<string>();
|
||||
useEffect(() => {
|
||||
fetch(
|
||||
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined);
|
||||
setPlatformDescription(
|
||||
data?.type == "Station" ? data?.description : undefined
|
||||
);
|
||||
});
|
||||
}, [currentTrainData, currentTrain]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<TouchableOpacity
|
||||
@ -120,7 +144,11 @@ export const EachData: FC<Props> = (props) => {
|
||||
{trainDescriptionSwitch && (
|
||||
<Description
|
||||
info={`${
|
||||
trainIDSwitch ? currentTrainData?.PosNum : trainPositionText
|
||||
trainIDSwitch
|
||||
? currentTrainData?.PosNum + currentTrainData?.Line
|
||||
: trainPositionText(currentTrainData)
|
||||
} ${platformNumber ? platformNumber + "番線" : ""} ${
|
||||
platformDescription ? "("+platformDescription+")" : ""
|
||||
}`}
|
||||
onLongClick={() => {
|
||||
Linking.openURL(
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { View } from "react-native";
|
||||
import { widthPercentageToDP as wp } from "react-native-responsive-screen";
|
||||
import { customTrainDataDetector } from "../custom-train-data";
|
||||
import { useInterval } from "../../lib/useInterval";
|
||||
import { objectIsEmpty } from "../../lib/objectIsEmpty";
|
||||
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
|
||||
@ -203,7 +202,6 @@ export default function LED_vision(props) {
|
||||
d,
|
||||
trainIDSwitch,
|
||||
trainDescriptionSwitch,
|
||||
customTrainDataDetector,
|
||||
navigate,
|
||||
openStationACFromEachTrainInfo,
|
||||
}}
|
||||
|
@ -1 +1 @@
|
||||
export const news = "2024-9-29";
|
||||
export const news = "2024-11-01";
|
||||
|
@ -1,4 +1,6 @@
|
||||
export const checkDuplicateTrainData = (currentTrainArray) => {
|
||||
import { trainDataType } from "./trainPositionTextArray";
|
||||
|
||||
export const checkDuplicateTrainData = (currentTrainArray: trainDataType[]) => {
|
||||
const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線");
|
||||
if (currentTrainArray.length == 1) return currentTrainArray[0];
|
||||
if (notNyujoData.length == 0) return currentTrainArray[0];
|
@ -7,105 +7,43 @@ export const findReversalPoints = (array, stopStationIDList) => {
|
||||
if (!array instanceof Array) return [];
|
||||
if (!array) return [];
|
||||
if (array[0] instanceof Array) return [];
|
||||
const arrayNumber = array.map((d) => ({
|
||||
line: d
|
||||
.split("")
|
||||
.filter((s) => "A" < s && s < "Z")
|
||||
.join(""),
|
||||
ID: d
|
||||
.split("")
|
||||
.filter((s) => "0" <= s && s <= "9")
|
||||
.join(""),
|
||||
}));
|
||||
const stopStationIDListNumber = stopStationIDList.map((d) => {
|
||||
if (!d) return { line: [], ID: [] };
|
||||
return {
|
||||
line: d
|
||||
.split("")
|
||||
.filter((s) => "A" < s && s < "Z")
|
||||
.join(""),
|
||||
ID: d
|
||||
.split("")
|
||||
.filter((s) => "0" <= s && s <= "9")
|
||||
.join(""),
|
||||
};
|
||||
});
|
||||
|
||||
// 完全一致
|
||||
if (array.length == 1) {
|
||||
const index = stopStationIDList.indexOf(array[0]);
|
||||
if (index != -1) return [index];
|
||||
// 通過駅の場合
|
||||
for (let i = 0; i < stopStationIDListNumber.length - 1; i++) {
|
||||
if (stopStationIDListNumber[i].ID < arrayNumber[0].ID) {
|
||||
if (stopStationIDListNumber[i + 1].ID > arrayNumber[0].ID) {
|
||||
return [i + 1];
|
||||
}
|
||||
}
|
||||
if (stopStationIDListNumber[i].ID > arrayNumber[0].ID) {
|
||||
if (stopStationIDListNumber[i + 1].ID < arrayNumber[0].ID) {
|
||||
return [i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
const index = stopStationIDList.map((d) => {
|
||||
let a = false;
|
||||
d.forEach((x) => {
|
||||
if (x == array[0]) a = true;
|
||||
});
|
||||
return a;
|
||||
});
|
||||
if (index != -1) return index;
|
||||
}
|
||||
// 駅間の場合
|
||||
if (array.length == 2) {
|
||||
const index1 = stopStationIDList.indexOf(array[0]);
|
||||
const index2 = stopStationIDList.indexOf(array[1]);
|
||||
if (index1 != -1 && index2 != -1) {
|
||||
// 駅間で通過駅も無い場合
|
||||
if (index1 < index2) {
|
||||
if (index1 + 1 == index2) {
|
||||
return [index2];
|
||||
} else {
|
||||
const returnArray = [];
|
||||
for (let i = index1 + 1; i <= index2; i++) {
|
||||
returnArray.push(i);
|
||||
}
|
||||
return returnArray;
|
||||
}
|
||||
}
|
||||
if (index1 > index2) {
|
||||
if (index2 + 1 == index1) return [index1];
|
||||
else {
|
||||
const returnArray = [];
|
||||
for (let i = index2 + 1; i <= index1; i++) {
|
||||
returnArray.push(i);
|
||||
}
|
||||
return returnArray;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const getNearStationID = (stationID) => {
|
||||
for (let i = 0; i <= stopStationIDListNumber.length; i++) {
|
||||
if (stopStationIDListNumber[i].ID < stationID) {
|
||||
if (stopStationIDListNumber[i + 1].ID > stationID) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
if (stopStationIDListNumber[i].ID > stationID) {
|
||||
if (stopStationIDListNumber[i + 1].ID < stationID) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
let newIndex1 = index1;
|
||||
let newIndex2 = index2;
|
||||
if (index1 == -1) {
|
||||
newIndex1 = getNearStationID(arrayNumber[0].ID);
|
||||
}
|
||||
if (index2 == -1) {
|
||||
newIndex2 = getNearStationID(arrayNumber[1].ID);
|
||||
}
|
||||
if (newIndex1 && newIndex2) {
|
||||
return [newIndex1, newIndex2];
|
||||
}
|
||||
const allThroughStation = stopStationIDList.map((d) => {
|
||||
if (
|
||||
(array[0] == "M12" && array[1] == "Y09") ||
|
||||
(array[0] == "Y09" && array[1] == "M12")
|
||||
)
|
||||
return d[0] == "M12" ? true : false;
|
||||
|
||||
// 通過駅の場合
|
||||
}
|
||||
let returndata = false;
|
||||
d.forEach((x) => {
|
||||
if (array[0] < x && x < array[1]) {
|
||||
returndata = true;
|
||||
} else if (array[0] < x && x == array[1]) {
|
||||
returndata = true;
|
||||
} else if (array[1] == x && x < array[0]) {
|
||||
returndata = true;
|
||||
} else if (array[1] < x && x < array[0]) {
|
||||
returndata = true;
|
||||
}
|
||||
});
|
||||
|
||||
return [];
|
||||
return returndata;
|
||||
});
|
||||
return allThroughStation;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { trainDataType } from "./trainPositionTextArray";
|
||||
|
||||
type getTrainDelayStatus = (
|
||||
current: { delay: number | "入線" | string; Pos: string },
|
||||
current: trainDataType,
|
||||
Station_JP: string
|
||||
) => string | number;
|
||||
export const getTrainDelayStatus: getTrainDelayStatus = (
|
||||
|
39
lib/trainPositionTextArray.ts
Normal file
39
lib/trainPositionTextArray.ts
Normal file
@ -0,0 +1,39 @@
|
||||
type returnBetweenType = {
|
||||
isBetween: true;
|
||||
Pos: {
|
||||
from: string;
|
||||
to: string;
|
||||
};
|
||||
};
|
||||
type returnCurrentType = {
|
||||
isBetween: false;
|
||||
Pos: {
|
||||
Pos: string;
|
||||
};
|
||||
};
|
||||
export type trainDataType = {
|
||||
Pos?: string;
|
||||
Direction?: number;
|
||||
Index?: number;
|
||||
Line?: string;
|
||||
PosNum?: number;
|
||||
Type?: string;
|
||||
delay?: string | number;
|
||||
num?: string;
|
||||
};
|
||||
type trainData = (
|
||||
trainData: trainDataType
|
||||
) => returnBetweenType | returnCurrentType;
|
||||
|
||||
export const trainPosition: trainData = (trainData) => {
|
||||
if (!trainData?.Pos) return { isBetween: false, Pos: { Pos: "" } };
|
||||
const { Pos, Direction } = trainData;
|
||||
if (Pos.match("~")) {
|
||||
const [topST, downST] = Pos.replace("(下り)", "")
|
||||
.replace("(上り)", "")
|
||||
.split("~");
|
||||
const from = Direction == 1 ? topST : downST;
|
||||
const to = Direction == 1 ? downST : topST;
|
||||
return { isBetween: true, Pos: { from, to } };
|
||||
} else return { isBetween: false, Pos: { Pos } };
|
||||
};
|
@ -516,13 +516,341 @@ export const injectJavascriptData: InjectJavascriptData = (
|
||||
case "114M":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s6000p.png');
|
||||
break;
|
||||
default:
|
||||
|
||||
|
||||
// 土讃線普通列車系統(include ごな線)
|
||||
// ごな線
|
||||
case "5851D": //219D併結 [ToDo: 219Dとの分割対策]
|
||||
case "5854D":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640jgr.png');
|
||||
break;
|
||||
|
||||
//JR車両乗り入れ運用
|
||||
case "5858D":
|
||||
case "5869D":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png');
|
||||
break;
|
||||
//併結運用の併結される側 [ToDo: 分割対策]
|
||||
case "5845D":
|
||||
case "5851D":
|
||||
case "5818D":
|
||||
case "5820D":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640.png');
|
||||
break;
|
||||
// 土讃線単体列車のキハ32運用
|
||||
case "715D":
|
||||
case "718D":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s32ns.png');
|
||||
break;
|
||||
|
||||
// サンライズに伴う気動車代走
|
||||
case "6219D":
|
||||
case "6222D":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png');
|
||||
break;
|
||||
// それ以外の土讃線ごな線直通列車
|
||||
case "5811D":
|
||||
case "5813D":
|
||||
case "5815D":
|
||||
case "5817D":
|
||||
case "5843D":
|
||||
case "5853D":
|
||||
case "5855D":
|
||||
case "5859D":
|
||||
case "5861D":
|
||||
case "5865D":
|
||||
case "5881D":
|
||||
case "5885D":
|
||||
case "5889D":
|
||||
|
||||
case "5812D":
|
||||
case "5814D":
|
||||
case "5816D":
|
||||
case "5852D":
|
||||
case "5856D":
|
||||
case "5860D":
|
||||
case "5862D":
|
||||
case "5872D":
|
||||
case "5874D":
|
||||
case "5876D":
|
||||
case "5880D":
|
||||
case "5882D":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640.png');
|
||||
break;
|
||||
// それ以外の土讃線普通列車(1000)
|
||||
case "4210D":
|
||||
case "4212D":
|
||||
case "4214D":
|
||||
case "4218D":
|
||||
case "4220D":
|
||||
case "4222D":
|
||||
case "4224D":
|
||||
case "4226D":
|
||||
case "4228D":
|
||||
case "4230D":
|
||||
case "4232D":
|
||||
case "4234D":
|
||||
case "4236D":
|
||||
case "4238D":
|
||||
case "4240D":
|
||||
case "4242D":
|
||||
case "4244D":
|
||||
case "4250D":
|
||||
case "4252D":
|
||||
case "4254D":
|
||||
case "4256D":
|
||||
|
||||
case "4211D":
|
||||
case "4221D":
|
||||
case "4223D":
|
||||
case "4225D":
|
||||
case "4227D":
|
||||
case "4229D":
|
||||
case "4231D":
|
||||
case "4235D":
|
||||
case "4237D":
|
||||
case "4239D":
|
||||
case "4241D":
|
||||
case "4245D":
|
||||
case "4247D":
|
||||
case "4249D":
|
||||
case "4251D":
|
||||
case "4253D":
|
||||
case "4255D":
|
||||
case "4257D":
|
||||
case "4259D":
|
||||
case "4261D":
|
||||
|
||||
case "4710D":
|
||||
case "4726D":
|
||||
case "4730D":
|
||||
case "4732D":
|
||||
case "4734D":
|
||||
case "4738D":
|
||||
case "4740D":
|
||||
case "4742D":
|
||||
case "4744D":
|
||||
case "4746D":
|
||||
case "4752D":
|
||||
case "4756D":
|
||||
case "4762D":
|
||||
case "4764D":
|
||||
case "4766D":
|
||||
|
||||
case "4711D":
|
||||
case "4713D":
|
||||
case "4723D":
|
||||
case "4725D":
|
||||
case "4727D":
|
||||
case "4729D":
|
||||
case "4731D":
|
||||
case "4737D":
|
||||
case "4739D":
|
||||
case "4745D":
|
||||
case "4753D":
|
||||
case "4755D":
|
||||
case "4759D":
|
||||
case "4761D":
|
||||
case "4763D":
|
||||
|
||||
case "216D":
|
||||
case "238D":
|
||||
case "246D":
|
||||
case "248D":
|
||||
|
||||
case "213D":
|
||||
case "215D":
|
||||
case "217D":
|
||||
case "219D":
|
||||
case "233D":
|
||||
case "243D":
|
||||
|
||||
case "710D":
|
||||
case "712D":
|
||||
case "714D":
|
||||
case "716D":
|
||||
case "720D":
|
||||
case "722D":
|
||||
case "724D":
|
||||
case "728D":
|
||||
case "736D":
|
||||
case "748D":
|
||||
case "750D":
|
||||
case "754D":
|
||||
case "758D":
|
||||
case "760D":
|
||||
case "768D":
|
||||
|
||||
case "717D":
|
||||
case "719D":
|
||||
case "721D":
|
||||
case "733D":
|
||||
case "735D":
|
||||
case "737D":
|
||||
case "741D":
|
||||
case "743D":
|
||||
case "747D":
|
||||
case "749D":
|
||||
case "751D":
|
||||
case "755D":
|
||||
case "757D":
|
||||
case "761D":
|
||||
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png');
|
||||
break;
|
||||
// 予讃線/土讃線普通列車運用(7000,7200)
|
||||
// 下り列車(伊予西条-松山は全て7000系)
|
||||
|
||||
case "5519M":
|
||||
case "5525M":
|
||||
case "5215M":
|
||||
case "5103M":
|
||||
case "107M":
|
||||
case "1219M":
|
||||
case "5109M":
|
||||
case "6109M":
|
||||
case "5531M":
|
||||
case "1221M":
|
||||
case "5225M":
|
||||
case "5111M":
|
||||
case "1227M":
|
||||
case "115M":
|
||||
case "5229M":
|
||||
case "5117M":
|
||||
case "5119M":
|
||||
case "119M":
|
||||
case "5231M":
|
||||
case "4537M":
|
||||
case "5233M":
|
||||
case "123M":
|
||||
case "125M":
|
||||
case "5235M":
|
||||
case "5239M":
|
||||
case "5547M":
|
||||
case "129M":
|
||||
case "131M":
|
||||
case "5241M":
|
||||
case "5133M":
|
||||
case "135M":
|
||||
case "1243M":
|
||||
case "137M":
|
||||
case "5139M":
|
||||
case "4559M":
|
||||
case "1245M":
|
||||
case "141M":
|
||||
case "1247M":
|
||||
case "5249M":
|
||||
case "145M":
|
||||
case "5253M":
|
||||
case "5149M":
|
||||
case "5255M":
|
||||
case "151M":
|
||||
case "5257M":
|
||||
case "153M":
|
||||
case "5259M":
|
||||
case "155M":
|
||||
case "1263M":
|
||||
case "157M":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png');
|
||||
break;
|
||||
// 下り7000系
|
||||
case "101M":
|
||||
case "4601M":
|
||||
case "4113M":
|
||||
case "121M":
|
||||
case "127M":
|
||||
case "555M":
|
||||
case "4565M":
|
||||
case "159M":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
|
||||
break;
|
||||
// 上り列車 7200系
|
||||
case "5102M":
|
||||
case "104M":
|
||||
case "5210M":
|
||||
case "5108M":
|
||||
case "110M":
|
||||
case "112M":
|
||||
case "118M":
|
||||
case "5218M":
|
||||
case "5120M":
|
||||
case "5220M":
|
||||
case "5512M":
|
||||
case "1602M":
|
||||
case "1224M":
|
||||
case "5124M":
|
||||
case "5226M":
|
||||
case "5126M":
|
||||
case "1230M":
|
||||
case "4128M":
|
||||
case "130M":
|
||||
case "4522M":
|
||||
case "5232M":
|
||||
case "132M":
|
||||
case "5234M":
|
||||
case "134M":
|
||||
case "136M":
|
||||
case "5236M":
|
||||
case "5140M":
|
||||
case "5238M":
|
||||
case "5240M":
|
||||
case "142M":
|
||||
case "4530M":
|
||||
case "144M":
|
||||
case "5242M":
|
||||
case "146M":
|
||||
case "5244M":
|
||||
case "4148M":
|
||||
case "1246M":
|
||||
case "150M":
|
||||
case "5538M":
|
||||
case "5152M":
|
||||
case "154M":
|
||||
case "156M":
|
||||
case "1252M":
|
||||
case "158M":
|
||||
case "4604M":
|
||||
case "548M":
|
||||
case "5254M":
|
||||
case "1606M":
|
||||
case "5160M":
|
||||
case "5256M":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png');
|
||||
break;
|
||||
// 上り7000系
|
||||
case "114M":
|
||||
case "122M":
|
||||
case "4138M":
|
||||
case "138M":
|
||||
case "4542M":
|
||||
case "162M":
|
||||
case "4166M":
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
|
||||
break;
|
||||
default: //指定車両でなく、Regexでの指定に移動
|
||||
// 琴平直通系普通電車
|
||||
if(new RegExp(/^(1|4|5)2\\d\\dM$/).test(列番データ)){
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png');
|
||||
break;
|
||||
}
|
||||
else if(new RegExp(/^(1|4|5)(1|5|6)\\d\\dM$/).test(列番データ)){
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
|
||||
break;
|
||||
}
|
||||
else if(new RegExp(/^(1|5|6)\\d\\dM$/).test(列番データ)){
|
||||
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
`
|
||||
: ``;
|
||||
|
||||
const normal_train_name = `
|
||||
if(列車名データ.match("サンポート")){
|
||||
const textBase = 列車名データ.split(":")[1];
|
||||
行き先情報.innerText = textBase+行き先情報.innerText;
|
||||
}
|
||||
if(new RegExp(/^4[1-9]\\d\\d[DM]$/).test(列番データ) || new RegExp(/^5[1-7]\\d\\d[DM]$/).test(列番データ) || 列番データ ==="3621D"){
|
||||
行き先情報.innerText = "ワンマン\\n"+行き先情報.innerText;
|
||||
flag=true;
|
||||
@ -630,6 +958,7 @@ const setStrings = () =>{
|
||||
}
|
||||
var 行き先情報 = element.getElementsByTagName("p")[0];
|
||||
var 列番データ = element.getAttribute('offclick').split('"')[1];
|
||||
var 列車名データ = element.getAttribute('offclick').split('"')[3];
|
||||
var flag=false;
|
||||
var TrainType = undefined;
|
||||
setTrainMenuDialog(element)
|
||||
@ -762,6 +1091,7 @@ makeTrainView.observe(document.getElementById('modal_content'), {
|
||||
trainMenu == "true"
|
||||
? `
|
||||
// これの中身抽出ShowTrainTimeInfo("1228M","normal")
|
||||
// ShowTrainTimeInfo("142M","rapid:サンポート南風リレー")
|
||||
function setTrainMenuDialog(d){
|
||||
try{
|
||||
const offclick = d.getAttribute('offclick');
|
||||
|
84
menu.js
84
menu.js
@ -1,5 +1,5 @@
|
||||
import React, { useRef, useState, useEffect } from "react";
|
||||
import Carousel from "react-native-snap-carousel";
|
||||
import Carousel, { Pagination } from "react-native-snap-carousel";
|
||||
import {
|
||||
Platform,
|
||||
View,
|
||||
@ -7,6 +7,7 @@ import {
|
||||
Linking,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
LayoutAnimation,
|
||||
} from "react-native";
|
||||
import Constants from "expo-constants";
|
||||
import * as Location from "expo-location";
|
||||
@ -31,6 +32,9 @@ import { SheetManager } from "react-native-actions-sheet";
|
||||
import { useTrainDelayData } from "./stateBox/useTrainDelayData";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import { useStationList } from "./stateBox/useStationList";
|
||||
import { Paginations } from "./components/Menu/StationPagination";
|
||||
import lineColorList from "./assets/originData/lineColorList";
|
||||
import { AS } from "./storageControl";
|
||||
|
||||
export default function Menu({ getCurrentTrain }) {
|
||||
const { navigate } = useNavigation();
|
||||
@ -156,6 +160,24 @@ export default function Menu({ getCurrentTrain }) {
|
||||
SheetManager.show("StationDetailView", { payload });
|
||||
};
|
||||
|
||||
const [dotButton, setDotButton] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
AS.getItem("CarouselSettings/activeDotSettings").then((data) => {
|
||||
setDotButton(data === "true");
|
||||
});
|
||||
}, []);
|
||||
const oLPSign = () => {
|
||||
LayoutAnimation.configureNext({
|
||||
duration: 600,
|
||||
update: { type: "spring", springDamping: 0.5 },
|
||||
});
|
||||
AS.setItem(
|
||||
"CarouselSettings/activeDotSettings",
|
||||
!dotButton ? "true": "false"
|
||||
);
|
||||
setDotButton(!dotButton);
|
||||
}
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
@ -169,31 +191,41 @@ export default function Menu({ getCurrentTrain }) {
|
||||
<ScrollView>
|
||||
<TopMenuButton />
|
||||
{originalStationList.length != 0 && allStationData.length != 0 && (
|
||||
<Carousel
|
||||
ref={carouselRef}
|
||||
layout={"default"}
|
||||
data={originalStationList && allStationData}
|
||||
sliderWidth={wp("100%")}
|
||||
itemWidth={wp("80%")}
|
||||
enableMomentum
|
||||
callbackOffsetMargin={1000}
|
||||
activeAnimationOptions={0.3}
|
||||
onSnapToItem={setSelectedCurrentStation}
|
||||
renderItem={({ item }) => {
|
||||
return (
|
||||
<View
|
||||
style={{ marginVertical: 10 }}
|
||||
key={item[0].StationNumber}
|
||||
>
|
||||
<Sign
|
||||
currentStation={item}
|
||||
isCurrentStation={item == currentStation}
|
||||
oP={oPSign}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<>
|
||||
<Carousel
|
||||
ref={carouselRef}
|
||||
layout={"default"}
|
||||
data={originalStationList && allStationData}
|
||||
sliderWidth={wp("100%")}
|
||||
itemWidth={wp("80%")}
|
||||
enableMomentum
|
||||
callbackOffsetMargin={1000}
|
||||
activeAnimationOptions={0.3}
|
||||
onSnapToItem={setSelectedCurrentStation}
|
||||
renderItem={({ item }) => {
|
||||
return (
|
||||
<View
|
||||
style={{ marginVertical: 10 }}
|
||||
key={item[0].StationNumber}
|
||||
>
|
||||
<Sign
|
||||
currentStation={item}
|
||||
isCurrentStation={item == currentStation}
|
||||
oP={oPSign}
|
||||
oLP={oLPSign}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Paginations
|
||||
entries={allStationData}
|
||||
activeSlide={selectedCurrentStation}
|
||||
carouselRef={carouselRef}
|
||||
setSelectedCurrentStation={setSelectedCurrentStation}
|
||||
dotButton={dotButton}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{allStationData.length != 0 &&
|
||||
originalStationList.length != 0 &&
|
||||
|
@ -81,24 +81,12 @@ export const BusAndTrainDataProvider = ({ children }) => {
|
||||
returnArray.push(Object.keys(trainPairList[trainNum])[0]);
|
||||
}
|
||||
switch (trainNum) {
|
||||
case "4125M":
|
||||
returnArray.push("545M");
|
||||
break;
|
||||
case "545M":
|
||||
returnArray.push("4125M");
|
||||
break;
|
||||
case "143M":
|
||||
returnArray.push("147M");
|
||||
break;
|
||||
case "147M":
|
||||
returnArray.push("143M");
|
||||
break;
|
||||
case "1261M":
|
||||
returnArray.push("4261M");
|
||||
break;
|
||||
case "4261M":
|
||||
returnArray.push("1261M");
|
||||
break;
|
||||
case new RegExp(/^4[1-9]\d\d[DM]$/).test(trainNum):
|
||||
if (trainList["5" + trainNum.substring(1)])
|
||||
returnArray.push("5" + trainNum.substring(1));
|
||||
|
Loading…
Reference in New Issue
Block a user