diff --git a/components/Apps/FixedPositionBox.tsx b/components/Apps/FixedPositionBox.tsx
index 703a3a6..1568d96 100644
--- a/components/Apps/FixedPositionBox.tsx
+++ b/components/Apps/FixedPositionBox.tsx
@@ -9,6 +9,8 @@ import { customTrainDataDetector } from "../custom-train-data";
import { getStringConfig, typeID } from "@/lib/getStringConfig";
import { getTrainType } from "@/lib/getTrainType";
import Constants from "expo-constants";
+import { trainPosition } from "@/lib/trainPositionTextArray";
+import { StationNumberMaker } from "../駅名表/StationNumberMaker";
export const FixedPositionBox = () => {
const { fixedPosition, setFixedPosition } = useCurrentTrain();
@@ -19,20 +21,18 @@ export const FixedPositionBox = () => {
position: "absolute",
top: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
borderRadius: 5,
- zIndex: 500,
+ zIndex: 1500,
width: "100%",
height: 50,
flexDirection: "row",
}}
>
-
{fixedPosition.type === "station" && (
)}
{fixedPosition.type === "train" && (
)}
-
);
};
@@ -161,14 +161,14 @@ export const FixedTrain = ({ trainID }) => {
}
};
const [train, setTrain] = useState<{
- Index: string;
- num: string;
- delay: string;
- Pos: string;
- PosNum: string;
- Direction: number;
- Type: string;
- Line: string;
+ Pos?: string;
+ Direction?: number;
+ Index?: number;
+ Line?: string;
+ PosNum?: number;
+ Type?: string;
+ delay?: string | number;
+ num?: string;
}>(null);
const [customData, setCustomData] = useState<{
ToData: string;
@@ -208,62 +208,221 @@ export const FixedTrain = ({ trainID }) => {
const x = getStringConfig(customData.type, customData.TrainNumber);
setStringConfig(x);
}, [customData]);
+
+ const { getStationDataFromName } = useStationList();
+ const [station, setStation] = useState([]);
+ useEffect(() => {
+ const data = getStationDataFromName(ToData);
+ setStation(data);
+ }, [ToData]);
+ const lineColor =
+ station.length > 0
+ ? lineColorList[station[0]?.StationNumber.slice(0, 1)]
+ : "black";
+ let firstText = "";
+ let secondText = "";
+ let marginText = "";
+ let externalText = "";
+ const { isBetween, Pos: PosData } = trainPosition(train);
+ if (isBetween === true) {
+ const { from, to } = PosData;
+ firstText = from;
+ secondText = to;
+ marginText = "→";
+ } else {
+ const { Pos } = PosData;
+ if (Pos !== "") {
+ firstText = Pos;
+ }
+ }
return (
{
setFixedPosition({ type: null, value: null });
}}
>
-
-
-
+
+
-
+
- {stringConfig[0]}
-
- {ToData}行
+
+ {stringConfig[0]}
+
+ {customData.trainName && (
+ 6 ? 9 : 14,
+ color: "white",
+ maxWidth: 70,
+ textAlignVertical: "center",
+ }}
+ >
+ {customData.trainName}
+
+ )}
+
+
+
+
+
+
+
+ {ToData}行
+
+
+
-
- 列車情報追跡中
- 次は どこですか
+ >
+
+ 次は 新居浜
+
+
+
+
+
+
+
+
+ 現在地:
+
+
+ {marginText == "→" ? firstText + marginText + secondText : firstText}
+
+
);
};
diff --git a/components/駅名表/Sign.js b/components/駅名表/Sign.js
index f7a3929..2424a7c 100644
--- a/components/駅名表/Sign.js
+++ b/components/駅名表/Sign.js
@@ -197,9 +197,7 @@ export default function Sign(props) {
source={require("../../assets/StationSign.json")}
/>
)}
-
+
diff --git a/components/駅名表/StationNumberMaker.tsx b/components/駅名表/StationNumberMaker.tsx
index bd38e40..b5466ae 100644
--- a/components/駅名表/StationNumberMaker.tsx
+++ b/components/駅名表/StationNumberMaker.tsx
@@ -1,10 +1,16 @@
-import React from "react";
+import React, { FC } from "react";
import { Text, View } from "react-native";
import { useWindowDimensions } from "react-native";
import lineColorList from "../../assets/originData/lineColorList";
+import { StationProps } from "@/stateBox/useStationList";
-export const StationNumberMaker = (props) => {
- const { currentStation, isMatsuyama } = props;
+type props = {
+ currentStation: StationProps[];
+ useEach?: boolean;
+ singleSize?: number;
+};
+export const StationNumberMaker: FC = (props) => {
+ const { currentStation, useEach = false, singleSize } = props;
const { width } = useWindowDimensions();
const getTop = (array: number[], index: number) => {
if (array.length == 1) return 20;
@@ -12,7 +18,7 @@ export const StationNumberMaker = (props) => {
else if (index == 1) return 35;
else return 20;
};
- return currentStation
+ return <>{currentStation
.filter((d) => (d.StationNumber ? true : false))
.map((d, index, array) => {
const lineID = d.StationNumber.slice(0, 1);
@@ -20,29 +26,41 @@ export const StationNumberMaker = (props) => {
return (
{lineID + "\n" + lineName}
@@ -50,5 +68,5 @@ export const StationNumberMaker = (props) => {
);
- });
+ })}>
};
diff --git a/lib/getTrainType.ts b/lib/getTrainType.ts
index 99450f9..cdc53e3 100644
--- a/lib/getTrainType.ts
+++ b/lib/getTrainType.ts
@@ -51,7 +51,7 @@ export const getTrainType: getTrainType = (nameString, whiteMode) => {
};
case "Rapid":
case "OneManRapid":
- return { color: whiteMode ? "#00b8d8cc" : "aqua", name: "快速", data: "rapid" };
+ return { color: whiteMode ? "#00a0bdff" : "aqua", name: "快速", data: "rapid" };
case "LTDEXP":
return { color: "red", name: "特急", data: "express" };
case "NightLTDEXP":
@@ -66,7 +66,7 @@ export const getTrainType: getTrainType = (nameString, whiteMode) => {
case "Party":
return { color: "#ff7300ff", name: "団体臨時", data: "normal" };
case "Freight":
- return { color: "#00869ecc", name: "貨物", data: "notService" };
+ return { color: "#007488ff", name: "貨物", data: "notService" };
case "Forwarding":
return { color: "#727272cc", name: "回送", data: "notService" };
case "FreightForwarding":
diff --git a/stateBox/useTrainMenu.js b/stateBox/useTrainMenu.js
index f169fc0..347a8c7 100644
--- a/stateBox/useTrainMenu.js
+++ b/stateBox/useTrainMenu.js
@@ -94,7 +94,7 @@ export const TrainMenuProvider = ({ children }) => {
//列車アイコンスイッチ
ASCore({ k: "iconSwitch", s: setIconSetting, d: "true", u: true });
//地図スイッチ
- ASCore({ k: "mapSwitch", s: setMapSwitch, d: "false", u: true });
+ ASCore({ k: "mapSwitch", s: setMapSwitch, d: "true", u: true });
//駅メニュースイッチ
ASCore({ k: "stationSwitch", s: setStationMenu, d: "true", u: true });
//列車メニュースイッチ