散歩をLEDに表示できるように修正
This commit is contained in:
parent
e1414eef06
commit
bf7e113862
@ -10,6 +10,7 @@ import { DependTime } from "./LED_inside_Component/DependTime";
|
|||||||
import { LastStation } from "./LED_inside_Component/LastStation";
|
import { LastStation } from "./LED_inside_Component/LastStation";
|
||||||
import { StatusAndDelay } from "./LED_inside_Component/StatusAndDelay";
|
import { StatusAndDelay } from "./LED_inside_Component/StatusAndDelay";
|
||||||
import { TrainName } from "./LED_inside_Component/TrainName";
|
import { TrainName } from "./LED_inside_Component/TrainName";
|
||||||
|
import { customTrainDataDetector } from "../custom-train-data";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
d: {
|
d: {
|
||||||
@ -22,12 +23,6 @@ type Props = {
|
|||||||
station: {
|
station: {
|
||||||
Station_JP: string;
|
Station_JP: string;
|
||||||
};
|
};
|
||||||
customTrainDataDetector: (trainID: string) => {
|
|
||||||
trainName: string;
|
|
||||||
trainNumDistance?: number;
|
|
||||||
type: string;
|
|
||||||
info: string;
|
|
||||||
};
|
|
||||||
navigate: (screen: string, data?: any) => void;
|
navigate: (screen: string, data?: any) => void;
|
||||||
openStationACFromEachTrainInfo: (station: string) => void;
|
openStationACFromEachTrainInfo: (station: string) => void;
|
||||||
};
|
};
|
||||||
@ -37,7 +32,6 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
trainIDSwitch,
|
trainIDSwitch,
|
||||||
trainDescriptionSwitch,
|
trainDescriptionSwitch,
|
||||||
station,
|
station,
|
||||||
customTrainDataDetector,
|
|
||||||
navigate,
|
navigate,
|
||||||
openStationACFromEachTrainInfo,
|
openStationACFromEachTrainInfo,
|
||||||
} = props;
|
} = props;
|
||||||
@ -69,9 +63,30 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
payload,
|
payload,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const [train, setTrain] = useState(customTrainDataDetector(d.train));
|
|
||||||
|
const getTrainDataFromCurrentTrain = (trainNum: string) => {
|
||||||
|
const customTrainData = customTrainDataDetector(d.train);
|
||||||
|
if(customTrainData.type != "Normal") return customTrainData;
|
||||||
|
|
||||||
|
const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
|
||||||
|
if(currentTrainData.length == 0) return customTrainData;
|
||||||
|
|
||||||
|
else if (currentTrainData[0].Type.includes("rapid:")) {
|
||||||
|
const typeText = currentTrainData[0].Type.split(":");
|
||||||
|
const returnData = {
|
||||||
|
type: "Rapid",
|
||||||
|
trainName: typeText[1].replace("\r", ""),
|
||||||
|
trainIcon: null,
|
||||||
|
trainNumDistance: null,
|
||||||
|
info: "",
|
||||||
|
};
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
return customTrainData;
|
||||||
|
}
|
||||||
|
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTrain(customTrainDataDetector(d.train));
|
setTrain(getTrainDataFromCurrentTrain(d.train));
|
||||||
}, [currentTrain, d.train, trainDescriptionSwitch]);
|
}, [currentTrain, d.train, trainDescriptionSwitch]);
|
||||||
// 土讃線複数存在対策
|
// 土讃線複数存在対策
|
||||||
const currentTrainData = checkDuplicateTrainData(
|
const currentTrainData = checkDuplicateTrainData(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { widthPercentageToDP as wp } from "react-native-responsive-screen";
|
import { widthPercentageToDP as wp } from "react-native-responsive-screen";
|
||||||
import { customTrainDataDetector } from "../custom-train-data";
|
|
||||||
import { useInterval } from "../../lib/useInterval";
|
import { useInterval } from "../../lib/useInterval";
|
||||||
import { objectIsEmpty } from "../../lib/objectIsEmpty";
|
import { objectIsEmpty } from "../../lib/objectIsEmpty";
|
||||||
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
|
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
|
||||||
@ -203,7 +202,6 @@ export default function LED_vision(props) {
|
|||||||
d,
|
d,
|
||||||
trainIDSwitch,
|
trainIDSwitch,
|
||||||
trainDescriptionSwitch,
|
trainDescriptionSwitch,
|
||||||
customTrainDataDetector,
|
|
||||||
navigate,
|
navigate,
|
||||||
openStationACFromEachTrainInfo,
|
openStationACFromEachTrainInfo,
|
||||||
}}
|
}}
|
||||||
|
@ -946,6 +946,7 @@ makeTrainView.observe(document.getElementById('modal_content'), {
|
|||||||
trainMenu == "true"
|
trainMenu == "true"
|
||||||
? `
|
? `
|
||||||
// これの中身抽出ShowTrainTimeInfo("1228M","normal")
|
// これの中身抽出ShowTrainTimeInfo("1228M","normal")
|
||||||
|
// ShowTrainTimeInfo("142M","rapid:サンポート南風リレー")
|
||||||
function setTrainMenuDialog(d){
|
function setTrainMenuDialog(d){
|
||||||
try{
|
try{
|
||||||
const offclick = d.getAttribute('offclick');
|
const offclick = d.getAttribute('offclick');
|
||||||
|
Loading…
Reference in New Issue
Block a user