Merge commit 'ddaad38ccc2d23121f7fb6e3678417e7ac9ed593'

This commit is contained in:
harukin-expo-dev-env
2025-08-24 04:49:29 +00:00
19 changed files with 484 additions and 383 deletions

View File

@@ -1,157 +0,0 @@
import React from "react";
import { View, Text, TouchableWithoutFeedback } from "react-native";
import dayjs from "dayjs";
import lineColorList from "../../../assets/originData/lineColorList";
export const EachStopList = ({
i,
index,
stationList,
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))
.reduce((newArray, e) => newArray.concat(e), []);
/*Array [
Object {
"StationName": "佐古",
"StationNumber": "T01",
},
Object {
"StationName": "佐古",
"StationNumber": "B01",
},
] */
const StationNumbers =
Stations &&
Stations.filter((d) => d.StationNumber).map((d) => d.StationNumber);
// Array [ "T01", "B01",]
const lineIDs = [];
const EachIDs = [];
StationNumbers.forEach((d) => {
const textArray = d.split("");
lineIDs.push(textArray.filter((s) => "A" < s && s < "Z").join(""));
EachIDs.push(textArray.filter((s) => "0" <= s && s <= "9").join(""));
});
// Array [ "T", "B",]
// Array [ "01", "01",]
const dates = dayjs()
.set("hour", parseInt(time.split(":")[0]))
.set("minute", parseInt(time.split(":")[1]))
.add(isNaN(currentTrainData?.delay) ? 0 : currentTrainData.delay, "minute");
const timeString = se == "通過" ? "" : dates.format("HH:mm").split(":");
const onClickStateText = (string) => {
if (string != "通過") return;
alert("この駅は通過駅です");
};
return (
<TouchableWithoutFeedback
onPress={() =>
openStationACFromEachTrainInfo &&
openStationACFromEachTrainInfo(station)
}
key={station}
>
<View style={{ flexDirection: "row", backgroundColor: "white" }}>
<View
style={{
width: 35,
position: "relative",
marginHorizontal: 15,
flexDirection: "row",
height: "101%",
}}
>
{lineIDs.map((lineID, index) => (
<View
style={{
backgroundColor: `${lineColorList[lineID]}${
se == "通過" ? "80" : ""
}`,
flex: 1,
}}
key={lineID}
>
<View style={{ flex: 1 }} />
<Text
style={{
color: "white",
textAlign: "center",
fontSize: 10,
fontWeight: "bold",
}}
>
{lineIDs[index]}
{"\n"}
{EachIDs[index]}
</Text>
<View style={{ flex: 1 }} />
</View>
))}
</View>
<View
style={{
padding: 8,
flexDirection: "row",
borderBottomWidth: 1,
borderBottomColor: "#f0f0f0",
flex: 1,
}}
>
<Text
style={{ fontSize: 20, color: `#000${se == "通過" ? "5" : ""}` }}
>
{station}
</Text>
<View style={{ flex: 1 }} />
<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={{
fontSize: 15,
color: "black",
width: 60,
position: "absolute",
right: 120,
textAlign: "right",
textDecorationLine: "line-through",
}}
>
{time}
</Text>
)}
<Text
style={{
fontSize: 20,
color: isNaN(currentTrainData?.delay)
? "black"
: currentTrainData?.delay == 0
? "black"
: "red",
width: 60,
}}
onPress={() => onClickStateText(se)}
>
{se == "通過" ? "レ" : `${timeString[0]}:${timeString[1]}`}
</Text>
<Text style={{ fontSize: 18, width: 50 }}>
{se?.replace("発", "出発").replace("着", "到着")}
</Text>
</View>
</View>
</TouchableWithoutFeedback>
);
};

View File

@@ -0,0 +1,220 @@
import React, { FC } from "react";
import { View, Text, TouchableWithoutFeedback } from "react-native";
import dayjs from "dayjs";
import lineColorList from "../../../assets/originData/lineColorList";
type seTypes = "発編" | "着編" | "通編" | "頃編" | "発" | "着" | string;
type currentTrainDataType = {
Index: number;
num: string;
delay: "入線" | number | undefined;
Pos: string;
PosNum: number;
Direction: number;
Type: string;
Line: string;
};
type props = {
i: string;
index: number;
stationList: { StationName: string; StationNumber: string }[][];
points: boolean;
currentTrainData?: currentTrainDataType;
openStationACFromEachTrainInfo?: (station: string) => void;
showThrew: boolean;
};
export const EachStopList: FC<props> = ({
i,
index,
stationList,
points,
currentTrainData,
openStationACFromEachTrainInfo,
showThrew,
}) => {
const [station, se, time] = i.split(",") as [string, seTypes, string]; // 阿波池田,発,6:21
if (!showThrew) {
if (se == "通過") return null;
if (se == "通編") return null;
}
const Stations = stationList
.map((a) => a.filter((d) => d.StationName == station))
.reduce((newArray, e) => newArray.concat(e), []);
/*Array [
Object {
"StationName": "佐古",
"StationNumber": "T01",
},
Object {
"StationName": "佐古",
"StationNumber": "B01",
},
] */
const StationNumbers =
Stations &&
Stations.filter((d) => d.StationNumber).map((d) => d.StationNumber);
const [seString, seType] = (() => {
switch (se) {
case "発":
return ["出発", "normal"];
case "着":
return ["到着", "normal"];
case "発編":
return ["出発", "community"];
case "着編":
return ["到着", "community"];
case "通編":
return ["通過", "community"];
case "頃編":
return ["頃", "community"];
default:
return [se, "normal"];
}
})();
// Array [ "T01", "B01",]
// Array [ "T", "B",]
// Array [ "01", "01",]
const textColor = `#${seType == "community" ? "44f" : "000"}${
se == "通過" || se == "通編" ? "5" : ""
}`;
return (
<TouchableWithoutFeedback
onPress={() =>
openStationACFromEachTrainInfo &&
openStationACFromEachTrainInfo(station)
}
key={station}
>
<View style={{ flexDirection: "row", backgroundColor: "#ffffffc2" }}>
<View
style={{
width: 35,
position: "relative",
marginHorizontal: 15,
flexDirection: "row",
height: "101%",
}}
>
{StationNumbers.map((stn, index) => (
<StationNumbersBox stn={stn} se={se} key={index} />
))}
</View>
<View
style={{
padding: 8,
flexDirection: "row",
borderBottomWidth: 1,
borderBottomColor: "#f0f0f0",
flex: 1,
}}
>
<Text
style={{
fontSize: 20,
color: textColor,
fontStyle: seType == "community" ? "italic" : "normal",
}}
>
{station}
</Text>
<View style={{ flex: 1 }} />
<View style={{ position: "relative", width: 0 }}>
{points && (
<Text style={{ fontSize: 20, position: "absolute", left: -60 }}>
🚊
</Text>
)}
</View>
{!!currentTrainData?.delay &&
currentTrainData?.delay != "入線" &&
currentTrainData?.delay != 0 && (
<Text
style={{
fontSize: 15,
color: textColor,
width: 60,
position: "absolute",
right: 120,
textAlign: "right",
textDecorationLine: "line-through",
fontStyle: seType == "community" ? "italic" : "normal",
}}
>
{time}
</Text>
)}
<StationTimeBox
delay={currentTrainData?.delay}
textColor={textColor}
seType={seType}
se={se}
time={time}
/>
<Text style={{ fontSize: 18, width: 50, color: textColor }}>
{seString}
</Text>
</View>
</View>
</TouchableWithoutFeedback>
);
};
const StationNumbersBox: FC<{ stn: string; se: seTypes }> = (props) => {
const { stn, se } = props;
const lineColor = lineColorList[stn.charAt(0)];
const hasThrew = se == "通過" || se == "通編" ? "80" : "";
const backgroundColor = `${lineColor}${hasThrew}`;
return (
<View style={{ backgroundColor, flex: 1 }} key={stn}>
<View style={{ flex: 1 }} />
<Text
style={{
color: "white",
textAlign: "center",
fontSize: 10,
fontWeight: "bold",
}}
>
{stn.charAt(0)}
{"\n"}
{stn.slice(1)}
</Text>
<View style={{ flex: 1 }} />
</View>
);
};
type StationTimeBoxType = {
delay: "入線" | number | undefined;
textColor: string;
seType: seTypes;
se: string;
time: string;
};
const StationTimeBox: FC<StationTimeBoxType> = (props) => {
const { delay, textColor, seType, se, time } = props;
const dates = dayjs()
.set("hour", parseInt(time.split(":")[0]))
.set("minute", parseInt(time.split(":")[1]))
.add(delay == "入線" || delay == undefined ? 0 : delay, "minute");
const timeString = se == "通過" ? "" : dates.format("HH:mm");
return (
<Text
style={{
fontSize: 20,
color:
delay != "入線" && delay != undefined
? delay != 0 && "red"
: textColor,
width: 60,
fontStyle: seType == "community" ? "italic" : "normal",
}}
>
{se == "通過" ? "レ" : timeString}
</Text>
);
};

View File

@@ -7,7 +7,7 @@ export const ScrollStickyContent = (props) => {
<View
style={{
alignItems: "center",
backgroundColor: "white",
backgroundColor: "#ffffffc2",
flexDirection: "row",
}}
>
@@ -16,7 +16,7 @@ export const ScrollStickyContent = (props) => {
padding: 8,
flexDirection: "row",
borderBottomWidth: 1,
borderBottomColor: "#f0f0f0",
borderBottomColor: "#ffffffc2",
flex: 1,
}}
>

View File

@@ -14,24 +14,29 @@ export const ShowSpecialTrain = ({
};
return (
<>
{isTrainDataNothing && trueTrainID && (
<TouchableOpacity
onPress={() => replaceSpecialTrainDetail(trueTrainID)}
style={{
padding: 10,
flexDirection: "row",
borderColor: "blue",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
}}
>
<Text style={{ fontSize: 18, fontWeight: "bold", color: "black" }}>
本来の列車情報を表示
</Text>
</TouchableOpacity>
)}
{isTrainDataNothing &&
trueTrainID?.map((ids) => {
return (
<TouchableOpacity
onPress={() => replaceSpecialTrainDetail(ids)}
style={{
padding: 10,
flexDirection: "row",
borderColor: "blue",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
}}
>
<Text
style={{ fontSize: 18, fontWeight: "bold", color: "black" }}
>
本来の列車情報候補を表示:({ids})
</Text>
</TouchableOpacity>
);
})}
</>
);
};

View File

@@ -78,11 +78,15 @@ export const TrainDataView = ({
const [trainNumber, setTrainNumber] = useState(currentTrainData?.num);
useEffect(() => {
const {
TrainNumberOverride,
} = customTrainDataDetector(currentTrainData?.num, allCustomTrainData);
if (!TrainNumberOverride) return;
setTrainNumber(TrainNumberOverride);
const { TrainNumberOverride } = customTrainDataDetector(
currentTrainData?.num,
allCustomTrainData
);
if (TrainNumberOverride) {
setTrainNumber(TrainNumberOverride);
}else{
setTrainNumber(currentTrainData?.num);
}
}, [currentTrainData?.num, allCustomTrainData]);
// 投稿システム関係
// Dialog表示関係

View File

@@ -197,15 +197,15 @@ export const EachTrainInfoCore = ({
const scrollHandlers = actionSheetRef
? useScrollHandlers("scrollview-1", actionSheetRef)
: null;
const [trueTrainID, setTrueTrainID] = useState();
const [trueTrainID, setTrueTrainID] = useState([]);
useEffect(() => {
if (!data.trainNum) return;
const TD = trainList[data.trainNum];
setHeadStation([]);
setTailStation([]);
if (!TD) {
const specialTrainActualID = searchSpecialTrain(data.trainNum, trainList);
setTrueTrainID(specialTrainActualID || undefined);
const specialTrainActualIDs = searchSpecialTrain(data.trainNum, trainList);
setTrueTrainID(specialTrainActualIDs || []);
setTrainData([]);
return;
}
@@ -392,6 +392,7 @@ export const EachTrainInfoCore = ({
containerProps={{
style: {
maxHeight: isLandscape ? height - 94 : (height / 100) * 70,
backgroundColor:getTrainType(customTrainDataDetector(data.trainNum, allCustomTrainData).type).data === "notService" ? "#777777ff" :"white"
},
}}
shortHeader={
@@ -422,6 +423,7 @@ export const EachTrainInfoCore = ({
/>
}
>
{getTrainType(customTrainDataDetector(data.trainNum, allCustomTrainData).type).data === "notService" &&<Text style={{backgroundColor:"#ffffffc2",fontWeight:"bold"}}>この列車には乗車できません</Text>}
{headStation.length != 0 &&
headStation.map((i, index) =>
showHeadStation.findIndex((d) => d == index) == -1 ? (
@@ -441,6 +443,7 @@ export const EachTrainInfoCore = ({
borderRadius: 5,
alignItems: "center",
}}
key={i.station + "-head"}
>
<Text
style={{ fontSize: 18, fontWeight: "bold", color: "black" }}
@@ -469,10 +472,10 @@ export const EachTrainInfoCore = ({
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
alignItems: "center", backgroundColor:"#ffffffc2"
}}
>
<Text style={{ fontSize: 18, fontWeight: "bold", color: "black" }}>
<Text style={{ fontSize: 18, fontWeight: "bold", color: "black",}}>
Twitterで検索
</Text>
</TouchableOpacity>
@@ -490,10 +493,12 @@ export const EachTrainInfoCore = ({
currentTrainData,
openStationACFromEachTrainInfo,
showThrew,
key: i + "-stop"
}}
/>
)
)}
<Text style={{backgroundColor:"#ffffffc2"}}>時刻が斜体,青色になっている時刻はコミュニティで追加されている独自データです</Text>
{tailStation.length != 0 &&
tailStation.map(({ station, dia }, index) =>
showTailStation.findIndex((d) => d == index) == -1 ? (
@@ -534,6 +539,7 @@ export const EachTrainInfoCore = ({
flexDirection: "row",
borderBottomWidth: 1,
borderBottomColor: "#f0f0f0",
backgroundColor:"#ffffffc2",
flex: 1,
}}
>

View File

@@ -11,7 +11,7 @@ import { useTrainMenu } from "@/stateBox/useTrainMenu";
import { useAllTrainDiagram } from "@/stateBox/useAllTrainDiagram";
import { useNotification } from "@/stateBox/useNotifications";
import { getStringConfig } from "@/lib/getStringConfig";
import { FontAwesome } from "@expo/vector-icons";
import { FontAwesome, MaterialCommunityIcons } from "@expo/vector-icons";
import { getPDFViewURL } from "@/lib/getPdfViewURL";
type Props = {
@@ -133,12 +133,18 @@ export const HeaderText: FC<Props> = ({
>
<TrainIconStatus {...{ data, navigate, from }} />
<TouchableOpacity
style={{ borderRadius: 5, flexDirection: "row", alignItems: "center" }}
onLongPress={() => {
if (!updatePermission) return;
const uri = `https://jr-shikoku-data-post-system.pages.dev?trainNum=${trainNum}&token=${expoPushToken}`;
navigate("generalWebView", { uri, useExitButton: false });
SheetManager.hide("EachTrainInfo");
style={{
borderRadius: 5,
flexDirection: "row",
alignItems: "center",
...(trainInfoUrl
? {
borderWidth: 0,
borderBottomWidth: 1,
borderStyle: "solid",
borderColor: "white",
}
: {}),
}}
onPress={() => {
if (!trainInfoUrl) return;
@@ -148,7 +154,7 @@ export const HeaderText: FC<Props> = ({
navigate("generalWebView", { uri, useExitButton: true });
SheetManager.hide("EachTrainInfo");
}}
disabled={!(!!updatePermission || !!trainInfoUrl)}
disabled={!trainInfoUrl}
>
<Text
style={{
@@ -162,8 +168,15 @@ export const HeaderText: FC<Props> = ({
{typeName}
</Text>
{isOneMan && <OneManText />}
<Text style={textConfig}>{trainName}</Text>
<Text style={{...textConfig,...trainName.length >10 ?{fontSize:14}:{} }}>{trainName}</Text>
<InfogramText infogram={infogram} />
{/* {trainInfoUrl && (
<MaterialCommunityIcons
name={"open-in-new"}
color="white"
size={15}
/>
)} */}
</TouchableOpacity>
{isEdit && (
<FontAwesome
@@ -182,11 +195,21 @@ export const HeaderText: FC<Props> = ({
)}
<View style={{ flex: 1 }} />
<Text style={textConfig}>
{showHeadStation.map((d) => `${headStation[d].id} + `)}
{trainNum}
{showTailStation.map((d) => ` + ${tailStation[d].id}`)}
</Text>
<TouchableOpacity
onLongPress={() => {
if (!updatePermission) return;
const uri = `https://jr-shikoku-data-post-system.pages.dev?trainNum=${trainNum}&token=${expoPushToken}`;
navigate("generalWebView", { uri, useExitButton: false });
SheetManager.hide("EachTrainInfo");
}}
disabled={!updatePermission}
>
<Text style={textConfig}>
{showHeadStation.map((d) => `${headStation[d].id} + `)}
{trainNum}
{showTailStation.map((d) => ` + ${tailStation[d].id}`)}
</Text>
</TouchableOpacity>
<TrainViewIcon {...{ data, navigate, from }} />
</View>

View File

@@ -111,13 +111,13 @@ export const TrainIconStatus: FC<Props> = ({ data, navigate, from }) => {
{move ? (
<Image
source={{ uri: trainIcon }}
style={{ height: 34, width: 30, marginRight: 5 }}
resizeMethod="scale"
style={{ height: 30, width: 24, marginRight: 5 }}
resizeMethod="resize"
/>
) : (
<Ionicons
{...anpanmanStatus}
size={30}
size={24}
style={{ marginRight: 5 }}
/>
)}

View File

@@ -1,10 +1,14 @@
import React, { useRef } from "react";
import React, { FC, useRef } from "react";
import { View, Platform } from "react-native";
import ActionSheet from "react-native-actions-sheet";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { SpecialTrainInfoBox } from "../Menu/SpecialTrainInfoBox";
export const SpecialTrainInfo = ({ payload }) => {
type props = {
payload: { navigate: (screen: string, params?: object) => void };
};
export const SpecialTrainInfo: FC<props> = ({ payload }) => {
const { navigate } = payload;
const actionSheetRef = useRef(null);
const insets = useSafeAreaInsets();

View File

@@ -159,7 +159,7 @@ export const DynamicHeaderScrollView = (props) => {
ref={scrollHandlers.ref}
onLayout={scrollHandlers.onLayout}
scrollEventThrottle={scrollHandlers.scrollEventThrottle}
style={{ backgroundColor: "white", zIndex: 0 }}
style={{ zIndex: 0 }}
stickyHeaderIndices={[1]}
onScroll={onScroll}
>

View File

@@ -1,4 +1,4 @@
import { FC, useEffect, useLayoutEffect, useState } from "react";
import { FC, useLayoutEffect, useState } from "react";
import { View, Text, TouchableOpacity } from "react-native";
import { getPDFViewURL } from "@/lib/getPdfViewURL";
import { ScrollView, SheetManager } from "react-native-actions-sheet";
@@ -6,20 +6,27 @@ import { ScrollView, SheetManager } from "react-native-actions-sheet";
type props = {
navigate: (screen: string, params?: object) => void;
};
type specialDataType = { address: string; text: string; description: string };
export const SpecialTrainInfoBox: FC<props> = ({ navigate }) => {
const [specialData, setSpecialData] = useState([]);
const [specialData, setSpecialData] = useState<specialDataType[]>([]);
useLayoutEffect(() => {
fetch("https://n8n.haruk.in/webhook/sptrainfo")
.then((res) => res.json())
.then((data) => setSpecialData(data.data))
.catch((err) => console.log(err));
}, []);
const onPressItem: (d: specialDataType) => void = (d) => {
navigate("howto", {
info: getPDFViewURL("https://www.jr-shikoku.co.jp" + d.address),
goTo: "menu",
});
SheetManager.hide("SpecialTrainInfo");
};
return (
<View
style={{
backgroundColor: "#0099CC",
}}
>
<View style={{ backgroundColor: "#0099CC" }}>
<View style={{ flexDirection: "row", alignItems: "center" }}>
<Text
style={{
@@ -33,20 +40,10 @@ export const SpecialTrainInfoBox: FC<props> = ({ navigate }) => {
</Text>
</View>
<ScrollView
style={{
backgroundColor: "white",
}}
>
<ScrollView style={{ backgroundColor: "white" }}>
{specialData.map((d) => (
<TouchableOpacity
onPress={() => {
navigate("howto", {
info: getPDFViewURL("https://www.jr-shikoku.co.jp" + d.address),
goTo: "menu",
});
SheetManager.hide("SpecialTrainInfo");
}}
onPress={() => onPressItem(d)}
onLongPress={() => alert(d.description)}
key={d.address}
style={{

View File

@@ -17,7 +17,7 @@ import { SwitchArea } from "../atom/SwitchArea";
import { useNotification } from "../../stateBox/useNotifications";
import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem";
const versionCode = "6.1.5"; // Update this version code as needed
const versionCode = "6.1.6"; // Update this version code as needed
export const SettingTopPage = ({
testNFC,

View File

@@ -24,6 +24,7 @@ type Props = {
train: string;
lastStation: string;
time: string;
isThrough?: boolean;
};
trainIDSwitch: boolean;
trainDescriptionSwitch: boolean;
@@ -100,7 +101,19 @@ export const EachData: FC<Props> = (props) => {
return customTrainData;
}
};
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
const [train, setTrain] = useState<{
ToData: string;
TrainNumber: string;
id: string;
img: string;
isWanman: boolean;
trainName: string;
trainNumDistance: number;
type:string;
viaData:string;
info?:string;
uwasa?:string;
}>(getTrainDataFromCurrentTrain(d.train));
useEffect(() => {
setTrain(getTrainDataFromCurrentTrain(d.train));
}, [currentTrain, d.train, trainDescriptionSwitch]);
@@ -114,7 +127,6 @@ export const EachData: FC<Props> = (props) => {
station.Station_JP
)}`;
// 投稿システム関係
// Dialog表示関係
const [dialog, setDialog] = useState(false);
@@ -130,7 +142,6 @@ export const EachData: FC<Props> = (props) => {
const [posInput, setPosInput] = useState<string>("");
const [descInput, setDescInput] = useState<string>("");
const [isShow, setIsShow] = useState(true);
const [isDepartureNow, setIsDepartureNow] = useState(false);
useEffect(() => {
@@ -199,18 +210,20 @@ export const EachData: FC<Props> = (props) => {
trainID={d.train}
type={train.type}
/>
<LastStation lastStation={d.lastStation} />
<LastStation lastStation={d.lastStation} ToData={train.ToData} />
<DependTime time={d.time} />
<StatusAndDelay trainDelayStatus={trainDelayStatus} />
</TouchableOpacity>
{!!isDepartureNow && (
<Description
info={
d.lastStation == "当駅止"
d.isThrough
? "通過列車にご注意ください"
: d.lastStation == "当駅止"
? "この列車は当駅止です。間もなく到着します。"
: "列車の出発時刻です。"
}
key={d.train + "-description"}
key={d.train + "-isDepartureNow"}
/>
)}
{trainDescriptionSwitch && (
@@ -226,7 +239,6 @@ export const EachData: FC<Props> = (props) => {
setPosNum={setPosNum}
setLine={setLine}
setStationNum={setStationNum}
//編集機能関係
setLineInput={setLineInput}
setPosInput={setPosInput}
@@ -237,6 +249,9 @@ export const EachData: FC<Props> = (props) => {
{trainDescriptionSwitch && !!train.info && (
<Description info={train.info} key={d.train + "-description"} />
)}
{trainDescriptionSwitch && !!train.uwasa && (
<Description info={train.uwasa} key={d.train + "-uwasa"} />
)}
</>
);
};

View File

@@ -3,18 +3,20 @@ import { Text, View } from "react-native";
type Props = {
lastStation: string;
ToData: string;
};
export const LastStation: FC<Props> = ({ lastStation }) => {
export const LastStation: FC<Props> = ({ lastStation, ToData }) => {
const isEdit = ToData === "" ? false : ToData !== lastStation;
return (
<View style={{ flex: 4, flexDirection: "row" }}>
<Text
style={{
fontSize: lastStation.length > 4 ? parseInt("12%") : parseInt("16%"),
color: "white",
color: isEdit? "#ffd16fff":"white",
fontWeight: "bold",
}}
>
{lastStation}
{isEdit ? ToData : lastStation}
</Text>
</View>
);

View File

@@ -110,15 +110,29 @@ export default function LED_vision(props) {
.map((trainNum) => {
let trainData = {};
stationDiagram[trainNum].split("#").forEach((data) => {
if(trainNum == 74){
console.log(data);
}
if (data.match("着")) {
trainData.lastStation = data.split(",着,")[0];
}
if (data.match("着編")) {
trainData.lastStation = data.split(",着編,")[0];
}
if (data.split(",")[0] === station.Station_JP) {
if (data.match(",発,")) {
trainData.time = data.split(",発,")[1];
} else if (data.match(",,")) {
}else if (data.match(",発編,")) {
trainData.time = data.split(",発編,")[1];
} else if (data.match(",通編,")) {
trainData.time = data.split(",通編,")[1];
trainData.isThrough = true;
} else if (data.match(",着,")) {
trainData.time = data.split(",着,")[1];
trainData.lastStation = "当駅止";
}else if (data.match(",着編,")) {
trainData.time = data.split(",着編,")[1];
trainData.lastStation = "当駅止";
}
}
});
@@ -126,6 +140,7 @@ export default function LED_vision(props) {
train: trainNum,
time: trainData.time,
lastStation: trainData.lastStation,
isThrough: trainData.isThrough,
};
})
.filter((d) => d.time);
@@ -148,7 +163,6 @@ export default function LED_vision(props) {
const timeFiltering = (d) => {
const baseTime = 2;
if (currentTrain.filter((t) => t.num == d.train).length == 0) {
const date = dayjs();
const trainTime = date

View File

@@ -8,8 +8,9 @@ export const searchSpecialTrain = (trainNum: string, trainList: any[]) => {
}
return false;
};
if (search("D")) return searchBase + "D";
if (search("M")) return searchBase + "M";
const returnBase = [];
if (search("D")) returnBase.push(searchBase + "D");
if (search("M")) returnBase.push(searchBase + "M");
//増結いしづちの場合
const baseStr = trainNum
@@ -21,6 +22,7 @@ export const searchSpecialTrain = (trainNum: string, trainList: any[]) => {
if (9000 < baseNum && baseNum < 9047) {
//いしづちの1001M-1046Mが9000番台になっている場合に発動
const TD = trainList[`${baseNum - 8000}M`];
if (TD) return `${baseNum - 8000}M`;
if (TD) returnBase.push(`${baseNum - 8000}M`);
}
return returnBase;
};

View File

@@ -9,6 +9,7 @@ type typeID =
| "SPCL_Normal"
| "SPCL_Rapid"
| "SPCL_EXP"
| "Party"
| "Freight"
| "Forwarding"
| "FreightForwarding"
@@ -36,6 +37,8 @@ export const getStringConfig: types = (type, id) => {
return ["臨時快速", true, false];
case "SPCL_EXP":
return ["臨時特急", true, false];
case "Party":
return ["団体臨時", true, false];
case "Freight":
return ["貨物", false, false];
case "Forwarding":

View File

@@ -5,7 +5,7 @@ type nameString =
| "SPCL"
| "Normal"
| string;
type colorString = "aqua" | "red" | "#297bff" | "white" | "pink";
type colorString = "aqua" | "red" | "#297bff" | "#ff7300ff" | "#00869ecc" | "#727272cc" | "white" | "pink";
type trainTypeString =
| "快速"
| "特急"
@@ -15,8 +15,12 @@ type trainTypeString =
| "普通列車(ワンマン)"
| "臨時快速"
| "臨時特急"
| "団体臨時"
| "貨物"
| "回送"
| "単機回送"
| "その他";
type trainTypeDataString = "rapid" | "express" | "normal";
type trainTypeDataString = "rapid" | "express" | "normal" | "notService";
type getTrainType = (d: nameString) => {
color: colorString;
name: trainTypeString;
@@ -42,6 +46,14 @@ export const getTrainType: getTrainType = (nameString) => {
return { color: "#297bff", name: "臨時快速", data: "normal" };
case "SPCL_EXP":
return { color: "#297bff", name: "臨時特急", data: "normal" };
case "Party":
return { color: "#ff7300ff", name: "団体臨時", data: "normal" };
case "Freight":
return { color: "#00869ecc", name: "貨物", data: "notService" };
case "Forwarding":
return { color: "#727272cc", name: "回送", data: "notService" };
case "FreightForwarding":
return { color: "#727272cc", name: "単機回送", data: "notService" };
default:
return { color: "white", name: "その他", data: "normal" };
}

View File

@@ -634,39 +634,6 @@ export const injectJavascriptData: InjectJavascriptData = (
`;
const normal_train_name = `
const getJRF = num =>{
switch(num){
case "71":
return "東京(タ)→高松(タ)";
case "73":
case "75":
return "大阪(タ)→高松(タ)";
case "3079":
return "高松(タ)→伊予三島";
case "3071":
case "3077":
return "高松(タ)→新居浜";
case "3073":
return "高松(タ)→松山貨物";
case "70":
return "高松(タ)→東京(タ)";
case "74":
case "76":
return "高松(タ)→大阪(タ)";
case "3078":
return "伊予三島→高松(タ)";
case "3070":
return "新居浜→高松(タ)";
case "3076":
return "新居浜→高松(タ)";
case "3072":
return "松山貨物→高松(タ)";
case "9070":
return "臨時貨物";
default:
return undefined;
}
}
const nameReplace = (列車名データ,列番データ,行き先情報,hasProblem,isLeft) =>{
let isWanman = false;
let trainName = "";
@@ -724,15 +691,6 @@ export const injectJavascriptData: InjectJavascriptData = (
trainName = "臨時列車";
}
let JRF = true;
const JRFTemp = getJRF(列番データ);
if(JRFTemp){
trainName = JRFTemp;
JRF = false;
}
const getThrew = num =>{
switch(num){
@@ -833,30 +791,6 @@ export const injectJavascriptData: InjectJavascriptData = (
viaData = "ごめん・なはり線[快速]";
ToData = "(後免にて解結)\\n土佐山田/奈半利";
break;
case "9395D":
viaData = "[臨時]普通";
ToData = "三本松";
break;
case "9174M":
viaData = "[臨時]マリンライナー94号";
ToData = "岡山";
break;
case "9662D":
viaData = "[臨時]れんげ号";
ToData = "八幡浜";
break;
case "9665D":
viaData = "[臨時]れんげ号";
ToData = "宇和島";
break;
case "9664D":
viaData = "[臨時]わらぐろ号";
ToData = "八幡浜";
break;
case "9663D":
viaData = "[臨時]わらぐろ号";
ToData = "卯之町";
break;
default:
if(new RegExp(/^58[1-3][1,3,5,7,9][DM]$/).test(列番データ)){
viaData = "ごめん・なはり線[快速]";
@@ -882,61 +816,77 @@ export const injectJavascriptData: InjectJavascriptData = (
if(trainDataList.find(e => e.id === 列番データ) !== undefined){
const data = trainDataList.find(e => e.id === 列番データ);
//{id,trainName,viaData,ToData,TrainNumber,TrainNumberOverride,type,infoUrl,trainNumDistance,info,infogram,isEdit}
trainType = (()=>{
switch(data.type){
case "Normal":
trainTypeColor = "black";
isWanman = false;
return "普通";
case "OneMan":
trainTypeColor = "black";
isWanman = true;
return "普通";
case "Rapid":
trainTypeColor = "rgba(0, 140, 255, 1)";
isWanman = false;
return "快速";
case "OneManRapid":
trainTypeColor = "rgba(0, 140, 255, 1)";
isWanman = true;
return "快速";
case "LTDEXP":
trainTypeColor = "red";
isWanman = false;
return "特急";
case "NightLTDEXP":
trainTypeColor = "#d300b0ff";
isWanman = false;
return "寝台特急";
case "SPCL":
case "SPCL_Normal":
trainTypeColor = "#008d07ff";
isWanman = false;
return "臨時";
case "SPCL_Rapid":
trainTypeColor = "rgba(0, 81, 255, 1)";
isWanman = false;
return "臨時快速";
case "SPCL_EXP":
trainTypeColor = "#a52e2eff";
isWanman = false;
return "臨時特急";
case "Freight":
trainTypeColor = "#00869ecc";
isWanman = false;
return "貨物";
case "Forwarding":
trainTypeColor = "#727272cc";
isWanman = false;
return "回送";
case "FreightForwarding":
trainTypeColor = "#727272cc";
isWanman = false;
return "単機回送";
default:
return "";
}
})();
switch(data.type){
case "Normal":
trainTypeColor = "black";
isWanman = false;
trainType = "普通";
break;
case "OneMan":
trainTypeColor = "black";
isWanman = true;
trainType = "普通";
break;
case "Rapid":
trainTypeColor = "rgba(0, 140, 255, 1)";
isWanman = false;
trainType = "快速";
break;
case "OneManRapid":
trainTypeColor = "rgba(0, 140, 255, 1)";
isWanman = true;
trainType = "快速";
break;
case "LTDEXP":
trainTypeColor = "red";
isWanman = false;
trainType = "特急";
break;
case "NightLTDEXP":
trainTypeColor = "#d300b0ff";
isWanman = false;
trainType = "寝台特急";
break;
case "SPCL":
case "SPCL_Normal":
trainTypeColor = "#008d07ff";
isWanman = false;
trainType = "臨時";
break;
case "SPCL_Rapid":
trainTypeColor = "rgba(0, 81, 255, 1)";
isWanman = false;
trainType = "臨時快速";
break;
case "SPCL_EXP":
trainTypeColor = "#a52e2eff";
isWanman = false;
trainType = "臨時特急";
break;
case "Party":
trainTypeColor = "#ff7300ff";
isWanman = false;
trainType = "団体臨時";
break;
case "Freight":
trainTypeColor = "#00869ecc";
isWanman = false;
trainType = "貨物";
break;
case "Forwarding":
trainTypeColor = "#727272cc";
isWanman = false;
trainType = "回送";
break;
case "FreightForwarding":
trainTypeColor = "#727272cc";
isWanman = false;
trainType = "単機回送";
break;
default:
break;
}
isEdit = data.isEdit;
isSeason = data.isSeason;
if(data.trainName != ""){
@@ -1003,7 +953,7 @@ export const injectJavascriptData: InjectJavascriptData = (
const gradient = getColors.length > 1 ? "linear-gradient(130deg, " + getColors[0] + " 0%, "+ getColors[0]+"50%, "+ getColors[1]+"50%, " + getColors[1] + " 100%)" : getColors[0];
行き先情報.insertAdjacentHTML('beforebegin', "<div style='width:100%;display:flex;flex:1;flex-direction:"+(isLeft ? "column-reverse" : "column") + ";'>"+( isEdit ? "<div style='position:absolute;"+ (isLeft ? "right" : "left") + ":0;"+ (isLeft ? "bottom" : "top") + ":0;background-color:#00b8bb;border-radius:15px;padding:0px;padding-left:4px;padding-right:4px;'><i class='fa-solid fa-user-group fa-sm' style='color:white;width:100%;height:100%;'></i></div>" : isSeason ? "<div style='position:absolute;"+ (isLeft ? "right" : "left") + ":0;"+ (isLeft ? "bottom" : "top") + ":0;background-color:#00b8bb;border-radius:15px;padding:0px;padding-left:4px;padding-right:4px;'><i class='fa-solid fa-calendar fa-sm' style='color:white;width:100%;height:100%;'></i></div>" : "")+"<p style='font-size:6px;padding:0;color:black;text-align:center;'>" + (TrainNumberOverride ? TrainNumberOverride : TrainNumber) + "</p><div style='flex:1;'></div><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + (isWanman ? "ワンマン " : "") + "</p><p style='font-size:6px;font-weight:bold;padding:0;color: black;text-align:center;border-style:solid;border-width: "+(!!yosan2Color ? "2px" : "0px")+";border-color:" + yosan2Color + "'>" + viaData + "</p><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + trainName + "</p><div style='width:100%;background:" + gradient + ";'><p style='font-size:10px;font-weight:bold;padding:0;margin:0;color:white;align-items:center;align-content:center;text-align:center;text-shadow:1px 1px 0px #00000030, -1px -1px 0px #00000030,-1px 1px 0px #00000030, 1px -1px 0px #00000030,1px 0px 0px #00000030, -1px 0px 0px #00000030,0px 1px 0px #00000030, 0px -1px 0px #00000030;'>" + (ToData ? ToData + "行" : ToData) + "</p></div><div style='width:100%;background:" + trainTypeColor + ";border-radius:"+(isLeft ? "4px 4px 0 0" : "0 0 4px 4px")+";'><p style='font-size:10px;font-weight:bold;font-style:italic;padding:0;color: white;text-align:center;'>" + trainType + "</p></div><p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p></div>");
行き先情報.insertAdjacentHTML('beforebegin', "<div style='width:100%;display:flex;flex:1;flex-direction:"+(isLeft ? "column-reverse" : "column") + ";'>" + ( isEdit ? "<div style='position:absolute;"+ (isLeft ? "right" : "left") + ":0;"+ (isLeft ? "bottom" : "top") + ":0;background-color:#00b8bb;border-radius:15px;padding:0px;padding-left:4px;padding-right:4px;'><i class='fa-solid fa-user-group fa-sm' style='color:white;width:100%;height:100%;'></i></div>" : isSeason ? "<div style='position:absolute;"+ (isLeft ? "right" : "left") + ":0;"+ (isLeft ? "bottom" : "top") + ":0;background-color:#00b8bb;border-radius:15px;padding:0px;padding-left:4px;padding-right:4px;'><i class='fa-solid fa-calendar fa-sm' style='color:white;width:100%;height:100%;'></i></div>" : "") + "<p style='font-size:6px;padding:0;color:black;text-align:center;'>" + (TrainNumberOverride ? TrainNumberOverride : TrainNumber) + "</p><div style='flex:1;'></div><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + (isWanman ? "ワンマン " : "") + "</p><p style='font-size:6px;font-weight:bold;padding:0;color: black;text-align:center;border-style:solid;border-width: "+(!!yosan2Color ? "2px" : "0px")+";border-color:" + yosan2Color + "'>" + viaData + "</p><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + trainName + "</p><div style='width:100%;background:" + gradient + ";'><p style='font-size:10px;font-weight:bold;padding:0;margin:0;color:white;align-items:center;align-content:center;text-align:center;text-shadow:1px 1px 0px #00000030, -1px -1px 0px #00000030,-1px 1px 0px #00000030, 1px -1px 0px #00000030,1px 0px 0px #00000030, -1px 0px 0px #00000030,0px 1px 0px #00000030, 0px -1px 0px #00000030;'>" + (ToData ? ToData + "行" : ToData) + "</p></div><div style='width:100%;background:" + trainTypeColor + ";border-radius:"+(isLeft ? "4px 4px 0 0" : "0 0 4px 4px")+";'><p style='font-size:10px;font-weight:bold;font-style:italic;padding:0;color: white;text-align:center;'>" + trainType + "</p></div><p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p></div>");
`: `
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: black;'>" + returnText1 + "</p>");
行き先情報.insertAdjacentHTML('beforebegin', "<div style='display:inline-flex;flex-direction:row;'><p style='font-size:10px;font-weight: bold;padding:0;color:black;'>" + (ToData ? ToData + "行 " : ToData) + "</p><p style='font-size:10px;padding:0;color:black;'>" + (TrainNumberOverride ? TrainNumberOverride : TrainNumber) + "</p></div>");
@@ -1018,49 +968,65 @@ export const injectJavascriptData: InjectJavascriptData = (
const setNewTrainItem = (element,hasProblem,type)=>{
var 列番データ = element.getAttribute('offclick').split('"')[1];
const JRFTemp = getJRF(列番データ);
if(trainDataList.find(e => e.id === 列番データ) !== undefined){
const data = trainDataList.find(e => e.id === 列番データ);
switch (data.type) {
case "Normal":
element.style.borderColor = "black";
element.style.backgroundColor = '#ffffffcc';
break;
case "OneMan":
element.style.borderColor = "black";
element.style.backgroundColor = '#ffffffcc';
break;
case "Rapid":
element.style.borderColor = "rgba(0, 140, 255, 1)";
element.style.backgroundColor = '#ffffffcc';
break;
case "OneManRapid":
element.style.borderColor = "rgba(0, 140, 255, 1)";
element.style.backgroundColor = '#ffffffcc';
break;
case "LTDEXP":
element.style.borderColor = "red";
element.style.backgroundColor = '#ffffffcc';
break;
case "NightLTDEXP":
element.style.borderColor = "#d300b0ff";
element.style.backgroundColor = '#ffffffcc';
break;
case "SPCL":
case "SPCL_Normal":
element.style.borderColor = "#008d07ff";
element.style.backgroundColor = '#ffffffcc';
break;
case "SPCL_Rapid":
element.style.borderColor = "rgba(0, 81, 255, 1)";
element.style.borderColor = "#0051ffff";
element.style.backgroundColor = '#ffffffcc';
break;
case "SPCL_EXP":
element.style.borderColor = "#a52e2eff";
element.style.backgroundColor = '#ffffffcc';
break;
case "Party":
element.style.borderColor = "#ff7300ff";
element.style.backgroundColor = '#ffd0a9ff';
break;
case "Freight":
element.style.borderColor = "#00869ecc";
element.style.backgroundColor = '#c7c7c7cc';
break;
case "Forwarding":
element.style.borderColor = "#727272cc";
element.style.backgroundColor = '#c7c7c7cc';
break;
case "FreightForwarding":
element.style.borderColor = "#727272cc";
element.style.backgroundColor = '#c7c7c7cc';
break;
default:
element.style.borderColor = 'black';
element.style.backgroundColor = '#ffffffcc';
break;
}
}else{
@@ -1068,8 +1034,6 @@ const setNewTrainItem = (element,hasProblem,type)=>{
element.style.borderColor = '#ff0000ff';
}else if(element.getAttribute('offclick').includes("rapid")){
element.style.borderColor = '#008cffff';
}else if(JRFTemp){
element.style.borderColor = '#00869ecc';
}else{
element.style.borderColor = 'black';
}
@@ -1077,19 +1041,6 @@ const setNewTrainItem = (element,hasProblem,type)=>{
element.style.borderWidth = '2px';
element.style.borderStyle = 'solid';
element.style.borderRadius = '10%';
switch(true){
case 列番データ.indexOf("H") != -1:
case 列番データ.indexOf("R") != -1:
case 列番データ.indexOf("E") != -1:
case 列番データ.indexOf("A") != -1:
case 列番データ.indexOf("B") != -1:
case !!JRFTemp:
element.style.backgroundColor = 'rgba(199, 199, 199, 0.8)';
break;
default:
element.style.backgroundColor = 'rgba(255, 255, 255, 0.8)';
break;
}
if(hasProblem){
element.style.boxShadow = '0 0 10px rgba(255, 0, 0, 0.9)';
}else{