Merge commit 'bb1ee2666e5c91819bc3330128a9636b5e2ad753' into develop
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import React, { FC } from "react";
|
||||
import { View, Text, TouchableWithoutFeedback, Alert } from "react-native";
|
||||
import { useAllTrainDiagram } from "@/stateBox/useAllTrainDiagram";
|
||||
|
||||
export const DataConnectedButton: FC<{
|
||||
i: string;
|
||||
openTrainInfo: (trainNum: string) => void;
|
||||
}> = ({ i, openTrainInfo }) => {
|
||||
const [station, se, time] = i.split(",");
|
||||
const { keyList } = useAllTrainDiagram();
|
||||
// 列番が有効かどうかをチェックする関数
|
||||
const isValidTrainNumber = (trainNum: string): boolean => {
|
||||
return keyList.includes(trainNum);
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableWithoutFeedback
|
||||
onPress={() => {
|
||||
// timeの文字列が列番として有効かを検証する
|
||||
if (!isValidTrainNumber(time)) {
|
||||
Alert.alert(
|
||||
"列番が見つかりません",
|
||||
`列番「${time}」は時刻表に存在しません。`,
|
||||
[{ text: "OK" }]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
openTrainInfo(time);
|
||||
}}
|
||||
key={station + time}
|
||||
>
|
||||
<View style={{ flexDirection: "row", backgroundColor: "#f5f5f5" }}>
|
||||
<View
|
||||
style={{
|
||||
padding: 8,
|
||||
flexDirection: "row",
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: "#f0f0f0",
|
||||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
width: 35,
|
||||
position: "relative",
|
||||
marginHorizontal: 15,
|
||||
flexDirection: "row",
|
||||
height: "10%",
|
||||
}}
|
||||
/>
|
||||
<Text style={{ fontSize:16, fontFamily: "DiaPro" }}>
|
||||
{se === "連" ? "⬐" : "↳"}
|
||||
</Text>
|
||||
<Text style={{ fontSize: 20, color: "#0000EE" }}>{time}</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={{ fontSize: 18, width: 50 }}>
|
||||
{se === "連" ? "連結" : "解結"}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
);
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
import React, { FC } from "react";
|
||||
import { View, Text, TouchableWithoutFeedback } from "react-native";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { Linking } from "react-native";
|
||||
export const DataFromButton: FC<{ i: string }> = ({ i }) => {
|
||||
const [station, se, time] = i.split(",");
|
||||
return (
|
||||
<TouchableWithoutFeedback
|
||||
onPress={() => Linking.openURL(time)}
|
||||
key={station}
|
||||
>
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
<View
|
||||
style={{
|
||||
padding: 8,
|
||||
flexDirection: "row",
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: "#f0f0f0",
|
||||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<Text style={{ fontSize: 20 }}>{station}</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={{ fontSize: 18 }}>
|
||||
提供元
|
||||
<MaterialCommunityIcons
|
||||
name={"open-in-new"}
|
||||
color="black"
|
||||
size={20}
|
||||
/>
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
);
|
||||
};
|
||||
@@ -4,11 +4,11 @@ import dayjs from "dayjs";
|
||||
import lineColorList from "../../../assets/originData/lineColorList";
|
||||
import { trainDataType } from "@/lib/trainPositionTextArray";
|
||||
import { getStopListColors } from "./colorScheme";
|
||||
import {
|
||||
isCanceledSe,
|
||||
isThroughSe,
|
||||
import {
|
||||
isCanceledSe,
|
||||
isThroughSe,
|
||||
isCommunitySe,
|
||||
parseSeString
|
||||
parseSeString,
|
||||
} from "@/utils/seUtils";
|
||||
import type { SeTypes } from "@/types";
|
||||
|
||||
@@ -96,9 +96,9 @@ export const EachStopList: FC<props> = ({
|
||||
"StationNumber": "B01",
|
||||
},
|
||||
] */
|
||||
const StationNumbers = Stations
|
||||
.filter((d) => d.StationNumber != null)
|
||||
.map((d) => d.StationNumber as string);
|
||||
const StationNumbers = Stations.filter((d) => d.StationNumber != null).map(
|
||||
(d) => d.StationNumber as string
|
||||
);
|
||||
// SE文字列を表示用に変換
|
||||
const [seString, seType] = parseSeString(se);
|
||||
|
||||
@@ -106,26 +106,51 @@ export const EachStopList: FC<props> = ({
|
||||
const isThrough = isThroughSe(se);
|
||||
const isCanceled = isCanceledSe(se);
|
||||
const isCommunity = isCommunitySe(se);
|
||||
const isDelayed = currentTrainData?.delay !== undefined &&
|
||||
currentTrainData?.delay !== "入線" &&
|
||||
currentTrainData?.delay > 0;
|
||||
|
||||
const colors = getStopListColors(isThrough, isCommunity, isCanceled, isDelayed, isNotService);
|
||||
const isDelayed =
|
||||
currentTrainData?.delay !== undefined &&
|
||||
currentTrainData?.delay !== "入線" &&
|
||||
currentTrainData?.delay > 0;
|
||||
|
||||
const colors = getStopListColors(
|
||||
isThrough,
|
||||
isCommunity,
|
||||
isCanceled,
|
||||
isDelayed,
|
||||
isNotService
|
||||
);
|
||||
// 打ち消し線用の通常色(遅延していない時の色)
|
||||
const normalColors = getStopListColors(isThrough, isCommunity, isCanceled, false, isNotService);
|
||||
const normalColors = getStopListColors(
|
||||
isThrough,
|
||||
isCommunity,
|
||||
isCanceled,
|
||||
false,
|
||||
isNotService
|
||||
);
|
||||
|
||||
// beforeSameStationData用の色設定
|
||||
// 通過系と編(コミュニティ)はbeforeのseから判定、休(運休)は現在のseから判定
|
||||
let beforeTimeTextColor = colors.timeText;
|
||||
let beforeNormalTimeTextColor = normalColors.timeText;
|
||||
|
||||
|
||||
if (beforeSameStationData) {
|
||||
const beforeSe = beforeSameStationData[1];
|
||||
const beforeIsThrough = isThroughSe(beforeSe);
|
||||
const beforeIsCommunity = isCommunitySe(beforeSe);
|
||||
// 運休判定は現在のseを使用(本体と同じ背景色なので)
|
||||
const beforeColors = getStopListColors(beforeIsThrough, beforeIsCommunity, isCanceled, isDelayed, isNotService);
|
||||
const beforeNormalColors = getStopListColors(beforeIsThrough, beforeIsCommunity, isCanceled, false, isNotService);
|
||||
const beforeColors = getStopListColors(
|
||||
beforeIsThrough,
|
||||
beforeIsCommunity,
|
||||
isCanceled,
|
||||
isDelayed,
|
||||
isNotService
|
||||
);
|
||||
const beforeNormalColors = getStopListColors(
|
||||
beforeIsThrough,
|
||||
beforeIsCommunity,
|
||||
isCanceled,
|
||||
false,
|
||||
isNotService
|
||||
);
|
||||
beforeTimeTextColor = beforeColors.timeText;
|
||||
beforeNormalTimeTextColor = beforeNormalColors.timeText;
|
||||
}
|
||||
@@ -136,7 +161,7 @@ export const EachStopList: FC<props> = ({
|
||||
openStationACFromEachTrainInfo &&
|
||||
openStationACFromEachTrainInfo(station)
|
||||
}
|
||||
key={station+se+time}
|
||||
key={station + se + time}
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
@@ -182,16 +207,16 @@ export const EachStopList: FC<props> = ({
|
||||
<View style={{ flex: 1 }} />
|
||||
</View>
|
||||
<View style={{ flex: 1 }} />
|
||||
<View style={{ position: "relative", width: 0, alignItems: "flex-end" }}>
|
||||
<View
|
||||
style={{ position: "relative", width: 0, alignItems: "flex-end" }}
|
||||
>
|
||||
{points && (
|
||||
<Text style={{ fontSize: 20, position: "absolute", left: -70 }}>
|
||||
🚊
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
<View
|
||||
style={{ flexDirection: "column", alignItems: "flex-end" }}
|
||||
>
|
||||
<View style={{ flexDirection: "column", alignItems: "flex-end" }}>
|
||||
{beforeSameStationData && (
|
||||
<TimeText
|
||||
isDouble={!!beforeSameStationData || !!afterSameStationData}
|
||||
@@ -199,7 +224,7 @@ export const EachStopList: FC<props> = ({
|
||||
currentTrainData={currentTrainData}
|
||||
se={beforeSameStationData[1]}
|
||||
time={beforeSameStationData[2]}
|
||||
key={"before"+beforeSameStationData[2]}
|
||||
key={"before" + beforeSameStationData[2]}
|
||||
textColor={beforeTimeTextColor}
|
||||
normalTextColor={beforeNormalTimeTextColor}
|
||||
/>
|
||||
@@ -209,7 +234,7 @@ export const EachStopList: FC<props> = ({
|
||||
currentTrainData={currentTrainData}
|
||||
se={se}
|
||||
time={time}
|
||||
key={se+time}
|
||||
key={se + time}
|
||||
textColor={colors.timeText}
|
||||
normalTextColor={normalColors.timeText}
|
||||
/>
|
||||
@@ -228,9 +253,17 @@ const TimeText: FC<{
|
||||
time: string;
|
||||
textColor: string;
|
||||
normalTextColor: string;
|
||||
}> = ({ isDouble, currentTrainData, se, time, isBefore=false, textColor, normalTextColor }) => {
|
||||
}> = ({
|
||||
isDouble,
|
||||
currentTrainData,
|
||||
se,
|
||||
time,
|
||||
isBefore = false,
|
||||
textColor,
|
||||
normalTextColor,
|
||||
}) => {
|
||||
const [seString, seType] = parseSeString(se);
|
||||
|
||||
|
||||
return (
|
||||
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
||||
{!!currentTrainData?.delay &&
|
||||
@@ -243,7 +276,7 @@ const TimeText: FC<{
|
||||
color: normalTextColor,
|
||||
width: 60,
|
||||
position: "absolute",
|
||||
right: isBefore ? 125:120,
|
||||
right: isBefore ? 125 : 120,
|
||||
textAlign: "right",
|
||||
textDecorationLine: "line-through",
|
||||
fontStyle: seType == "community" ? "italic" : "normal",
|
||||
@@ -325,7 +358,7 @@ const StationTimeBox: FC<StationTimeBoxType> = (props) => {
|
||||
.set("hour", parseInt(time.split(":")[0]))
|
||||
.set("minute", parseInt(time.split(":")[1]))
|
||||
.add(delay == "入線" || delay == undefined ? 0 : delay, "minute");
|
||||
|
||||
|
||||
return (
|
||||
<Text
|
||||
style={{
|
||||
|
||||
@@ -13,7 +13,7 @@ import { getTrainType } from "../../lib/getTrainType";
|
||||
import { customTrainDataDetector } from "../custom-train-data";
|
||||
import { useDeviceOrientationChange } from "../../stateBox/useDeviceOrientationChange";
|
||||
import { EachStopList } from "./EachTrainInfo/EachStopList";
|
||||
import { DataFromButton } from "./EachTrainInfo/DataFromButton";
|
||||
import { DataConnectedButton } from "./EachTrainInfo/DataConnectedButton";
|
||||
import { DynamicHeaderScrollView } from "../DynamicHeaderScrollView";
|
||||
import { LongHeader } from "./EachTrainInfo/LongHeader";
|
||||
import { ShortHeader } from "./EachTrainInfo/ShortHeader";
|
||||
@@ -47,8 +47,8 @@ export const EachTrainInfoCore = ({
|
||||
const { isLandscape } = useDeviceOrientationChange();
|
||||
|
||||
const scrollHandlers = actionSheetRef
|
||||
//@ts-ignore
|
||||
? useScrollHandlers("scrollview-1", actionSheetRef)
|
||||
? //@ts-ignore
|
||||
useScrollHandlers("scrollview-1", actionSheetRef)
|
||||
: null;
|
||||
// Custom hooks for data management
|
||||
const { trainData, setTrainData, trueTrainID } = useTrainDiagramData(
|
||||
@@ -244,8 +244,14 @@ export const EachTrainInfoCore = ({
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
{trainDataWithThrough.map((item, index, array) =>
|
||||
item.split(",")[1] === "提" ? (
|
||||
<DataFromButton i={item} key={`${item}-data`} />
|
||||
item.split(",")[1] === "連" || item.split(",")[1] === "解" ? (
|
||||
<DataConnectedButton
|
||||
i={item}
|
||||
key={`${item}-data`}
|
||||
openTrainInfo={openTrainInfo}
|
||||
/>
|
||||
) : item.split(",")[1].includes(".") ? (
|
||||
<></>
|
||||
) : (
|
||||
<EachStopList
|
||||
i={item}
|
||||
|
||||
@@ -216,13 +216,20 @@ export const HeaderText: FC<Props> = ({
|
||||
size={20}
|
||||
color="white"
|
||||
style={{ marginLeft: 5 }}
|
||||
onPress={() =>
|
||||
onPress={() => {
|
||||
// 列番が奇数か偶数かで表示順を逆転
|
||||
const trainNumInt = parseInt(trainNum, 10);
|
||||
const ops = todayOperation ? [...todayOperation] : [];
|
||||
const displayOps = trainNumInt % 2 === 0 ? ops : ops.reverse();
|
||||
const directionText = trainNumInt % 2 === 0
|
||||
? '←進行方向'
|
||||
: '進行方向→';
|
||||
alert(
|
||||
`[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n使用車両情報:\n${todayOperation
|
||||
?.map((op) => op.unit_ids)
|
||||
.join("+")}\n投稿者メモ:\n${uwasa || "なし"}`
|
||||
)
|
||||
}
|
||||
`[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n使用車両情報:\n${displayOps
|
||||
.map((op) => op.unit_ids)
|
||||
.join("+")}\n${directionText}\n投稿者メモ:\n${uwasa || "なし"}`
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { SwitchArea } from "../atom/SwitchArea";
|
||||
import { useNotification } from "../../stateBox/useNotifications";
|
||||
import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem";
|
||||
|
||||
const versionCode = "6.1.9.3"; // Update this version code as needed
|
||||
const versionCode = "6.1.9.4"; // Update this version code as needed
|
||||
|
||||
export const SettingTopPage = ({
|
||||
testNFC,
|
||||
|
||||
Reference in New Issue
Block a user