追跡ができなくなったら解除するように変更
This commit is contained in:
@@ -34,7 +34,7 @@ export const FixedTrain: FC<props> = ({
|
|||||||
displaySize,
|
displaySize,
|
||||||
setDisplaySize,
|
setDisplaySize,
|
||||||
}) => {
|
}) => {
|
||||||
const { setFixedPosition, currentTrain, getCurrentStationData, getPosition } =
|
const {fixedPosition, setFixedPosition, currentTrain, getCurrentStationData, getPosition } =
|
||||||
useCurrentTrain();
|
useCurrentTrain();
|
||||||
|
|
||||||
const { mapSwitch } = useTrainMenu();
|
const { mapSwitch } = useTrainMenu();
|
||||||
@@ -51,9 +51,14 @@ 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);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
alert("追跡していた列車が消えました。追跡を終了します。");
|
||||||
|
setFixedPosition({ type: null, value: null });
|
||||||
|
}
|
||||||
}, [trainID, currentTrain]);
|
}, [trainID, currentTrain]);
|
||||||
|
|
||||||
const { getStationDataFromName, stationList, originalStationList } =
|
const { getStationDataFromName, stationList, originalStationList } =
|
||||||
|
@@ -74,10 +74,15 @@ export const StationListProvider: FC<Props> = ({ children }) => {
|
|||||||
Object.keys(originalStationList).forEach((key) => {
|
Object.keys(originalStationList).forEach((key) => {
|
||||||
originalStationList[key].forEach((station) => {
|
originalStationList[key].forEach((station) => {
|
||||||
if (!station.StationNumber) return;
|
if (!station.StationNumber) return;
|
||||||
if (typeof station.StationNumber === "string" && station.StationNumber.includes(name)) {
|
if (
|
||||||
|
typeof station.StationNumber === "string" &&
|
||||||
|
station.StationNumber.includes(name)
|
||||||
|
) {
|
||||||
if (!!station.jslodApi) returnArray.push(station);
|
if (!!station.jslodApi) returnArray.push(station);
|
||||||
}
|
} else if (
|
||||||
else if (typeof station.Station_JP === "string" && station.Station_JP.includes(name)) {
|
typeof station.Station_JP === "string" &&
|
||||||
|
station.Station_JP.includes(name)
|
||||||
|
) {
|
||||||
if (!!station.jslodApi) returnArray.push(station);
|
if (!!station.jslodApi) returnArray.push(station);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -122,6 +127,7 @@ export const StationListProvider: FC<Props> = ({ children }) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (bootStationList[0].line === undefined) return "";
|
||||||
return `MoveDisplayStation('${bootStationList[0].line}_${bootStationList[0].station.MyStation}_${bootStationList[0].station.Station_JP}');document.getElementById("disp").insertAdjacentHTML("afterbegin", "<div />");setReload();`;
|
return `MoveDisplayStation('${bootStationList[0].line}_${bootStationList[0].station.MyStation}_${bootStationList[0].station.Station_JP}');document.getElementById("disp").insertAdjacentHTML("afterbegin", "<div />");setReload();`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user