5 Commits

Author SHA1 Message Date
harukin-expo-dev-env
59e7ba5290 Merge commit '83539d5df30b6569bf7259d7ef79400b6f88a5e3' into patch/6.x 2025-09-25 03:00:11 +00:00
harukin-expo-dev-env
83539d5df3 伊予大洲で表示に失敗していた問題を修正 2025-09-25 02:59:59 +00:00
harukin-expo-dev-env
9e831ecd6e Merge commit '4e367d1e3cec6320dc709003783142370fb2acce' into patch/6.x 2025-09-24 16:59:52 +00:00
harukin-expo-dev-env
0d9c1cdb18 Merge commit 'd419e90140d9d9dbaf6e4ec7afce0df5fa20239a' into patch/6.x 2025-09-11 05:55:20 +00:00
harukin-expo-dev-env
bc4cb450a3 Merge commit '6de39e53b6fae73e21c26727e83a4463f83b51f0' into patch/6.x 2025-09-09 16:16:46 +00:00
5 changed files with 68 additions and 44 deletions

View File

@@ -83,23 +83,29 @@ export const EachTrainInfoCore = ({
const [haveThrough, setHaveThrough] = useState(false);
// 使用例
const stopStationIDList = trainDataWidhThrough.map((i) => {
const [station, se, time] = i.split(",");
const Stations = stationList.map((a) =>
a.filter((d) => d.StationName == station)
);
const StationNumbers =
Stations &&
Stations.reduce((newArray, e) => {
return newArray.concat(e);
}, []).map((d) => d.StationNumber);
return StationNumbers;
});
const [stopStationIDList, setStopStationList] = useState([]);
useEffect(() => {
const x = trainDataWidhThrough.map((i) => {
const [station, se, time] = i.split(",");
const Stations = stationList.map((a) =>
a.filter((d) => d.StationName == station)
);
const StationNumbers =
Stations &&
Stations.reduce((newArray, e) => {
return newArray.concat(e);
}, []).map((d) => d.StationNumber);
return StationNumbers;
});
setStopStationList(x);
}, [trainDataWidhThrough]);
useEffect(() => {
const isCancel = [];
const stopStationList = trainData.map((i,index,array) => {
const stopStationList = trainData.map((i, index, array) => {
const [station, se, time] = i.split(",");
const [nextStation, nextSe, nextTime] = array[index+1]?.split(",") || [];
const [nextStation, nextSe, nextTime] =
array[index + 1]?.split(",") || [];
isCancel.push(se.includes("休") && nextSe.includes("休"));
if (se == "通編") setHaveThrough(true);
return stationList.map((a) => a.filter((d) => d.StationName == station));
@@ -131,8 +137,9 @@ export const EachTrainInfoCore = ({
d.StationNumber > baseStationNumberFirst &&
d.StationNumber < baseStationNumberSecond
) {
allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
allThroughStation.push(
`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`
);
setHaveThrough(true);
reverse = false;
} else {
@@ -140,7 +147,9 @@ export const EachTrainInfoCore = ({
d.StationNumber < baseStationNumberFirst &&
d.StationNumber > baseStationNumberSecond
) {
allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
allThroughStation.push(
`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`
);
setHaveThrough(true);
reverse = true;
}
@@ -252,6 +261,7 @@ export const EachTrainInfoCore = ({
useEffect(() => {
const position = getPosition(currentTrainData);
if (stopStationIDList.length == 0) return;
if (position) {
if (position.length > 1) {
if (position[0] == "-Iyo") {
@@ -259,8 +269,7 @@ export const EachTrainInfoCore = ({
stopStationIDList[
stopStationIDList.findIndex((d) => d.includes("U14")) - 1
][0];
}
else if (position[0] == "+Iyo") {
} else if (position[0] == "+Iyo") {
position[0] =
stopStationIDList[
stopStationIDList.findIndex((d) => d.includes("U14")) + 1
@@ -271,7 +280,7 @@ export const EachTrainInfoCore = ({
stopStationIDList[
stopStationIDList.findIndex((d) => d.includes("U14")) + 1
][0];
}else if (position[1] == "-Iyo") {
} else if (position[1] == "-Iyo") {
position[1] =
stopStationIDList[
stopStationIDList.findIndex((d) => d.includes("U14")) - 1
@@ -281,7 +290,7 @@ export const EachTrainInfoCore = ({
setCurrentPosition(position);
}
}, [currentTrainData]);
}, [currentTrainData,stopStationIDList]);
useEffect(() => {
//列車現在地アイコン表示スイッチ
@@ -294,7 +303,7 @@ export const EachTrainInfoCore = ({
const customTrainType = getTrainType({
type: customTrainDataDetector(data.trainNum, allCustomTrainData).type,
});
const openTrainInfo = (d) => {
const train = customTrainDataDetector(d, allCustomTrainData);
let TrainNumber = "";
@@ -365,9 +374,7 @@ export const EachTrainInfoCore = ({
style: {
maxHeight: isLandscape ? height - 94 : (height / 100) * 70,
backgroundColor:
customTrainType.data === "notService"
? "#777777ff"
: "white",
customTrainType.data === "notService" ? "#777777ff" : "white",
},
}}
shortHeader={

View File

@@ -34,8 +34,13 @@ export const FixedTrain: FC<props> = ({
displaySize,
setDisplaySize,
}) => {
const {fixedPosition, setFixedPosition, currentTrain, getCurrentStationData, getPosition } =
useCurrentTrain();
const {
fixedPosition,
setFixedPosition,
currentTrain,
getCurrentStationData,
getPosition,
} = useCurrentTrain();
const { mapSwitch } = useTrainMenu();
const { allCustomTrainData, allTrainDiagram } = useAllTrainDiagram();
@@ -53,8 +58,7 @@ export const FixedTrain: FC<props> = ({
const stationData = getCurrentStationData(trainID);
if (stationData) {
setTrain(stationData);
}
else{
} else {
alert("追跡していた列車が消えました。追跡を終了します。");
setFixedPosition({ type: null, value: null });
}
@@ -133,22 +137,27 @@ export const FixedTrain: FC<props> = ({
});
setTrainDataWithThrough(mainArray);
}, [allTrainDiagram, stationList, trainID]);
const stopStationIDList = trainDataWidhThrough.map((i) => {
const [station, se, time] = i.split(",");
const Stations = stationList.map((a) =>
a.filter((d) => d.StationName == station)
);
const StationNumbers =
Stations &&
Stations.reduce((newArray, e) => {
return newArray.concat(e);
}, []).map((d) => d.StationNumber);
return StationNumbers;
});
const [stopStationIDList, setStopStationList] = useState([]);
useEffect(() => {
const x = trainDataWidhThrough.map((i) => {
const [station, se, time] = i.split(",");
const Stations = stationList.map((a) =>
a.filter((d) => d.StationName == station)
);
const StationNumbers =
Stations &&
Stations.reduce((newArray, e) => {
return newArray.concat(e);
}, []).map((d) => d.StationNumber);
return StationNumbers;
});
setStopStationList(x);
}, [trainDataWidhThrough]);
const [currentPosition, setCurrentPosition] = useState<string[]>([]);
useEffect(() => {
let position = getPosition(train);
if (stopStationIDList.length == 0) return;
if (position) {
if (position.length > 1) {
if (position[0] == "-Iyo") {
@@ -177,7 +186,7 @@ export const FixedTrain: FC<props> = ({
setCurrentPosition(position);
}
}, [train]);
}, [train,stopStationIDList]);
const [nextStationData, setNextStationData] = useState<StationProps[]>([]);
const [untilStationData, setUntilStationData] = useState<StationProps[]>([]);

View File

@@ -31,10 +31,17 @@ export const findReversalPoints = (array, stopStationIDList) => {
}
}
return false;
} else if (array[0] == "U15" && array[1] == "U14") {
return d[0] == "U13" ? true : false;
} else if (array[0] == "S17" && array[1] == "U14") {
return d[0] == "U14" ? true : false;
}
let returndata = false;
d.forEach((x) => {
console.log(array, x, d);
if (array[0] < x && x < array[1]) {
returndata = true;
} else if (array[0] < x && x == array[1]) {

View File

@@ -112,7 +112,7 @@ export const CurrentTrainProvider: FC<props> = ({ children }) => {
currentTrainData: trainDataType
) => string[] | undefined;
const getPosition: getPositionFuncType = (currentTrainData) => {
//currentTrainData.Pos = "鴨川~端岡"; //test
//currentTrainData = {Pos:"伊予若宮~伊予大洲"}; //test
if (!currentTrainData) return;
if (!currentTrainData?.Pos) return;
if (currentTrainData?.Pos.match("")) {

View File

@@ -127,7 +127,8 @@ export const StationListProvider: FC<Props> = ({ children }) => {
});
}
});
if (bootStationList[0].line === undefined) return "";
console.log(bootStationList[0]);
if (bootStationList[0] === undefined) return "";
return `MoveDisplayStation('${bootStationList[0].line}_${bootStationList[0].station.MyStation}_${bootStationList[0].station.Station_JP}');document.getElementById("disp").insertAdjacentHTML("afterbegin", "<div />");setReload();`;
};