Compare commits
134 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd585b8206 | ||
|
|
bb1ee2666e | ||
|
|
5b715f2dc5 | ||
|
|
2888c41301 | ||
|
|
2a70a0e34b | ||
|
|
f9c6e6dd97 | ||
|
|
3b85ab9776 | ||
|
|
fa1eec4569 | ||
|
|
fd3e488c34 | ||
|
|
f475680665 | ||
|
|
b6dd05419b | ||
|
|
0d7658eba1 | ||
|
|
927c73567a | ||
|
|
0bf345ff6a | ||
|
|
342afea34c | ||
|
|
f8dfa77e97 | ||
|
|
f261ff981a | ||
|
|
b40280d099 | ||
|
|
09170c6636 | ||
|
|
8705f69725 | ||
|
|
9562e04ffe | ||
|
|
2ffb47b60c | ||
|
|
1208a78831 | ||
|
|
493ef92bd6 | ||
|
|
a51ffe4a82 | ||
|
|
0ea25f1e97 | ||
|
|
16bd0fe192 | ||
|
|
d75a495b19 | ||
|
|
a346a1477c | ||
|
|
c93ca94a61 | ||
|
|
4480c161d1 | ||
|
|
deb9b40949 | ||
|
|
fced009607 | ||
|
|
0890c1b9ff | ||
|
|
4b3816940b | ||
|
|
9ea23d6eba | ||
|
|
31ea303b88 | ||
|
|
7716cb516c | ||
|
|
70976c0554 | ||
|
|
5616c7ed96 | ||
|
|
13580a57d4 | ||
|
|
c9481fb0c2 | ||
|
|
5cda45740c | ||
|
|
84d1305796 | ||
|
|
336e3510fa | ||
|
|
25780e1664 | ||
|
|
e6fab84393 | ||
|
|
390acdeab7 | ||
|
|
ff7a5624e6 | ||
|
|
9b79f224d3 | ||
|
|
2f76e3776f | ||
|
|
026da47d82 | ||
|
|
29be052bf6 | ||
|
|
2fb7d97d33 | ||
|
|
76ebf8055b | ||
|
|
7b572cd657 | ||
|
|
61fa0f8484 | ||
|
|
935aaf2610 | ||
|
|
8ec53d6e06 | ||
|
|
e8b1a21a3b | ||
|
|
e6b89842a3 | ||
|
|
1fc5220405 | ||
|
|
5489406578 | ||
|
|
2b217e98c7 | ||
|
|
2c2e61a2fa | ||
|
|
c222b303df | ||
|
|
8f8c095ecd | ||
|
|
e31e84ff34 | ||
|
|
2c2b355a3e | ||
|
|
5461087ca0 | ||
|
|
57c7285b6e | ||
|
|
5c134c95cc | ||
|
|
8781653fe8 | ||
|
|
67ccc37c17 | ||
|
|
92caab03f5 | ||
|
|
dd3a57b3ae | ||
|
|
8df32b9c1d | ||
|
|
4b901d5015 | ||
|
|
fc5c62685a | ||
|
|
fbc98b2ff7 | ||
|
|
3502043176 | ||
|
|
2d0ad8d59e | ||
|
|
b5172df7a9 | ||
|
|
740d414d2d | ||
|
|
8db3e6c218 | ||
|
|
fb35b01d2e | ||
|
|
5fa6b1f73e | ||
|
|
c16f7401ea | ||
|
|
f260c5d2dd | ||
|
|
80e9f1a869 | ||
|
|
26096ba244 | ||
|
|
435a910ef9 | ||
|
|
68b9236d65 | ||
|
|
0148c12e08 | ||
|
|
34dc62aee6 | ||
|
|
54ae681f00 | ||
|
|
db40351fec | ||
|
|
2dd8e62f85 | ||
|
|
0937fbb619 | ||
|
|
32edab3289 | ||
|
|
fa96e68770 | ||
|
|
1681be4437 | ||
|
|
7f96c44e88 | ||
|
|
7d485c466c | ||
|
|
7869cbee6d | ||
|
|
c2ad681891 | ||
|
|
163f9ead18 | ||
|
|
611fc9953f | ||
|
|
fd95e99874 | ||
|
|
f5d0f993db | ||
|
|
b7e763d265 | ||
|
|
0afa6f402b | ||
|
|
eacce53775 | ||
|
|
47b1eb325e | ||
|
|
a145e2c24f | ||
|
|
862742cd3e | ||
|
|
d5f2d367dd | ||
|
|
b1f72f18b5 | ||
|
|
d4d86fb7eb | ||
|
|
056a059a68 | ||
|
|
12676d59cf | ||
|
|
bca2b300d3 | ||
|
|
406808ee58 | ||
|
|
a8aadb7f08 | ||
|
|
b810405573 | ||
|
|
6f62418426 | ||
|
|
88621dd1c8 | ||
|
|
12d9c1f49d | ||
|
|
30c2b8a2f9 | ||
|
|
8bc7069c4e | ||
|
|
737cd25539 | ||
|
|
2c50e5af67 | ||
|
|
ea677b4da5 | ||
|
|
4525443e39 |
@@ -0,0 +1,64 @@
|
|||||||
|
import React, { FC } from "react";
|
||||||
|
import { View, Text, TouchableWithoutFeedback, Alert } from "react-native";
|
||||||
|
import { useAllTrainDiagram } from "@/stateBox/useAllTrainDiagram";
|
||||||
|
|
||||||
|
export const DataConnectedButton: FC<{
|
||||||
|
i: string;
|
||||||
|
openTrainInfo: (trainNum: string) => void;
|
||||||
|
}> = ({ i, openTrainInfo }) => {
|
||||||
|
const [station, se, time] = i.split(",");
|
||||||
|
const { keyList } = useAllTrainDiagram();
|
||||||
|
// 列番が有効かどうかをチェックする関数
|
||||||
|
const isValidTrainNumber = (trainNum: string): boolean => {
|
||||||
|
return keyList.includes(trainNum);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TouchableWithoutFeedback
|
||||||
|
onPress={() => {
|
||||||
|
// timeの文字列が列番として有効かを検証する
|
||||||
|
if (!isValidTrainNumber(time)) {
|
||||||
|
Alert.alert(
|
||||||
|
"列番が見つかりません",
|
||||||
|
`列番「${time}」は時刻表に存在しません。`,
|
||||||
|
[{ text: "OK" }]
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
openTrainInfo(time);
|
||||||
|
}}
|
||||||
|
key={station + time}
|
||||||
|
>
|
||||||
|
<View style={{ flexDirection: "row", backgroundColor: "#f5f5f5" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
padding: 8,
|
||||||
|
flexDirection: "row",
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
borderBottomColor: "#f0f0f0",
|
||||||
|
flex: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 35,
|
||||||
|
position: "relative",
|
||||||
|
marginHorizontal: 15,
|
||||||
|
flexDirection: "row",
|
||||||
|
height: "10%",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={{ fontSize:16, fontFamily: "DiaPro" }}>
|
||||||
|
{se === "連" ? "⬐" : "↳"}
|
||||||
|
</Text>
|
||||||
|
<Text style={{ fontSize: 20, color: "#0000EE" }}>{time}</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={{ fontSize: 18, width: 50 }}>
|
||||||
|
{se === "連" ? "連結" : "解結"}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</TouchableWithoutFeedback>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import React, { FC } from "react";
|
|
||||||
import { View, Text, TouchableWithoutFeedback } from "react-native";
|
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
|
||||||
import { Linking } from "react-native";
|
|
||||||
export const DataFromButton: FC<{ i: string }> = ({ i }) => {
|
|
||||||
const [station, se, time] = i.split(",");
|
|
||||||
return (
|
|
||||||
<TouchableWithoutFeedback
|
|
||||||
onPress={() => Linking.openURL(time)}
|
|
||||||
key={station}
|
|
||||||
>
|
|
||||||
<View style={{ flexDirection: "row" }}>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
padding: 8,
|
|
||||||
flexDirection: "row",
|
|
||||||
borderBottomWidth: 1,
|
|
||||||
borderBottomColor: "#f0f0f0",
|
|
||||||
flex: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text style={{ fontSize: 20 }}>{station}</Text>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Text style={{ fontSize: 18 }}>
|
|
||||||
提供元
|
|
||||||
<MaterialCommunityIcons
|
|
||||||
name={"open-in-new"}
|
|
||||||
color="black"
|
|
||||||
size={20}
|
|
||||||
/>
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</TouchableWithoutFeedback>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
isCanceledSe,
|
isCanceledSe,
|
||||||
isThroughSe,
|
isThroughSe,
|
||||||
isCommunitySe,
|
isCommunitySe,
|
||||||
parseSeString
|
parseSeString,
|
||||||
} from "@/utils/seUtils";
|
} from "@/utils/seUtils";
|
||||||
import type { SeTypes } from "@/types";
|
import type { SeTypes } from "@/types";
|
||||||
|
|
||||||
@@ -96,9 +96,9 @@ export const EachStopList: FC<props> = ({
|
|||||||
"StationNumber": "B01",
|
"StationNumber": "B01",
|
||||||
},
|
},
|
||||||
] */
|
] */
|
||||||
const StationNumbers = Stations
|
const StationNumbers = Stations.filter((d) => d.StationNumber != null).map(
|
||||||
.filter((d) => d.StationNumber != null)
|
(d) => d.StationNumber as string
|
||||||
.map((d) => d.StationNumber as string);
|
);
|
||||||
// SE文字列を表示用に変換
|
// SE文字列を表示用に変換
|
||||||
const [seString, seType] = parseSeString(se);
|
const [seString, seType] = parseSeString(se);
|
||||||
|
|
||||||
@@ -106,13 +106,26 @@ export const EachStopList: FC<props> = ({
|
|||||||
const isThrough = isThroughSe(se);
|
const isThrough = isThroughSe(se);
|
||||||
const isCanceled = isCanceledSe(se);
|
const isCanceled = isCanceledSe(se);
|
||||||
const isCommunity = isCommunitySe(se);
|
const isCommunity = isCommunitySe(se);
|
||||||
const isDelayed = currentTrainData?.delay !== undefined &&
|
const isDelayed =
|
||||||
currentTrainData?.delay !== "入線" &&
|
currentTrainData?.delay !== undefined &&
|
||||||
currentTrainData?.delay > 0;
|
currentTrainData?.delay !== "入線" &&
|
||||||
|
currentTrainData?.delay > 0;
|
||||||
|
|
||||||
const colors = getStopListColors(isThrough, isCommunity, isCanceled, isDelayed, isNotService);
|
const colors = getStopListColors(
|
||||||
|
isThrough,
|
||||||
|
isCommunity,
|
||||||
|
isCanceled,
|
||||||
|
isDelayed,
|
||||||
|
isNotService
|
||||||
|
);
|
||||||
// 打ち消し線用の通常色(遅延していない時の色)
|
// 打ち消し線用の通常色(遅延していない時の色)
|
||||||
const normalColors = getStopListColors(isThrough, isCommunity, isCanceled, false, isNotService);
|
const normalColors = getStopListColors(
|
||||||
|
isThrough,
|
||||||
|
isCommunity,
|
||||||
|
isCanceled,
|
||||||
|
false,
|
||||||
|
isNotService
|
||||||
|
);
|
||||||
|
|
||||||
// beforeSameStationData用の色設定
|
// beforeSameStationData用の色設定
|
||||||
// 通過系と編(コミュニティ)はbeforeのseから判定、休(運休)は現在のseから判定
|
// 通過系と編(コミュニティ)はbeforeのseから判定、休(運休)は現在のseから判定
|
||||||
@@ -124,8 +137,20 @@ export const EachStopList: FC<props> = ({
|
|||||||
const beforeIsThrough = isThroughSe(beforeSe);
|
const beforeIsThrough = isThroughSe(beforeSe);
|
||||||
const beforeIsCommunity = isCommunitySe(beforeSe);
|
const beforeIsCommunity = isCommunitySe(beforeSe);
|
||||||
// 運休判定は現在のseを使用(本体と同じ背景色なので)
|
// 運休判定は現在のseを使用(本体と同じ背景色なので)
|
||||||
const beforeColors = getStopListColors(beforeIsThrough, beforeIsCommunity, isCanceled, isDelayed, isNotService);
|
const beforeColors = getStopListColors(
|
||||||
const beforeNormalColors = getStopListColors(beforeIsThrough, beforeIsCommunity, isCanceled, false, isNotService);
|
beforeIsThrough,
|
||||||
|
beforeIsCommunity,
|
||||||
|
isCanceled,
|
||||||
|
isDelayed,
|
||||||
|
isNotService
|
||||||
|
);
|
||||||
|
const beforeNormalColors = getStopListColors(
|
||||||
|
beforeIsThrough,
|
||||||
|
beforeIsCommunity,
|
||||||
|
isCanceled,
|
||||||
|
false,
|
||||||
|
isNotService
|
||||||
|
);
|
||||||
beforeTimeTextColor = beforeColors.timeText;
|
beforeTimeTextColor = beforeColors.timeText;
|
||||||
beforeNormalTimeTextColor = beforeNormalColors.timeText;
|
beforeNormalTimeTextColor = beforeNormalColors.timeText;
|
||||||
}
|
}
|
||||||
@@ -136,7 +161,7 @@ export const EachStopList: FC<props> = ({
|
|||||||
openStationACFromEachTrainInfo &&
|
openStationACFromEachTrainInfo &&
|
||||||
openStationACFromEachTrainInfo(station)
|
openStationACFromEachTrainInfo(station)
|
||||||
}
|
}
|
||||||
key={station+se+time}
|
key={station + se + time}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -182,16 +207,16 @@ export const EachStopList: FC<props> = ({
|
|||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<View style={{ position: "relative", width: 0, alignItems: "flex-end" }}>
|
<View
|
||||||
|
style={{ position: "relative", width: 0, alignItems: "flex-end" }}
|
||||||
|
>
|
||||||
{points && (
|
{points && (
|
||||||
<Text style={{ fontSize: 20, position: "absolute", left: -70 }}>
|
<Text style={{ fontSize: 20, position: "absolute", left: -70 }}>
|
||||||
🚊
|
🚊
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View style={{ flexDirection: "column", alignItems: "flex-end" }}>
|
||||||
style={{ flexDirection: "column", alignItems: "flex-end" }}
|
|
||||||
>
|
|
||||||
{beforeSameStationData && (
|
{beforeSameStationData && (
|
||||||
<TimeText
|
<TimeText
|
||||||
isDouble={!!beforeSameStationData || !!afterSameStationData}
|
isDouble={!!beforeSameStationData || !!afterSameStationData}
|
||||||
@@ -199,7 +224,7 @@ export const EachStopList: FC<props> = ({
|
|||||||
currentTrainData={currentTrainData}
|
currentTrainData={currentTrainData}
|
||||||
se={beforeSameStationData[1]}
|
se={beforeSameStationData[1]}
|
||||||
time={beforeSameStationData[2]}
|
time={beforeSameStationData[2]}
|
||||||
key={"before"+beforeSameStationData[2]}
|
key={"before" + beforeSameStationData[2]}
|
||||||
textColor={beforeTimeTextColor}
|
textColor={beforeTimeTextColor}
|
||||||
normalTextColor={beforeNormalTimeTextColor}
|
normalTextColor={beforeNormalTimeTextColor}
|
||||||
/>
|
/>
|
||||||
@@ -209,7 +234,7 @@ export const EachStopList: FC<props> = ({
|
|||||||
currentTrainData={currentTrainData}
|
currentTrainData={currentTrainData}
|
||||||
se={se}
|
se={se}
|
||||||
time={time}
|
time={time}
|
||||||
key={se+time}
|
key={se + time}
|
||||||
textColor={colors.timeText}
|
textColor={colors.timeText}
|
||||||
normalTextColor={normalColors.timeText}
|
normalTextColor={normalColors.timeText}
|
||||||
/>
|
/>
|
||||||
@@ -228,7 +253,15 @@ const TimeText: FC<{
|
|||||||
time: string;
|
time: string;
|
||||||
textColor: string;
|
textColor: string;
|
||||||
normalTextColor: string;
|
normalTextColor: string;
|
||||||
}> = ({ isDouble, currentTrainData, se, time, isBefore=false, textColor, normalTextColor }) => {
|
}> = ({
|
||||||
|
isDouble,
|
||||||
|
currentTrainData,
|
||||||
|
se,
|
||||||
|
time,
|
||||||
|
isBefore = false,
|
||||||
|
textColor,
|
||||||
|
normalTextColor,
|
||||||
|
}) => {
|
||||||
const [seString, seType] = parseSeString(se);
|
const [seString, seType] = parseSeString(se);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -243,7 +276,7 @@ const TimeText: FC<{
|
|||||||
color: normalTextColor,
|
color: normalTextColor,
|
||||||
width: 60,
|
width: 60,
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
right: isBefore ? 125:120,
|
right: isBefore ? 125 : 120,
|
||||||
textAlign: "right",
|
textAlign: "right",
|
||||||
textDecorationLine: "line-through",
|
textDecorationLine: "line-through",
|
||||||
fontStyle: seType == "community" ? "italic" : "normal",
|
fontStyle: seType == "community" ? "italic" : "normal",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { getTrainType } from "../../lib/getTrainType";
|
|||||||
import { customTrainDataDetector } from "../custom-train-data";
|
import { customTrainDataDetector } from "../custom-train-data";
|
||||||
import { useDeviceOrientationChange } from "../../stateBox/useDeviceOrientationChange";
|
import { useDeviceOrientationChange } from "../../stateBox/useDeviceOrientationChange";
|
||||||
import { EachStopList } from "./EachTrainInfo/EachStopList";
|
import { EachStopList } from "./EachTrainInfo/EachStopList";
|
||||||
import { DataFromButton } from "./EachTrainInfo/DataFromButton";
|
import { DataConnectedButton } from "./EachTrainInfo/DataConnectedButton";
|
||||||
import { DynamicHeaderScrollView } from "../DynamicHeaderScrollView";
|
import { DynamicHeaderScrollView } from "../DynamicHeaderScrollView";
|
||||||
import { LongHeader } from "./EachTrainInfo/LongHeader";
|
import { LongHeader } from "./EachTrainInfo/LongHeader";
|
||||||
import { ShortHeader } from "./EachTrainInfo/ShortHeader";
|
import { ShortHeader } from "./EachTrainInfo/ShortHeader";
|
||||||
@@ -47,8 +47,8 @@ export const EachTrainInfoCore = ({
|
|||||||
const { isLandscape } = useDeviceOrientationChange();
|
const { isLandscape } = useDeviceOrientationChange();
|
||||||
|
|
||||||
const scrollHandlers = actionSheetRef
|
const scrollHandlers = actionSheetRef
|
||||||
//@ts-ignore
|
? //@ts-ignore
|
||||||
? useScrollHandlers("scrollview-1", actionSheetRef)
|
useScrollHandlers("scrollview-1", actionSheetRef)
|
||||||
: null;
|
: null;
|
||||||
// Custom hooks for data management
|
// Custom hooks for data management
|
||||||
const { trainData, setTrainData, trueTrainID } = useTrainDiagramData(
|
const { trainData, setTrainData, trueTrainID } = useTrainDiagramData(
|
||||||
@@ -244,8 +244,14 @@ export const EachTrainInfoCore = ({
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
{trainDataWithThrough.map((item, index, array) =>
|
{trainDataWithThrough.map((item, index, array) =>
|
||||||
item.split(",")[1] === "提" ? (
|
item.split(",")[1] === "連" || item.split(",")[1] === "解" ? (
|
||||||
<DataFromButton i={item} key={`${item}-data`} />
|
<DataConnectedButton
|
||||||
|
i={item}
|
||||||
|
key={`${item}-data`}
|
||||||
|
openTrainInfo={openTrainInfo}
|
||||||
|
/>
|
||||||
|
) : item.split(",")[1].includes(".") ? (
|
||||||
|
<></>
|
||||||
) : (
|
) : (
|
||||||
<EachStopList
|
<EachStopList
|
||||||
i={item}
|
i={item}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export const HeaderText: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
}, [trainData]);
|
}, [trainData]);
|
||||||
|
|
||||||
const todayOperation = getTodayOperationByTrainId(trainNum);
|
const todayOperation = getTodayOperationByTrainId(trainNum).filter(d=> d.state !== 100);
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{ padding: 10, flexDirection: "row", alignItems: "center" }}
|
style={{ padding: 10, flexDirection: "row", alignItems: "center" }}
|
||||||
@@ -216,13 +216,20 @@ export const HeaderText: FC<Props> = ({
|
|||||||
size={20}
|
size={20}
|
||||||
color="white"
|
color="white"
|
||||||
style={{ marginLeft: 5 }}
|
style={{ marginLeft: 5 }}
|
||||||
onPress={() =>
|
onPress={() => {
|
||||||
|
// 列番が奇数か偶数かで表示順を逆転
|
||||||
|
const trainNumInt = parseInt(trainNum, 10);
|
||||||
|
const ops = todayOperation ? [...todayOperation] : [];
|
||||||
|
const displayOps = trainNumInt % 2 === 0 ? ops : ops.reverse();
|
||||||
|
const directionText = trainNumInt % 2 === 0
|
||||||
|
? '←進行方向'
|
||||||
|
: '進行方向→';
|
||||||
alert(
|
alert(
|
||||||
`[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n使用車両情報:\n${todayOperation
|
`[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n使用車両情報:\n${displayOps
|
||||||
?.map((op) => op.unit_ids)
|
.map((op) => op.unit_ids)
|
||||||
.join("+")}\n投稿者メモ:\n${uwasa || "なし"}`
|
.join("+")}\n${directionText}\n投稿者メモ:\n${uwasa || "なし"}`
|
||||||
)
|
);
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,54 @@ export const TrainIconStatus: FC<Props> = (props) => {
|
|||||||
const { train_info_img: vehicle_info_img, vehicle_info_url } =
|
const { train_info_img: vehicle_info_img, vehicle_info_url } =
|
||||||
customTrainDataDetector(data.trainNum, allCustomTrainData);
|
customTrainDataDetector(data.trainNum, allCustomTrainData);
|
||||||
if (todayOperation.length !== 0) {
|
if (todayOperation.length !== 0) {
|
||||||
const data =
|
const returnData =
|
||||||
todayOperation.map((op) => ({
|
todayOperation
|
||||||
vehicle_info_img: op.vehicle_img,
|
.sort((a, b) => {
|
||||||
vehicle_info_url: op.vehicle_info_url,
|
// trainIdからカンマ以降の数字を抽出する関数
|
||||||
})) || [];
|
const extractOrderNumber = (trainId: string): number => {
|
||||||
setTrainIcon(data);
|
const parts = trainId.split(',');
|
||||||
|
if (parts.length > 1) {
|
||||||
|
const num = parseInt(parts[1].trim(), 10);
|
||||||
|
return isNaN(num) ? Infinity : num;
|
||||||
|
}
|
||||||
|
return Infinity; // カンマなし = 末尾に移動
|
||||||
|
};
|
||||||
|
|
||||||
|
// data.trainNumと一致するtrainIdを探す関数
|
||||||
|
const findMatchingTrainId = (operation: OperationLogs): string | null => {
|
||||||
|
const allTrainIds = [
|
||||||
|
...(operation.train_ids || []),
|
||||||
|
...(operation.related_train_ids || []),
|
||||||
|
];
|
||||||
|
|
||||||
|
// data.trainNumの接頭辞と一致するものを探す
|
||||||
|
for (const trainId of allTrainIds) {
|
||||||
|
const prefix = trainId.split(',')[0]; // カンマ前の部分
|
||||||
|
if (prefix === data.trainNum) {
|
||||||
|
return trainId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const aTrainId = findMatchingTrainId(a);
|
||||||
|
const bTrainId = findMatchingTrainId(b);
|
||||||
|
|
||||||
|
// マッチしたものがない場合は元の順序を保持
|
||||||
|
if (!aTrainId || !bTrainId) {
|
||||||
|
return aTrainId ? -1 : bTrainId ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const aOrder = extractOrderNumber(aTrainId);
|
||||||
|
const bOrder = extractOrderNumber(bTrainId);
|
||||||
|
|
||||||
|
return aOrder - bOrder;
|
||||||
|
})
|
||||||
|
.map((op) => ({
|
||||||
|
vehicle_info_img: op.vehicle_img || vehicle_info_img,
|
||||||
|
vehicle_info_url: op.vehicle_info_url,
|
||||||
|
})) || [];
|
||||||
|
setTrainIcon(returnData);
|
||||||
} else if (vehicle_info_img) {
|
} else if (vehicle_info_img) {
|
||||||
setTrainIcon([{ vehicle_info_img, vehicle_info_url }]);
|
setTrainIcon([{ vehicle_info_img, vehicle_info_url }]);
|
||||||
}
|
}
|
||||||
@@ -124,10 +166,12 @@ export const TrainIconStatus: FC<Props> = (props) => {
|
|||||||
<Image
|
<Image
|
||||||
source={{ uri: trainIcon }}
|
source={{ uri: trainIcon }}
|
||||||
style={{
|
style={{
|
||||||
height: 30,
|
height: index > 0 ? 15 : 30,
|
||||||
width: 24,
|
width: index > 0 ? 12 : 24,
|
||||||
marginRight: 5,
|
marginRight: 5,
|
||||||
display: index == 0 ? "flex" : "none", //暫定対応:複数アイコンがある場合は最初のアイコンのみ表示
|
marginLeft: index > 0 ? -10 : 0,
|
||||||
|
marginTop: index > 0 ? 10 : 0,
|
||||||
|
//display: index == 0 ? "flex" : "none", //暫定対応:複数アイコンがある場合は最初のアイコンのみ表示
|
||||||
}}
|
}}
|
||||||
resizeMethod="resize"
|
resizeMethod="resize"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export const AllTrainDiagramView: FC = () => {
|
|||||||
const Item: FC<ItemProps> = ({ id, openTrainInfo }) => {
|
const Item: FC<ItemProps> = ({ id, openTrainInfo }) => {
|
||||||
const { train_info_img, train_name, type, train_num_distance, to_data } =
|
const { train_info_img, train_name, type, train_num_distance, to_data } =
|
||||||
customTrainDataDetector(id, allCustomTrainData);
|
customTrainDataDetector(id, allCustomTrainData);
|
||||||
const todayOperation = getTodayOperationByTrainId(id);
|
const todayOperation = getTodayOperationByTrainId(id).filter(d=> d.state !== 100);
|
||||||
|
|
||||||
const [typeString, fontAvailable, isOneMan] = getStringConfig(type, id);
|
const [typeString, fontAvailable, isOneMan] = getStringConfig(type, id);
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ export const AllTrainDiagramView: FC = () => {
|
|||||||
? todayOperation.map((operation, index) => (
|
? todayOperation.map((operation, index) => (
|
||||||
<Image
|
<Image
|
||||||
key={index}
|
key={index}
|
||||||
source={{ uri: operation.vehicle_img }}
|
source={{ uri: operation.vehicle_img || train_info_img }}
|
||||||
style={{
|
style={{
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 22,
|
height: 22,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { SwitchArea } from "../atom/SwitchArea";
|
|||||||
import { useNotification } from "../../stateBox/useNotifications";
|
import { useNotification } from "../../stateBox/useNotifications";
|
||||||
import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem";
|
import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem";
|
||||||
|
|
||||||
const versionCode = "6.1.9.2"; // Update this version code as needed
|
const versionCode = "6.1.9.4"; // Update this version code as needed
|
||||||
|
|
||||||
export const SettingTopPage = ({
|
export const SettingTopPage = ({
|
||||||
testNFC,
|
testNFC,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const INTERVALS = {
|
|||||||
STORAGE_CHECK: 10000,
|
STORAGE_CHECK: 10000,
|
||||||
|
|
||||||
/** 遅延情報更新間隔(ミリ秒) */
|
/** 遅延情報更新間隔(ミリ秒) */
|
||||||
DELAY_UPDATE: 60000,
|
DELAY_UPDATE: 30000,
|
||||||
|
|
||||||
/** 列車位置更新間隔(ミリ秒) */
|
/** 列車位置更新間隔(ミリ秒) */
|
||||||
TRAIN_POSITION_UPDATE: 5000,
|
TRAIN_POSITION_UPDATE: 5000,
|
||||||
|
|||||||
@@ -91,4 +91,5 @@ export type OperationLogs = {
|
|||||||
vehicle_img: string;
|
vehicle_img: string;
|
||||||
vehicle_info_url: string;
|
vehicle_info_url: string;
|
||||||
related_train_ids?: string[];
|
related_train_ids?: string[];
|
||||||
|
state: number | null;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
if (data === null) {
|
if (data === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(!_.isEqual(data, operationList)) {
|
else if(!_.isEqual(data.filter(d=> d.state !== 100), operationList)) {
|
||||||
operationList = data;
|
operationList = data.filter(d=> d.state !== 100);
|
||||||
setReload();
|
setReload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -83,7 +83,47 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
setTimeout(operationListUpdate, ${INTERVALS.DELAY_UPDATE});
|
setTimeout(operationListUpdate, ${INTERVALS.DELAY_UPDATE});
|
||||||
}
|
}
|
||||||
operationListUpdate();
|
operationListUpdate();
|
||||||
|
const sortOperationalList = (a, b,targetTrainID) => {
|
||||||
|
// trainIdからカンマ以降の数字を抽出する関数
|
||||||
|
const extractOrderNumber = (trainId) => {
|
||||||
|
const parts = trainId.split(',');
|
||||||
|
if (parts.length > 1) {
|
||||||
|
const num = parseInt(parts[1].trim(), 10);
|
||||||
|
return isNaN(num) ? Infinity : num;
|
||||||
|
}
|
||||||
|
return Infinity; // カンマなし = 末尾に移動
|
||||||
|
};
|
||||||
|
|
||||||
|
// data.trainNumと一致するtrainIdを探す関数
|
||||||
|
const findMatchingTrainId = (operation)=> {
|
||||||
|
const allTrainIds = [
|
||||||
|
...(operation.train_ids || []),
|
||||||
|
...(operation.related_train_ids || []),
|
||||||
|
];
|
||||||
|
|
||||||
|
// data.trainNumの接頭辞と一致するものを探す
|
||||||
|
for (const trainId of allTrainIds) {
|
||||||
|
const prefix = trainId.split(',')[0]; // カンマ前の部分
|
||||||
|
if (prefix === targetTrainID) {
|
||||||
|
return trainId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const aTrainId = findMatchingTrainId(a);
|
||||||
|
const bTrainId = findMatchingTrainId(b);
|
||||||
|
|
||||||
|
// マッチしたものがない場合は元の順序を保持
|
||||||
|
if (!aTrainId || !bTrainId) {
|
||||||
|
return aTrainId ? -1 : bTrainId ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const aOrder = extractOrderNumber(aTrainId);
|
||||||
|
const bOrder = extractOrderNumber(bTrainId);
|
||||||
|
|
||||||
|
return aOrder - bOrder;
|
||||||
|
};
|
||||||
|
|
||||||
let trainDiagramData2 = {};
|
let trainDiagramData2 = {};
|
||||||
const TrainDiagramData2Update = () =>{
|
const TrainDiagramData2Update = () =>{
|
||||||
@@ -133,11 +173,18 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
`;
|
`;
|
||||||
// 左か右かを判定してアイコンを設置する
|
// 左か右かを判定してアイコンを設置する
|
||||||
const trainIcon = `
|
const trainIcon = `
|
||||||
const setStationIcon = (setIconElem,img,hasProblem) =>{
|
const setStationIcon = (setIconElem,img,hasProblem,backCount = 100) =>{
|
||||||
const position = setIconElem.getAttribute("style").includes("left");
|
const position = setIconElem.getAttribute("style").includes("left");
|
||||||
const marginData = ${uiSetting === "tokyo" ? `"5px"`: `"2px"`}
|
let marginData = ${uiSetting === "tokyo" ? `"5px"`: `"2px"`};
|
||||||
setIconElem.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:"+(position ? 'left' : 'right')+";height:22px;margin: "+marginData+";'>");
|
let backgroundColor = "transparent";
|
||||||
setIconElem.remove();
|
let heightData = "22px";
|
||||||
|
if(backCount == 0){
|
||||||
|
marginData = position ? ${uiSetting === "tokyo" ? `"0px 0px -10px 0px" : "-10px 0px 0px 0px"`: `"0px 2px 0px 0px" : "0px 2px 0px 0px"`};
|
||||||
|
heightData = "16px";
|
||||||
|
}
|
||||||
|
|
||||||
|
setIconElem.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:"+(position ? 'left' : 'right')+";height:"+heightData+";margin: "+marginData+";background-color: "+backgroundColor+";'>");
|
||||||
|
if (backCount == 0 || backCount == 100) setIconElem.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setTrainIcon = (列番データ) => {
|
const setTrainIcon = (列番データ) => {
|
||||||
@@ -894,18 +941,25 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
}
|
}
|
||||||
isEdit = data.priority == 400;
|
isEdit = data.priority == 400;
|
||||||
isSeason = data.priority == 300;
|
isSeason = data.priority == 300;
|
||||||
operationList.forEach(e => {
|
operationList
|
||||||
if(e.train_ids){
|
.sort((a,b)=>sortOperationalList(a,b,data.train_id))
|
||||||
if(e.train_ids.includes(data.train_id)){
|
.forEach(e => {
|
||||||
isEdit = true;
|
if (e.train_ids?.length > 0) {
|
||||||
}
|
const trainIds = e.train_ids.map((x) => x.split(",")[0]);
|
||||||
|
if (trainIds.includes(data.train_id.toString())) {
|
||||||
|
//returnData.push(e);
|
||||||
|
isEdit = true;
|
||||||
}
|
}
|
||||||
else if(e.related_train_ids){
|
} else if (e.related_train_ids?.length > 0) {
|
||||||
if(e.related_train_ids.includes(data.train_id)){
|
const trainIds = e.related_train_ids.map(
|
||||||
isEdit = true;
|
(x) => x.split(",")[0]
|
||||||
}
|
);
|
||||||
|
if (trainIds.includes(data.train_id.toString())) {
|
||||||
|
//returnData.push(e);
|
||||||
|
isEdit = true;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
if(data.train_name != ""){
|
if(data.train_name != ""){
|
||||||
trainName = data.train_name;
|
trainName = data.train_name;
|
||||||
if(data.train_num_distance != ""){
|
if(data.train_num_distance != ""){
|
||||||
@@ -1215,33 +1269,51 @@ const setStrings = () =>{
|
|||||||
setTrainMenuDialog(element)
|
setTrainMenuDialog(element)
|
||||||
|
|
||||||
${iconSetting == "true" ? `
|
${iconSetting == "true" ? `
|
||||||
let trainIconUrl = null;
|
let trainIconUrl = [];
|
||||||
operationList.forEach(e => {
|
operationList
|
||||||
if(e.train_ids){
|
.sort((a,b)=>sortOperationalList(a,b,列番データ.toString()))
|
||||||
if(e.train_ids.includes(列番データ)){
|
.reverse()
|
||||||
if(e.vehicle_img) trainIconUrl = e.vehicle_img;
|
.forEach(e => {
|
||||||
|
if (e.train_ids?.length > 0) {
|
||||||
|
const trainIds = e.train_ids.map((x) => x.split(",")[0]);
|
||||||
|
if (trainIds.includes(列番データ.toString())) {
|
||||||
|
if(e.vehicle_img) trainIconUrl.push(e.vehicle_img);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else if (e.related_train_ids?.length > 0) {
|
||||||
else if(e.related_train_ids){
|
const trainIds = e.related_train_ids.map(
|
||||||
if(e.related_train_ids.includes(列番データ)){
|
(x) => x.split(",")[0]
|
||||||
if(e.vehicle_img) trainIconUrl = e.vehicle_img;
|
);
|
||||||
|
if (trainIds.includes(列番データ.toString())) {
|
||||||
|
if(e.vehicle_img) trainIconUrl.push(e.vehicle_img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(trainIconUrl != null){
|
if(trainIconUrl.length > 0){
|
||||||
setStationIcon(element.querySelector("img"),trainIconUrl,hasProblem);
|
[trainIconUrl[0], trainIconUrl[trainIconUrl.length - 1]].forEach((url,index,array) => {
|
||||||
|
|
||||||
|
if(url && url != ""){
|
||||||
|
setStationIcon(element.querySelector("img"),url,hasProblem,trainIconUrl.length == 1 ? 100 : index);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(trainDataList.find(e => e.train_id === 列番データ) !== undefined){
|
if(trainDataList.find(e => e.train_id === 列番データ) !== undefined){
|
||||||
const trainIconUrl = trainDataList.find(e => e.train_id === 列番データ).train_info_img;
|
const trainIconUrl = [trainDataList.find(e => e.train_id === 列番データ).train_info_img];
|
||||||
if(!!trainIconUrl){
|
if(trainIconUrl.length > 0){
|
||||||
setStationIcon(element.querySelector("img"),trainIconUrl,hasProblem);
|
trainIconUrl.forEach((url,index,array) => {
|
||||||
|
if(url && url != ""){
|
||||||
|
setStationIcon(element.querySelector("img"),url,hasProblem);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const trainIconUrl = setTrainIcon(列番データ);
|
const trainIconUrl = [setTrainIcon(列番データ)];
|
||||||
if(!!trainIconUrl){
|
if(trainIconUrl.length > 0){
|
||||||
setStationIcon(element.querySelector("img"),trainIconUrl,hasProblem);
|
if(trainIconUrl[0] && trainIconUrl[0] != ""){
|
||||||
|
setStationIcon(element.querySelector("img"),trainIconUrl[0],hasProblem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,13 @@ import trainList from "@/assets/originData/trainList";
|
|||||||
import { CustomTrainData, OperationLogs } from "@/lib/CommonTypes";
|
import { CustomTrainData, OperationLogs } from "@/lib/CommonTypes";
|
||||||
import useInterval from "@/lib/useInterval";
|
import useInterval from "@/lib/useInterval";
|
||||||
import { AS } from "@/storageControl";
|
import { AS } from "@/storageControl";
|
||||||
import React, { createContext, FC, useContext, useEffect, useState } from "react";
|
import React, {
|
||||||
|
createContext,
|
||||||
|
FC,
|
||||||
|
useContext,
|
||||||
|
useEffect,
|
||||||
|
useState,
|
||||||
|
} from "react";
|
||||||
import { API_ENDPOINTS, STORAGE_KEYS } from "@/constants";
|
import { API_ENDPOINTS, STORAGE_KEYS } from "@/constants";
|
||||||
const initialState = {
|
const initialState = {
|
||||||
allTrainDiagram: {},
|
allTrainDiagram: {},
|
||||||
@@ -27,9 +33,13 @@ export const useAllTrainDiagram = () => useContext(AllTrainDiagramContext);
|
|||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
export const AllTrainDiagramProvider:FC<Props> = ({ children }) => {
|
export const AllTrainDiagramProvider: FC<Props> = ({ children }) => {
|
||||||
const [allTrainDiagram, setAllTrainDiagram] = useState<{ [key: string]: string }>(trainList);
|
const [allTrainDiagram, setAllTrainDiagram] = useState<{
|
||||||
const [allCustomTrainData, setAllCustomTrainData] = useState<CustomTrainData[]>([]); // カスタム列車データ
|
[key: string]: string;
|
||||||
|
}>(trainList);
|
||||||
|
const [allCustomTrainData, setAllCustomTrainData] = useState<
|
||||||
|
CustomTrainData[]
|
||||||
|
>([]); // カスタム列車データ
|
||||||
const [keyList, setKeyList] = useState<string[]>([]); // 第二要素
|
const [keyList, setKeyList] = useState<string[]>([]); // 第二要素
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (allTrainDiagram && Object.keys(allTrainDiagram).length > 0)
|
if (allTrainDiagram && Object.keys(allTrainDiagram).length > 0)
|
||||||
@@ -47,7 +57,11 @@ export const AllTrainDiagramProvider:FC<Props> = ({ children }) => {
|
|||||||
});
|
});
|
||||||
//dataのkeyで並び替え
|
//dataのkeyで並び替え
|
||||||
const sortedData = Object.keys(data)
|
const sortedData = Object.keys(data)
|
||||||
.sort((a, b) => parseInt(a.replace(/[D,M]/, "")) - parseInt(b.replace(/[D,M]/, "")))
|
.sort(
|
||||||
|
(a, b) =>
|
||||||
|
parseInt(a.replace(/[D,M]/, "")) -
|
||||||
|
parseInt(b.replace(/[D,M]/, ""))
|
||||||
|
)
|
||||||
.reduce((acc, key) => {
|
.reduce((acc, key) => {
|
||||||
acc[key] = data[key];
|
acc[key] = data[key];
|
||||||
return acc;
|
return acc;
|
||||||
@@ -113,11 +127,18 @@ export const AllTrainDiagramProvider:FC<Props> = ({ children }) => {
|
|||||||
const getTodayOperationByTrainId = (train_id: string) => {
|
const getTodayOperationByTrainId = (train_id: string) => {
|
||||||
const returnData: OperationLogs[] = [];
|
const returnData: OperationLogs[] = [];
|
||||||
todayOperation.forEach((operation) => {
|
todayOperation.forEach((operation) => {
|
||||||
if (operation.train_ids?.includes(train_id.toString())) {
|
if (operation.train_ids?.length > 0) {
|
||||||
returnData.push(operation);
|
const trainIds = operation.train_ids.map((x) => x.split(",")[0]);
|
||||||
}
|
if (trainIds.includes(train_id.toString())) {
|
||||||
else if (operation.related_train_ids?.includes(train_id.toString())) {
|
returnData.push(operation);
|
||||||
returnData.push(operation);
|
}
|
||||||
|
} else if (operation.related_train_ids?.length > 0) {
|
||||||
|
const trainIds = operation.related_train_ids.map(
|
||||||
|
(x) => x.split(",")[0]
|
||||||
|
);
|
||||||
|
if (trainIds.includes(train_id.toString())) {
|
||||||
|
returnData.push(operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return returnData.length > 0 ? returnData : [];
|
return returnData.length > 0 ? returnData : [];
|
||||||
@@ -131,7 +152,7 @@ export const AllTrainDiagramProvider:FC<Props> = ({ children }) => {
|
|||||||
allCustomTrainData,
|
allCustomTrainData,
|
||||||
keyList,
|
keyList,
|
||||||
todayOperation,
|
todayOperation,
|
||||||
getTodayOperationByTrainId
|
getTodayOperationByTrainId,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user