Merge commit '0aaf171477659e632a23aeb6af39e83d5acf70c2' into develop

This commit is contained in:
harukin-expo-dev-env 2025-02-09 03:19:30 +00:00
commit 499e895165
3 changed files with 7 additions and 17 deletions

View File

@ -116,7 +116,7 @@ export default function LED_vision(props) {
if (data.split(",")[0] === station.Station_JP) {
if (data.match(",発,")) {
trainData.time = data.split(",発,")[1];
} else {
} else if(data.match(",着,")){
trainData.time = data.split(",着,")[1];
trainData.lastStation = "当駅止";
}
@ -127,7 +127,7 @@ export default function LED_vision(props) {
time: trainData.time,
lastStation: trainData.lastStation,
};
});
}).filter((d) => d.time);
return returnData.sort((a, b) => {
switch (true) {
case parseInt(a.time.split(":")[0]) < parseInt(b.time.split(":")[0]):
@ -138,6 +138,8 @@ export default function LED_vision(props) {
return -1;
case parseInt(a.time.split(":")[1]) > parseInt(b.time.split(":")[1]):
return 1;
default:
return 0;
}
});
};

View File

@ -5,7 +5,7 @@ type nameString =
| "SPCL"
| "Normal"
| string;
type colorString = "aqua" | "red" | "blue" | "white";
type colorString = "aqua" | "red" | "#297bff" | "white";
type trainTypeString =
| "快速"
| "特急"
@ -29,7 +29,7 @@ export const getTrainType: getTrainType = (nameString) => {
case "NightLTDEXP":
return { color: "red", name: "寝台特急", data: "express" };
case "SPCL":
return { color: "blue", name: "臨時", data: "normal" };
return { color: "#297bff", name: "臨時", data: "normal" };
case "OneMan":
return { color: "white", name: "普通列車(ワンマン)", data: "normal" };
case "Normal":

14
menu.js
View File

@ -133,19 +133,7 @@ export default function Menu({ getCurrentTrain }) {
const [trainDiagram, setTrainDiagram] = useState(null); // 全列車のダイヤを列番ベースで整理
useEffect(() => {
//全列車リストを生成する副作用[無条件初回実行]
fetch(
"https://train.jr-shikoku.co.jp/g?arg1=station&arg2=traintimeinfo&arg3=dia",
HeaderConfig
)
.then((response) => response.text())
.then((d) => {
if (d.indexOf("<title>404 Not Found</title>") != -1) throw Error;
setTrainDiagram(parseAllTrainDiagram(d));
})
.catch(() => {
console.log("fallback");
setTrainDiagram(trainList);
});
setTrainDiagram(trainList);
}, []);
const oPSign = () => {