diff --git a/components/発車時刻表/LED_vidion.js b/components/発車時刻表/LED_vidion.js index eca24ec..6eefb49 100644 --- a/components/発車時刻表/LED_vidion.js +++ b/components/発車時刻表/LED_vidion.js @@ -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; } }); }; diff --git a/lib/getTrainType.ts b/lib/getTrainType.ts index 279fd15..264da8a 100644 --- a/lib/getTrainType.ts +++ b/lib/getTrainType.ts @@ -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": diff --git a/menu.js b/menu.js index 12b9d36..9961ed6 100644 --- a/menu.js +++ b/menu.js @@ -131,19 +131,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("404 Not Found") != -1) throw Error; - setTrainDiagram(parseAllTrainDiagram(d)); - }) - .catch(() => { - console.log("fallback"); - setTrainDiagram(trainList); - }); + setTrainDiagram(trainList); }, []); const oPSign = () => {