通休編を自動挿入される通過にも適用されるように変更

This commit is contained in:
harukin-expo-dev-env
2025-09-24 16:14:35 +00:00
parent 3dbcc93448
commit 8702b22cdd
3 changed files with 14 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ type seTypes =
| "発" | "発"
| "着" | "着"
| "休編" | "休編"
| "通休編"
| string; | string;
type currentTrainDataType = { type currentTrainDataType = {
@@ -45,6 +46,7 @@ export const EachStopList: FC<props> = ({
if (!showThrew) { if (!showThrew) {
if (se == "通過") return null; if (se == "通過") return null;
if (se == "通編") return null; if (se == "通編") return null;
if (se == "通休編") return null;
} }
const Stations = stationList const Stations = stationList
.map((a) => a.filter((d) => d.StationName == station)) .map((a) => a.filter((d) => d.StationName == station))
@@ -77,6 +79,7 @@ export const EachStopList: FC<props> = ({
case "頃編": case "頃編":
return ["頃", "community"]; return ["頃", "community"];
case "休編": case "休編":
case "通休編":
return ["運休", "community"]; return ["運休", "community"];
default: default:
return [se, "normal"]; return [se, "normal"];
@@ -87,7 +90,7 @@ export const EachStopList: FC<props> = ({
// Array [ "01", "01",] // Array [ "01", "01",]
const textColor = `#${seType == "community" ? "44f" : "000"}${ const textColor = `#${seType == "community" ? "44f" : "000"}${
se == "通過" || se == "通編" ? "5" : "" se == "通過" || se == "通編" || se == "通休編" ? "5" : ""
}`; }`;
return ( return (
<TouchableWithoutFeedback <TouchableWithoutFeedback
@@ -100,7 +103,7 @@ export const EachStopList: FC<props> = ({
<View <View
style={{ style={{
flexDirection: "row", flexDirection: "row",
backgroundColor: se != "休編" ? "#ffffffc2" : "#474747c2", backgroundColor: (se != "休編" && se != "休編") ? "#ffffffc2" : "#474747c2",
}} }}
> >
<View <View
@@ -180,7 +183,7 @@ export const EachStopList: FC<props> = ({
const StationNumbersBox: FC<{ stn: string; se: seTypes }> = (props) => { const StationNumbersBox: FC<{ stn: string; se: seTypes }> = (props) => {
const { stn, se } = props; const { stn, se } = props;
const lineColor = lineColorList[stn.charAt(0)]; const lineColor = lineColorList[stn.charAt(0)];
const hasThrew = se == "通過" || se == "通編" ? "80" : ""; const hasThrew = (se == "通過" || se == "通編" || se == "通休編") ? "80" : "";
const backgroundColor = `${lineColor}${hasThrew}`; const backgroundColor = `${lineColor}${hasThrew}`;
return ( return (
<View style={{ backgroundColor, flex: 1 }} key={stn}> <View style={{ backgroundColor, flex: 1 }} key={stn}>
@@ -216,7 +219,6 @@ const StationTimeBox: FC<StationTimeBoxType> = (props) => {
.set("hour", parseInt(time.split(":")[0])) .set("hour", parseInt(time.split(":")[0]))
.set("minute", parseInt(time.split(":")[1])) .set("minute", parseInt(time.split(":")[1]))
.add(delay == "入線" || delay == undefined ? 0 : delay, "minute"); .add(delay == "入線" || delay == undefined ? 0 : delay, "minute");
const timeString = se == "通過" ? "" : dates.format("HH:mm");
return ( return (
<Text <Text
style={{ style={{
@@ -229,7 +231,7 @@ const StationTimeBox: FC<StationTimeBoxType> = (props) => {
fontStyle: seType == "community" ? "italic" : "normal", fontStyle: seType == "community" ? "italic" : "normal",
}} }}
> >
{se == "通過" ? "レ" : timeString} {se.includes("通") && time == "" ? "レ" : dates.format("HH:mm")}
</Text> </Text>
); );
}; };

View File

@@ -96,15 +96,17 @@ export const EachTrainInfoCore = ({
return StationNumbers; return StationNumbers;
}); });
useEffect(() => { useEffect(() => {
const stopStationList = trainData.map((i) => { const isCancel = [];
const stopStationList = trainData.map((i,index,array) => {
const [station, se, time] = i.split(","); const [station, se, time] = i.split(",");
const [nextStation, nextSe, nextTime] = array[index+1]?.split(",") || [];
isCancel.push(se.includes("休") && nextSe.includes("休"));
if (se == "通編") setHaveThrough(true); if (se == "通編") setHaveThrough(true);
return stationList.map((a) => a.filter((d) => d.StationName == station)); return stationList.map((a) => a.filter((d) => d.StationName == station));
}); });
const allThroughStationList = stopStationList.map((i, index, array) => { const allThroughStationList = stopStationList.map((i, index, array) => {
let allThroughStation = []; let allThroughStation = [];
if (index == array.length - 1) return; if (index == array.length - 1) return;
const firstItem = array[index]; const firstItem = array[index];
const secondItem = array[index + 1]; const secondItem = array[index + 1];
let betweenStationLine = ""; let betweenStationLine = "";
@@ -129,7 +131,8 @@ export const EachTrainInfoCore = ({
d.StationNumber > baseStationNumberFirst && d.StationNumber > baseStationNumberFirst &&
d.StationNumber < baseStationNumberSecond d.StationNumber < baseStationNumberSecond
) { ) {
allThroughStation.push(`${d.Station_JP},通過,`);
allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
setHaveThrough(true); setHaveThrough(true);
reverse = false; reverse = false;
} else { } else {
@@ -137,7 +140,7 @@ export const EachTrainInfoCore = ({
d.StationNumber < baseStationNumberFirst && d.StationNumber < baseStationNumberFirst &&
d.StationNumber > baseStationNumberSecond d.StationNumber > baseStationNumberSecond
) { ) {
allThroughStation.push(`${d.Station_JP},通過,`); allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
setHaveThrough(true); setHaveThrough(true);
reverse = true; reverse = true;
} }

View File

@@ -51,7 +51,6 @@ export const FixedTrain: FC<props> = ({
}, [currentTrain, trainID]); }, [currentTrain, trainID]);
useEffect(() => { useEffect(() => {
const stationData = getCurrentStationData(trainID); const stationData = getCurrentStationData(trainID);
console.log(stationData);
if (stationData) { if (stationData) {
setTrain(stationData); setTrain(stationData);
} }