メニュー画面でのtrainInfo画面の動作要件準備
This commit is contained in:
parent
ce9dccc158
commit
9fee43d6ff
@ -23,6 +23,7 @@ export const EachTrainInfo = ({
|
|||||||
navigate,
|
navigate,
|
||||||
originalStationList,
|
originalStationList,
|
||||||
openStationACFromEachTrainInfo,
|
openStationACFromEachTrainInfo,
|
||||||
|
from,
|
||||||
}) => {
|
}) => {
|
||||||
const [trainData, setTrainData] = useState([]);
|
const [trainData, setTrainData] = useState([]);
|
||||||
const stationList =
|
const stationList =
|
||||||
@ -106,6 +107,7 @@ export const EachTrainInfo = ({
|
|||||||
|
|
||||||
navigate("trainbase", {
|
navigate("trainbase", {
|
||||||
info: "train.html?tn=" + data.trainNum,
|
info: "train.html?tn=" + data.trainNum,
|
||||||
|
from,
|
||||||
});
|
});
|
||||||
setRef.current?.hide();
|
setRef.current?.hide();
|
||||||
}}
|
}}
|
||||||
@ -175,8 +177,8 @@ export const EachTrainInfo = ({
|
|||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: 40,
|
width: 35,
|
||||||
height: 40,
|
height: 41,
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: 10,
|
left: 10,
|
||||||
top: 0,
|
top: 0,
|
||||||
|
@ -212,6 +212,8 @@ export default function LED_vision(props) {
|
|||||||
currentTrain={currentTrain}
|
currentTrain={currentTrain}
|
||||||
customTrainDataDetector={customTrainDataDetector}
|
customTrainDataDetector={customTrainDataDetector}
|
||||||
navigate={props.navigate}
|
navigate={props.navigate}
|
||||||
|
setTrainInfo={props.setTrainInfo}
|
||||||
|
EachTrainInfoAsSR={props.EachTrainInfoAsSR}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<Footer
|
<Footer
|
||||||
@ -333,19 +335,39 @@ const EachData = ({
|
|||||||
currentTrain,
|
currentTrain,
|
||||||
customTrainDataDetector,
|
customTrainDataDetector,
|
||||||
navigate,
|
navigate,
|
||||||
|
setTrainInfo,
|
||||||
|
EachTrainInfoAsSR,
|
||||||
}) => {
|
}) => {
|
||||||
const getTrainType = (data) => {
|
const getTrainType = (data) => {
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case "Rapid":
|
case "Rapid":
|
||||||
return { color: "aqua", name: "快速" };
|
return { color: "aqua", name: "快速", data: "rapid" };
|
||||||
case "LTDEXP":
|
case "LTDEXP":
|
||||||
return { color: "red", name: "特急" };
|
return { color: "red", name: "特急", data: "express" };
|
||||||
case "NightLTDEXP":
|
case "NightLTDEXP":
|
||||||
return { color: "red", name: "寝台特急" };
|
return { color: "red", name: "寝台特急", data: "express" };
|
||||||
case "Normal":
|
case "Normal":
|
||||||
return { color: "white", name: "普通列車" };
|
return { color: "white", name: "普通列車", data: "normal" };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const openTrainInfo = (d) => {
|
||||||
|
console.log(train);
|
||||||
|
console.log(d);
|
||||||
|
let TrainNumber = "";
|
||||||
|
if (train.trainNumDistance != undefined) {
|
||||||
|
const timeInfo =
|
||||||
|
parseInt(d.train.replace("M", "").replace("D", "")) -
|
||||||
|
train.trainNumDistance;
|
||||||
|
TrainNumber = timeInfo + "号";
|
||||||
|
}
|
||||||
|
setTrainInfo({
|
||||||
|
trainNum: d.train,
|
||||||
|
limited: `${getTrainType(train.type).data}:${
|
||||||
|
train.trainName
|
||||||
|
}${TrainNumber}`,
|
||||||
|
});
|
||||||
|
EachTrainInfoAsSR.current?.show();
|
||||||
|
};
|
||||||
const [train, setTrain] = useState(customTrainDataDetector(d.train));
|
const [train, setTrain] = useState(customTrainDataDetector(d.train));
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTrain(customTrainDataDetector(d.train));
|
setTrain(customTrainDataDetector(d.train));
|
||||||
@ -362,14 +384,7 @@ const EachData = ({
|
|||||||
backgroundColor: "#000",
|
backgroundColor: "#000",
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
}}
|
}}
|
||||||
onPress={() => {
|
onPress={() => openTrainInfo(d)}
|
||||||
if (train.type != "Normal") {
|
|
||||||
navigate("trainbase", {
|
|
||||||
info: "train.html?tn=" + d.train,
|
|
||||||
from: "LED",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<TrainName
|
<TrainName
|
||||||
train={train}
|
train={train}
|
||||||
|
45
menu.js
45
menu.js
@ -151,27 +151,27 @@ export default function Menu(props) {
|
|||||||
}, [selectedCurrentStation]);
|
}, [selectedCurrentStation]);
|
||||||
|
|
||||||
const openStationACFromEachTrainInfo = (stationName) => {
|
const openStationACFromEachTrainInfo = (stationName) => {
|
||||||
EachTrainInfoAsSR.current?.hide();
|
// EachTrainInfoAsSR.current?.hide();
|
||||||
const findStationEachLine = (selectLine) => {
|
// const findStationEachLine = (selectLine) => {
|
||||||
let NearStation = selectLine.filter((d) => d.Station_JP == stationName);
|
// let NearStation = selectLine.filter((d) => d.Station_JP == stationName);
|
||||||
return NearStation;
|
// return NearStation;
|
||||||
};
|
// };
|
||||||
let returnDataBase = lineList
|
// let returnDataBase = lineList
|
||||||
.map((d) => findStationEachLine(originalStationList[d]))
|
// .map((d) => findStationEachLine(originalStationList[d]))
|
||||||
.filter((d) => d.length > 0)
|
// .filter((d) => d.length > 0)
|
||||||
.reduce((pre, current) => {
|
// .reduce((pre, current) => {
|
||||||
pre.push(...current);
|
// pre.push(...current);
|
||||||
return pre;
|
// return pre;
|
||||||
}, []);
|
// }, []);
|
||||||
if (returnDataBase.length) {
|
// if (returnDataBase.length) {
|
||||||
setStationBoardData(returnDataBase);
|
// setStationBoardData(returnDataBase);
|
||||||
sleep(30, function () {
|
// sleep(30, function () {
|
||||||
StationBoardAcSR.current?.show();
|
// StationBoardAcSR.current?.show();
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
setStationBoardData(undefined);
|
// setStationBoardData(undefined);
|
||||||
StationBoardAcSR.current?.hide();
|
// StationBoardAcSR.current?.hide();
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
@ -224,6 +224,8 @@ export default function Menu(props) {
|
|||||||
originalStationList && allStationData[selectedCurrentStation][0]
|
originalStationList && allStationData[selectedCurrentStation][0]
|
||||||
}
|
}
|
||||||
navigate={navigate}
|
navigate={navigate}
|
||||||
|
setTrainInfo={setTrainInfo}
|
||||||
|
EachTrainInfoAsSR={EachTrainInfoAsSR}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<JRSTraInfoBox
|
<JRSTraInfoBox
|
||||||
@ -266,6 +268,7 @@ export default function Menu(props) {
|
|||||||
navigate={navigate}
|
navigate={navigate}
|
||||||
originalStationList={originalStationList}
|
originalStationList={originalStationList}
|
||||||
openStationACFromEachTrainInfo={openStationACFromEachTrainInfo}
|
openStationACFromEachTrainInfo={openStationACFromEachTrainInfo}
|
||||||
|
from="LED"
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user