通休編を自動挿入される通過にも適用されるように変更
This commit is contained in:
@@ -11,6 +11,7 @@ type seTypes =
|
||||
| "発"
|
||||
| "着"
|
||||
| "休編"
|
||||
| "通休編"
|
||||
| string;
|
||||
|
||||
type currentTrainDataType = {
|
||||
@@ -45,6 +46,7 @@ export const EachStopList: FC<props> = ({
|
||||
if (!showThrew) {
|
||||
if (se == "通過") return null;
|
||||
if (se == "通編") return null;
|
||||
if (se == "通休編") return null;
|
||||
}
|
||||
const Stations = stationList
|
||||
.map((a) => a.filter((d) => d.StationName == station))
|
||||
@@ -77,6 +79,7 @@ export const EachStopList: FC<props> = ({
|
||||
case "頃編":
|
||||
return ["頃", "community"];
|
||||
case "休編":
|
||||
case "通休編":
|
||||
return ["運休", "community"];
|
||||
default:
|
||||
return [se, "normal"];
|
||||
@@ -87,7 +90,7 @@ export const EachStopList: FC<props> = ({
|
||||
// Array [ "01", "01",]
|
||||
|
||||
const textColor = `#${seType == "community" ? "44f" : "000"}${
|
||||
se == "通過" || se == "通編" ? "5" : ""
|
||||
se == "通過" || se == "通編" || se == "通休編" ? "5" : ""
|
||||
}`;
|
||||
return (
|
||||
<TouchableWithoutFeedback
|
||||
@@ -100,7 +103,7 @@ export const EachStopList: FC<props> = ({
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
backgroundColor: se != "休編" ? "#ffffffc2" : "#474747c2",
|
||||
backgroundColor: (se != "休編" && se != "通休編") ? "#ffffffc2" : "#474747c2",
|
||||
}}
|
||||
>
|
||||
<View
|
||||
@@ -180,7 +183,7 @@ export const EachStopList: FC<props> = ({
|
||||
const StationNumbersBox: FC<{ stn: string; se: seTypes }> = (props) => {
|
||||
const { stn, se } = props;
|
||||
const lineColor = lineColorList[stn.charAt(0)];
|
||||
const hasThrew = se == "通過" || se == "通編" ? "80" : "";
|
||||
const hasThrew = (se == "通過" || se == "通編" || se == "通休編") ? "80" : "";
|
||||
const backgroundColor = `${lineColor}${hasThrew}`;
|
||||
return (
|
||||
<View style={{ backgroundColor, flex: 1 }} key={stn}>
|
||||
@@ -216,7 +219,6 @@ const StationTimeBox: FC<StationTimeBoxType> = (props) => {
|
||||
.set("hour", parseInt(time.split(":")[0]))
|
||||
.set("minute", parseInt(time.split(":")[1]))
|
||||
.add(delay == "入線" || delay == undefined ? 0 : delay, "minute");
|
||||
const timeString = se == "通過" ? "" : dates.format("HH:mm");
|
||||
return (
|
||||
<Text
|
||||
style={{
|
||||
@@ -229,7 +231,7 @@ const StationTimeBox: FC<StationTimeBoxType> = (props) => {
|
||||
fontStyle: seType == "community" ? "italic" : "normal",
|
||||
}}
|
||||
>
|
||||
{se == "通過" ? "レ" : timeString}
|
||||
{se.includes("通") && time == "" ? "レ" : dates.format("HH:mm")}
|
||||
</Text>
|
||||
);
|
||||
};
|
||||
|
@@ -96,15 +96,17 @@ export const EachTrainInfoCore = ({
|
||||
return StationNumbers;
|
||||
});
|
||||
useEffect(() => {
|
||||
const stopStationList = trainData.map((i) => {
|
||||
const isCancel = [];
|
||||
const stopStationList = trainData.map((i,index,array) => {
|
||||
const [station, se, time] = i.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));
|
||||
});
|
||||
const allThroughStationList = stopStationList.map((i, index, array) => {
|
||||
let allThroughStation = [];
|
||||
if (index == array.length - 1) return;
|
||||
|
||||
const firstItem = array[index];
|
||||
const secondItem = array[index + 1];
|
||||
let betweenStationLine = "";
|
||||
@@ -129,7 +131,8 @@ export const EachTrainInfoCore = ({
|
||||
d.StationNumber > baseStationNumberFirst &&
|
||||
d.StationNumber < baseStationNumberSecond
|
||||
) {
|
||||
allThroughStation.push(`${d.Station_JP},通過,`);
|
||||
|
||||
allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
|
||||
setHaveThrough(true);
|
||||
reverse = false;
|
||||
} else {
|
||||
@@ -137,7 +140,7 @@ export const EachTrainInfoCore = ({
|
||||
d.StationNumber < baseStationNumberFirst &&
|
||||
d.StationNumber > baseStationNumberSecond
|
||||
) {
|
||||
allThroughStation.push(`${d.Station_JP},通過,`);
|
||||
allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
|
||||
setHaveThrough(true);
|
||||
reverse = true;
|
||||
}
|
||||
|
@@ -51,7 +51,6 @@ export const FixedTrain: FC<props> = ({
|
||||
}, [currentTrain, trainID]);
|
||||
useEffect(() => {
|
||||
const stationData = getCurrentStationData(trainID);
|
||||
console.log(stationData);
|
||||
if (stationData) {
|
||||
setTrain(stationData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user