From 211e361285761b5950a85ca3ce2f2d12419a09e6 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 24 Sep 2025 12:55:30 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AE=87=E5=A4=9A=E6=B4=A5=E9=96=A2=E4=BF=82?= =?UTF-8?q?=E3=81=AE=E6=8C=99=E5=8B=95=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/eachTrainInfoCoreLib/findReversalPoints.js | 15 ++++++++++----- stateBox/useCurrentTrain.tsx | 8 +++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/eachTrainInfoCoreLib/findReversalPoints.js b/lib/eachTrainInfoCoreLib/findReversalPoints.js index 7e4b7f6..0f37283 100644 --- a/lib/eachTrainInfoCoreLib/findReversalPoints.js +++ b/lib/eachTrainInfoCoreLib/findReversalPoints.js @@ -21,12 +21,17 @@ export const findReversalPoints = (array, stopStationIDList) => { } // 駅間の場合 if (array.length == 2) { - const allThroughStation = stopStationIDList.map((d) => { - if ( - (array[0] == "M12" && array[1] == "Y09") || - (array[0] == "Y09" && array[1] == "M12") - ) + const allThroughStation = stopStationIDList.map((d, index, arrays) => { + if (array[0] == "Y09" && array[1] == "M12") { return d[0] == "M12" ? true : false; + } else if (array[0] == "M12" && array[1] == "Y09") { + if (index) { + if (arrays[index - 1][0] == "M12") { + return true; + } + } + return false; + } let returndata = false; d.forEach((x) => { diff --git a/stateBox/useCurrentTrain.tsx b/stateBox/useCurrentTrain.tsx index 7f8b686..53c530c 100644 --- a/stateBox/useCurrentTrain.tsx +++ b/stateBox/useCurrentTrain.tsx @@ -120,10 +120,16 @@ export const CurrentTrainProvider: FC = ({ children }) => { .replace("(上り)", "") .replace("(徳島線)", "") .replace("(高徳線)", "") + .replace("(坂出方)", "") + .replace("(児島方)", "") .split("~"); const direction = currentTrainData?.Direction || 0; if (pos[0] == "児島" && pos[1] == "宇多津") { - return ["M12", "Y09"]; + if (direction == 0) { + return ["Y09", "M12"]; + } else { + return ["M12", "Y09"]; + } } else if (pos[1] == "児島" && pos[0] == "宇多津") { return ["Y09", "M12"]; } else if (pos[0] == "伊予若宮" && pos[1] == "伊予白滝") {