追跡ができなくなったら解除するように変更
This commit is contained in:
@@ -34,7 +34,7 @@ export const FixedTrain: FC<props> = ({
|
||||
displaySize,
|
||||
setDisplaySize,
|
||||
}) => {
|
||||
const { setFixedPosition, currentTrain, getCurrentStationData, getPosition } =
|
||||
const {fixedPosition, setFixedPosition, currentTrain, getCurrentStationData, getPosition } =
|
||||
useCurrentTrain();
|
||||
|
||||
const { mapSwitch } = useTrainMenu();
|
||||
@@ -51,9 +51,14 @@ export const FixedTrain: FC<props> = ({
|
||||
}, [currentTrain, trainID]);
|
||||
useEffect(() => {
|
||||
const stationData = getCurrentStationData(trainID);
|
||||
console.log(stationData);
|
||||
if (stationData) {
|
||||
setTrain(stationData);
|
||||
}
|
||||
else{
|
||||
alert("追跡していた列車が消えました。追跡を終了します。");
|
||||
setFixedPosition({ type: null, value: null });
|
||||
}
|
||||
}, [trainID, currentTrain]);
|
||||
|
||||
const { getStationDataFromName, stationList, originalStationList } =
|
||||
|
@@ -74,10 +74,15 @@ export const StationListProvider: FC<Props> = ({ children }) => {
|
||||
Object.keys(originalStationList).forEach((key) => {
|
||||
originalStationList[key].forEach((station) => {
|
||||
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);
|
||||
}
|
||||
else if (typeof station.Station_JP === "string" && station.Station_JP.includes(name)) {
|
||||
} else if (
|
||||
typeof station.Station_JP === "string" &&
|
||||
station.Station_JP.includes(name)
|
||||
) {
|
||||
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();`;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user