Merge commit '14c5800aa2e65aa0ee0c64b8ccfa8f21f8124331' into patch/6.x
This commit is contained in:
@@ -7,9 +7,11 @@ import { getStationList2 } from "../../../lib/getStationList";
|
||||
import { useCurrentTrain } from "../../../stateBox/useCurrentTrain";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { trainPosition } from "../../../lib/trainPositionTextArray";
|
||||
import { TrainPositionDataPush } from "../../発車時刻表/LED_inside_Component/TrainPositionDataPush";
|
||||
import { StationPosPushDialog } from "../../発車時刻表/LED_inside_Component/TrainPositionDataPush";
|
||||
import { getStationID } from "../../../lib/eachTrainInfoCoreLib/getStationData";
|
||||
import { useStationList } from "../../../stateBox/useStationList";
|
||||
import { useAllTrainDiagram } from "@/stateBox/useAllTrainDiagram";
|
||||
import { customTrainDataDetector } from "@/components/custom-train-data";
|
||||
|
||||
export const TrainDataView = ({
|
||||
currentTrainData,
|
||||
@@ -24,11 +26,22 @@ export const TrainDataView = ({
|
||||
const { width, height } = useWindowDimensions();
|
||||
const { isLandscape } = useDeviceOrientationChange();
|
||||
const { inject } = useCurrentTrain();
|
||||
|
||||
const { allCustomTrainData } = useAllTrainDiagram();
|
||||
const [mapsStationData, setMapsStationData] = useState(undefined);
|
||||
|
||||
const [platformNumber, setPlatformNumber] = useState();
|
||||
const [lineNumber, setLineNumber] = useState();
|
||||
const [platformDescription, setPlatformDescription] = useState();
|
||||
type data = {
|
||||
type: string;
|
||||
lineNumber: string;
|
||||
platformNumber: string;
|
||||
position: string;
|
||||
stationName: string;
|
||||
description: string;
|
||||
};
|
||||
const [database, setDatabase] = useState<data>(null);
|
||||
useEffect(() => {
|
||||
//currentTrainData.Pos = "鴨川~端岡"; //test
|
||||
if (!currentTrainData) return;
|
||||
@@ -46,6 +59,7 @@ export const TrainDataView = ({
|
||||
position,
|
||||
description,
|
||||
} = data;
|
||||
setDatabase(data);
|
||||
if (type == "Station") {
|
||||
setLineNumber(lineNumber);
|
||||
setPlatformNumber(platformNumber);
|
||||
@@ -61,18 +75,58 @@ export const TrainDataView = ({
|
||||
getStationList2().then(setMapsStationData);
|
||||
}, []);
|
||||
const onLine = !!currentPosition?.toString().length;
|
||||
|
||||
const [trainNumber, setTrainNumber] = useState(currentTrainData?.num);
|
||||
useEffect(() => {
|
||||
const {
|
||||
TrainNumberOverride,
|
||||
} = customTrainDataDetector(currentTrainData?.num, allCustomTrainData);
|
||||
if (!TrainNumberOverride) return;
|
||||
setTrainNumber(TrainNumberOverride);
|
||||
}, [currentTrainData?.num, allCustomTrainData]);
|
||||
// 投稿システム関係
|
||||
// Dialog表示関係
|
||||
const [dialog, setDialog] = useState(false);
|
||||
const [posInput, setPosInput] = useState("");
|
||||
const [descInput, setDescInput] = useState("");
|
||||
const [stationNumberInput, setStationNumberInput] = useState("");
|
||||
const [lineInput, setLineInput] = useState("");
|
||||
const [deleteDialog, setDeleteDialog] = useState(false);
|
||||
//固定値
|
||||
const [PosNum, setPosNum] = useState<number | undefined>();
|
||||
const [Pos, setPos] = useState<string>("");
|
||||
const [Line, setLine] = useState<string>("");
|
||||
const [StationNum, setStationNum] = useState<string>("");
|
||||
|
||||
//編集情報
|
||||
const [lineInput, setLineInput] = useState<string>("");
|
||||
const [posInput, setPosInput] = useState<string>("");
|
||||
const [descInput, setDescInput] = useState<string>("");
|
||||
|
||||
const openEditWindow = () => {
|
||||
const { isBetween, Pos } = trainPosition(currentTrainData);
|
||||
if (isBetween === true) return;
|
||||
//固定値
|
||||
setPosNum(currentTrainData?.PosNum);
|
||||
setPos(currentTrainData?.Pos);
|
||||
setLine(currentTrainData?.Line);
|
||||
setStationNum(getStationID(currentTrainData?.Pos, stationList));
|
||||
|
||||
//入力欄
|
||||
setPosInput(database?.platformNumber?.toString() || "");
|
||||
setDescInput(database?.description || "");
|
||||
setLineInput(database?.lineNumber?.toString() || "");
|
||||
setDialog(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<TrainPositionDataPush
|
||||
<StationPosPushDialog
|
||||
// Dialog表示関係
|
||||
dialog={dialog}
|
||||
setDialog={setDialog}
|
||||
currentTrainData={currentTrainData}
|
||||
stationNumberInput={stationNumberInput}
|
||||
// 固定情報
|
||||
PosNum={PosNum}
|
||||
Pos={Pos}
|
||||
Line={Line}
|
||||
StationNum={StationNum}
|
||||
// 入力欄
|
||||
lineInput={lineInput}
|
||||
setLineInput={setLineInput}
|
||||
posInput={posInput}
|
||||
@@ -92,29 +146,7 @@ export const TrainDataView = ({
|
||||
<TouchableOpacity
|
||||
style={{ flex: 1, flexDirection: "row" }}
|
||||
//disabled={!onLine}
|
||||
onLongPress={() => {
|
||||
const { isBetween, Pos } = trainPosition(currentTrainData);
|
||||
if (isBetween === true) {
|
||||
if (
|
||||
platformNumber == undefined &&
|
||||
platformDescription == undefined
|
||||
)
|
||||
return;
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
setPosInput(platformNumber?.toString() || "");
|
||||
setLineInput(lineNumber?.toString() || "");
|
||||
} else {
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
setDescInput(platformDescription || "");
|
||||
setPosInput(platformNumber?.toString() || "");
|
||||
setLineInput(lineNumber?.toString() || "");
|
||||
setDialog(true);
|
||||
}
|
||||
}}
|
||||
onLongPress={openEditWindow}
|
||||
onPress={() => {
|
||||
if (!onLine) return;
|
||||
const test = [];
|
||||
@@ -172,7 +204,7 @@ export const TrainDataView = ({
|
||||
}}
|
||||
>
|
||||
{nearTrainIDList.length == 0 ? (
|
||||
<StateBox mode={mode} title="列番" text={currentTrainData?.num} />
|
||||
<StateBox mode={mode} title="列番" text={trainNumber} />
|
||||
) : (
|
||||
<StateBox
|
||||
mode={mode}
|
@@ -12,6 +12,7 @@ import { useAllTrainDiagram } from "@/stateBox/useAllTrainDiagram";
|
||||
import { useNotification } from "@/stateBox/useNotifications";
|
||||
import { getStringConfig } from "@/lib/getStringConfig";
|
||||
import { FontAwesome } from "@expo/vector-icons";
|
||||
import { getPDFViewURL } from "@/lib/getPdfViewURL";
|
||||
|
||||
type Props = {
|
||||
data: { trainNum: string; limited: string };
|
||||
@@ -59,9 +60,18 @@ export const HeaderText: FC<Props> = ({
|
||||
isEdit,
|
||||
uwasa,
|
||||
vehicleFormation,
|
||||
trainInfoUrl,
|
||||
] = useMemo(() => {
|
||||
const { type, trainName, trainNumDistance, infogram, isEdit, uwasa, vehicleFormation } =
|
||||
customTrainDataDetector(trainNum, allCustomTrainData);
|
||||
const {
|
||||
type,
|
||||
trainName,
|
||||
trainNumDistance,
|
||||
infogram,
|
||||
isEdit,
|
||||
uwasa,
|
||||
vehicleFormation,
|
||||
trainInfoUrl,
|
||||
} = customTrainDataDetector(trainNum, allCustomTrainData);
|
||||
const [typeString, fontAvailable, isOneMan] = getStringConfig(
|
||||
type,
|
||||
trainNum
|
||||
@@ -81,7 +91,8 @@ export const HeaderText: FC<Props> = ({
|
||||
infogram,
|
||||
isEdit,
|
||||
uwasa,
|
||||
vehicleFormation
|
||||
vehicleFormation,
|
||||
trainInfoUrl,
|
||||
];
|
||||
case trainData[trainData.length - 1] === undefined:
|
||||
return [
|
||||
@@ -92,7 +103,8 @@ export const HeaderText: FC<Props> = ({
|
||||
infogram,
|
||||
isEdit,
|
||||
uwasa,
|
||||
vehicleFormation
|
||||
vehicleFormation,
|
||||
trainInfoUrl,
|
||||
];
|
||||
default:
|
||||
// 行先がある場合は、行先を取得
|
||||
@@ -106,7 +118,8 @@ export const HeaderText: FC<Props> = ({
|
||||
infogram,
|
||||
isEdit,
|
||||
uwasa,
|
||||
vehicleFormation
|
||||
vehicleFormation,
|
||||
trainInfoUrl,
|
||||
];
|
||||
}
|
||||
}, [trainData]);
|
||||
@@ -122,11 +135,20 @@ export const HeaderText: FC<Props> = ({
|
||||
<TouchableOpacity
|
||||
style={{ borderRadius: 5, flexDirection: "row", alignItems: "center" }}
|
||||
onLongPress={() => {
|
||||
if (!updatePermission) return;
|
||||
const uri = `https://jr-shikoku-data-post-system.pages.dev?trainNum=${trainNum}&token=${expoPushToken}`;
|
||||
navigate("generalWebView", { uri, useExitButton: false });
|
||||
SheetManager.hide("EachTrainInfo");
|
||||
}}
|
||||
disabled={!updatePermission}
|
||||
onPress={() => {
|
||||
if (!trainInfoUrl) return;
|
||||
const uri = trainInfoUrl.includes("pdf")
|
||||
? getPDFViewURL(trainInfoUrl)
|
||||
: trainInfoUrl;
|
||||
navigate("generalWebView", { uri, useExitButton: true });
|
||||
SheetManager.hide("EachTrainInfo");
|
||||
}}
|
||||
disabled={!(!!updatePermission || !!trainInfoUrl)}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
@@ -142,20 +164,22 @@ export const HeaderText: FC<Props> = ({
|
||||
{isOneMan && <OneManText />}
|
||||
<Text style={textConfig}>{trainName}</Text>
|
||||
<InfogramText infogram={infogram} />
|
||||
{isEdit && (
|
||||
<FontAwesome
|
||||
name="commenting-o"
|
||||
size={20}
|
||||
color="white"
|
||||
style={{ marginLeft: 5 }}
|
||||
onPress={() =>
|
||||
alert(
|
||||
`[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n使用車両情報:\n${vehicleFormation}\n投稿者メモ:\n${uwasa || "なし"}`
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
{isEdit && (
|
||||
<FontAwesome
|
||||
name="commenting-o"
|
||||
size={20}
|
||||
color="white"
|
||||
style={{ marginLeft: 5 }}
|
||||
onPress={() =>
|
||||
alert(
|
||||
`[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n使用車両情報:\n${vehicleFormation}\n投稿者メモ:\n${
|
||||
uwasa || "なし"
|
||||
}`
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={textConfig}>
|
||||
|
@@ -164,7 +164,9 @@ export default function AllTrainDiagramView() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return d.includes(input);
|
||||
const { img, trainName, type, trainNumDistance, infogram } =
|
||||
customTrainDataDetector(d, allCustomTrainData);
|
||||
return d.includes(input) || trainName.includes(input);
|
||||
})}
|
||||
renderItem={({ item }) => <Item {...{ openTrainInfo, id: item }} />}
|
||||
ListEmptyComponent={
|
||||
@@ -277,7 +279,7 @@ export default function AllTrainDiagramView() {
|
||||
}}
|
||||
>
|
||||
<TextInput
|
||||
placeholder="列番を入力してフィルタリングします。"
|
||||
placeholder="列番・列車名を入力してフィルタリングします。"
|
||||
onFocus={() => setKeyBoardVisible(true)}
|
||||
onEndEditing={() => {}}
|
||||
onChange={(ret) => setInput(ret.nativeEvent.text)}
|
||||
|
@@ -17,7 +17,7 @@ import { SwitchArea } from "../atom/SwitchArea";
|
||||
import { useNotification } from "../../stateBox/useNotifications";
|
||||
import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem";
|
||||
|
||||
const versionCode = "6.1.4"; // Update this version code as needed
|
||||
const versionCode = "6.1.5"; // Update this version code as needed
|
||||
|
||||
export const SettingTopPage = ({
|
||||
testNFC,
|
||||
|
@@ -12,8 +12,8 @@ import { StatusAndDelay } from "./LED_inside_Component/StatusAndDelay";
|
||||
import { TrainName } from "./LED_inside_Component/TrainName";
|
||||
import { customTrainDataDetector } from "../custom-train-data";
|
||||
import { TrainPosition } from "./LED_inside_Component/TrainPosition";
|
||||
import { TrainPositionDataPush } from "./LED_inside_Component/TrainPositionDataPush";
|
||||
import { TrainPositionDataDelete } from "./LED_inside_Component/TrainPositionDataDelete";
|
||||
import { StationPosPushDialog } from "./LED_inside_Component/TrainPositionDataPush";
|
||||
import { StationPosDeleteDialog } from "./LED_inside_Component/TrainPositionDataDelete";
|
||||
import { useStationList } from "../../stateBox/useStationList";
|
||||
import useInterval from "@/lib/useInterval";
|
||||
import dayjs from "dayjs";
|
||||
@@ -114,16 +114,22 @@ export const EachData: FC<Props> = (props) => {
|
||||
station.Station_JP
|
||||
)}`;
|
||||
|
||||
const [platformNumber, setPlatformNumber] = useState<number>();
|
||||
const [platformDescription, setPlatformDescription] = useState<string>();
|
||||
|
||||
// 投稿システム関係
|
||||
// Dialog表示関係
|
||||
const [dialog, setDialog] = useState(false);
|
||||
const [deleteDialog, setDeleteDialog] = useState(false);
|
||||
const [posInput, setPosInput] = useState("");
|
||||
const [lineInput, setLineInput] = useState("");
|
||||
const [descInput, setDescInput] = useState("");
|
||||
const [stationInput, setStationInput] = useState("");
|
||||
const [stationNumberInput, setStationNumberInput] = useState("");
|
||||
//固定値
|
||||
const [PosNum, setPosNum] = useState<number | undefined>();
|
||||
const [Pos, setPos] = useState<string>("");
|
||||
const [Line, setLine] = useState<string>("");
|
||||
const [StationNum, setStationNum] = useState<string>("");
|
||||
|
||||
//編集情報
|
||||
const [lineInput, setLineInput] = useState<string>("");
|
||||
const [posInput, setPosInput] = useState<string>("");
|
||||
const [descInput, setDescInput] = useState<string>("");
|
||||
|
||||
|
||||
const [isShow, setIsShow] = useState(true);
|
||||
const [isDepartureNow, setIsDepartureNow] = useState(false);
|
||||
@@ -147,24 +153,30 @@ export const EachData: FC<Props> = (props) => {
|
||||
}, 800);
|
||||
return (
|
||||
<>
|
||||
<TrainPositionDataDelete
|
||||
<StationPosDeleteDialog
|
||||
dialog={deleteDialog}
|
||||
setDialog={setDeleteDialog}
|
||||
{...{ currentTrainData, stationInput, stationNumberInput }}
|
||||
Pos={Pos}
|
||||
PosNum={PosNum}
|
||||
Line={Line}
|
||||
StationNum={StationNum}
|
||||
/>
|
||||
<TrainPositionDataPush
|
||||
<StationPosPushDialog
|
||||
// Dialog表示関係
|
||||
dialog={dialog}
|
||||
setDialog={setDialog}
|
||||
{...{
|
||||
currentTrainData,
|
||||
stationNumberInput,
|
||||
lineInput,
|
||||
setLineInput,
|
||||
posInput,
|
||||
setPosInput,
|
||||
descInput,
|
||||
setDescInput
|
||||
}}
|
||||
// 固定情報
|
||||
PosNum={PosNum}
|
||||
Pos={Pos}
|
||||
Line={Line}
|
||||
StationNum={StationNum}
|
||||
// 入力欄
|
||||
lineInput={lineInput}
|
||||
setLineInput={setLineInput}
|
||||
posInput={posInput}
|
||||
setPosInput={setPosInput}
|
||||
descInput={descInput}
|
||||
setDescInput={setDescInput}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
@@ -203,20 +215,22 @@ export const EachData: FC<Props> = (props) => {
|
||||
)}
|
||||
{trainDescriptionSwitch && (
|
||||
<TrainPosition
|
||||
// LED表示関係
|
||||
trainIDSwitch={trainIDSwitch}
|
||||
currentTrainData={currentTrainData}
|
||||
setStationInput={setStationInput}
|
||||
setStationNumberInput={setStationNumberInput}
|
||||
setDescInput={setDescInput}
|
||||
setPosInput={setPosInput}
|
||||
// ポップアップ表示関係
|
||||
setDialog={setDialog}
|
||||
setDeleteDialog={setDeleteDialog}
|
||||
setPlatformDescription={setPlatformDescription}
|
||||
setPlatformNumber={setPlatformNumber}
|
||||
platformDescription={platformDescription}
|
||||
platformNumber={platformNumber}
|
||||
lineInput={lineInput}
|
||||
// 固定情報
|
||||
setPos={setPos}
|
||||
setPosNum={setPosNum}
|
||||
setLine={setLine}
|
||||
setStationNum={setStationNum}
|
||||
|
||||
//編集機能関係
|
||||
setLineInput={setLineInput}
|
||||
setPosInput={setPosInput}
|
||||
setDescInput={setDescInput}
|
||||
key={d.train + "-trainPosition"}
|
||||
/>
|
||||
)}
|
||||
|
@@ -14,38 +14,46 @@ const descriptionStyle: TextStyle = {
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// LED表示関係
|
||||
numberOfLines?: number;
|
||||
trainIDSwitch: boolean;
|
||||
currentTrainData: trainDataType;
|
||||
setStationInput: (station: string) => void;
|
||||
setStationNumberInput: (station: string) => void;
|
||||
setDescInput: (desc: string) => void;
|
||||
setPosInput: (pos: string) => void;
|
||||
//ポップアップ表示関係
|
||||
setDialog: (dialog: boolean) => void;
|
||||
setDeleteDialog: (dialog: boolean) => void;
|
||||
platformDescription: string;
|
||||
platformNumber: string;
|
||||
setPlatformDescription: (desc: string) => void;
|
||||
setPlatformNumber: (num: string) => void;
|
||||
lineInput: string;
|
||||
|
||||
//固定値設定
|
||||
setPos: React.Dispatch<React.SetStateAction<string>>
|
||||
setPosNum: React.Dispatch<React.SetStateAction<number>>;
|
||||
setLine: React.Dispatch<React.SetStateAction<string>>;
|
||||
setStationNum: React.Dispatch<React.SetStateAction<string>>;
|
||||
|
||||
//編集機能関係
|
||||
setLineInput: (line: string) => void;
|
||||
setPosInput: (pos: string) => void;
|
||||
setDescInput: (desc: string) => void;
|
||||
};
|
||||
|
||||
export const TrainPosition: FC<Props> = ({
|
||||
// LED表示関係
|
||||
numberOfLines = 0,
|
||||
trainIDSwitch,
|
||||
currentTrainData,
|
||||
setStationInput,
|
||||
setStationNumberInput,
|
||||
setDescInput,
|
||||
setPosInput,
|
||||
//ポップアップ表示関係
|
||||
setDialog,
|
||||
setDeleteDialog,
|
||||
setPlatformDescription,
|
||||
setPlatformNumber,
|
||||
platformDescription,
|
||||
platformNumber,
|
||||
|
||||
//固定値設定
|
||||
setPos,
|
||||
setPosNum,
|
||||
setLine,
|
||||
setStationNum,
|
||||
|
||||
//編集機能関係
|
||||
setLineInput,
|
||||
setPosInput,
|
||||
setDescInput,
|
||||
|
||||
}) => {
|
||||
const { stationList } = useStationList();
|
||||
type data = {
|
||||
@@ -94,6 +102,31 @@ export const TrainPosition: FC<Props> = ({
|
||||
setMasterText("");
|
||||
};
|
||||
}, [currentTrainData?.PosNum, currentTrainData?.Line, currentTrainData?.Pos]);
|
||||
//editWindow向けにfixした情報を送信
|
||||
const openEditWindow = () => {
|
||||
const { isBetween, Pos } = trainPosition(currentTrainData);
|
||||
|
||||
//固定値
|
||||
setPosNum(currentTrainData?.PosNum);
|
||||
setPos(currentTrainData?.Pos);
|
||||
setLine(currentTrainData?.Line);
|
||||
setStationNum(getStationID(currentTrainData?.Pos, stationList));
|
||||
|
||||
//入力欄
|
||||
if (isBetween === true) {
|
||||
if (
|
||||
database?.platformNumber == undefined &&
|
||||
database?.description == undefined
|
||||
)
|
||||
return;
|
||||
setDeleteDialog(true);
|
||||
} else {
|
||||
setPosInput(database?.platformNumber?.toString() || "");
|
||||
setDescInput(database?.description || "");
|
||||
setLineInput(database?.lineNumber?.toString() || "");
|
||||
setDialog(true);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
@@ -107,23 +140,7 @@ export const TrainPosition: FC<Props> = ({
|
||||
flexDirection: "row",
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onLongPress={() => {
|
||||
const { isBetween, Pos } = trainPosition(currentTrainData);
|
||||
setStationNumberInput(getStationID(currentTrainData?.Pos, stationList));
|
||||
setPosInput(database?.platformNumber?.toString() || "");
|
||||
if (isBetween === true) {
|
||||
if (database?.platformNumber == undefined && database?.description == undefined)
|
||||
return;
|
||||
setStationInput(`${Pos.from}→${Pos.to}間`);
|
||||
setDeleteDialog(true);
|
||||
} else {
|
||||
setStationInput(currentTrainData?.Pos);
|
||||
setDescInput(database?.description || "");
|
||||
setLineInput(database?.lineNumber?.toString() || "");
|
||||
setPlatformNumber(database?.platformNumber?.toString() || "");
|
||||
setDialog(true);
|
||||
}
|
||||
}}
|
||||
onLongPress={openEditWindow}
|
||||
>
|
||||
<View style={{ flex: 4, flexDirection: "row" }}>
|
||||
<Text
|
||||
|
@@ -1,28 +1,32 @@
|
||||
import React, { FC } from "react";
|
||||
import { Text } from "react-native";
|
||||
import { Dialog, Button } from "react-native-elements";
|
||||
import { trainDataType } from "../../../lib/trainPositionTextArray";
|
||||
|
||||
type Props = {
|
||||
dialog: boolean;
|
||||
setDialog: (dialog: boolean) => void;
|
||||
currentTrainData: trainDataType;
|
||||
stationInput: string;
|
||||
stationNumberInput: string;
|
||||
PosNum: number;
|
||||
Line: string;
|
||||
Pos: string;
|
||||
StationNum: string;
|
||||
};
|
||||
export const TrainPositionDataDelete: FC<Props> = ({
|
||||
|
||||
export const StationPosDeleteDialog: FC<Props> = ({
|
||||
dialog,
|
||||
setDialog,
|
||||
currentTrainData,
|
||||
stationInput,
|
||||
stationNumberInput,
|
||||
PosNum,
|
||||
Line,
|
||||
Pos,
|
||||
StationNum
|
||||
}) => {
|
||||
const sendPlatformData = () => {
|
||||
fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3`, {
|
||||
method: "DELETE",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
PosId: currentTrainData?.PosNum,
|
||||
lineName: currentTrainData?.Line,
|
||||
PosId: PosNum,
|
||||
lineName: Line,
|
||||
StationName: Pos, //自動:駅名、漢字
|
||||
}),
|
||||
})
|
||||
.then(() => {
|
||||
@@ -36,10 +40,10 @@ export const TrainPositionDataDelete: FC<Props> = ({
|
||||
return (
|
||||
<Dialog isVisible={dialog} onBackdropPress={() => setDialog(false)}>
|
||||
<Text>以下のデータを誤情報として削除要求を出しますか?</Text>
|
||||
<Text>路線: {currentTrainData?.Line}</Text>
|
||||
<Text>地点ID: {currentTrainData?.PosNum}</Text>
|
||||
<Text>駅名: {stationInput}</Text>
|
||||
<Text>駅ナンバー: {stationNumberInput}</Text>
|
||||
<Text>路線: {Line}</Text>
|
||||
<Text>地点ID: {PosNum}</Text>
|
||||
<Text>駅名: {Pos}</Text>
|
||||
<Text>駅ナンバー: {StationNum}</Text>
|
||||
<Button title="送信" onPress={sendPlatformData} />
|
||||
</Dialog>
|
||||
);
|
||||
|
@@ -7,21 +7,30 @@ import { useStationList } from "@/stateBox/useStationList";
|
||||
type Props = {
|
||||
dialog: boolean;
|
||||
setDialog: (dialog: boolean) => void;
|
||||
currentTrainData: trainDataType;
|
||||
stationNumberInput: string;
|
||||
posInput: string;
|
||||
descInput: string;
|
||||
lineInput: string;
|
||||
setPosInput: (pos: string) => void;
|
||||
setDescInput: (desc: string) => void;
|
||||
setLineInput: (line: string) => void;
|
||||
|
||||
PosNum:number;
|
||||
Pos:string;
|
||||
Line:string;
|
||||
StationNum: string;
|
||||
|
||||
lineInput: string;
|
||||
setLineInput: (line: string) => void;
|
||||
posInput: string;
|
||||
setPosInput: (pos: string) => void;
|
||||
descInput: string;
|
||||
setDescInput: (desc: string) => void;
|
||||
};
|
||||
export const TrainPositionDataPush: FC<Props> = ({
|
||||
export const StationPosPushDialog: FC<Props> = ({
|
||||
// Dialog表示関係
|
||||
dialog,
|
||||
setDialog,
|
||||
currentTrainData,
|
||||
stationNumberInput,
|
||||
//固定情報
|
||||
PosNum,//地点ID
|
||||
Pos,//駅名
|
||||
Line,//路線名
|
||||
StationNum,//駅ナンバリング
|
||||
|
||||
//入力欄
|
||||
lineInput,
|
||||
setLineInput,
|
||||
posInput,
|
||||
@@ -35,10 +44,10 @@ export const TrainPositionDataPush: FC<Props> = ({
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
PosId: currentTrainData?.PosNum, //自動:位置情報ID
|
||||
StationId: getStationID(currentTrainData?.Pos, stationList), //自動:駅ID
|
||||
StationName: currentTrainData?.Pos, //自動:駅名、漢字
|
||||
lineName: currentTrainData?.Line, //自動:位置情報路線ID(koutoku/yosan)
|
||||
PosId: PosNum, //自動:位置情報ID
|
||||
StationId: getStationID(Pos, stationList), //自動:駅ID
|
||||
StationName: Pos, //自動:駅名、漢字
|
||||
lineName: Line, //自動:位置情報路線ID(koutoku/yosan)
|
||||
Description: descInput, //手動入力、参考情報
|
||||
platformNumber: parseInt(posInput), //手動入力、乗り場表記
|
||||
lineNumber: parseInt(lineInput), //手動入力、番線表記
|
||||
@@ -57,10 +66,10 @@ export const TrainPositionDataPush: FC<Props> = ({
|
||||
return (
|
||||
<Dialog isVisible={dialog} onBackdropPress={() => setDialog(false)}>
|
||||
<Text style={{ fontSize: 20, fontWeight: "bold" }}>駅番線情報投稿機能</Text>
|
||||
<Text>路線: {currentTrainData?.Line}</Text>
|
||||
<Text>地点ID: {currentTrainData?.PosNum}</Text>
|
||||
<Text>駅名: {currentTrainData?.Pos}</Text>
|
||||
<Text>駅ナンバー: {stationNumberInput}</Text>
|
||||
<Text>路線: {Line}</Text>
|
||||
<Text>地点ID: {PosNum}</Text>
|
||||
<Text>駅名: {Pos}</Text>
|
||||
<Text>駅ナンバー: {StationNum}</Text>
|
||||
<Input
|
||||
label="乗り場"
|
||||
inputMode="numeric"
|
||||
|
@@ -676,7 +676,8 @@ export const injectJavascriptData: InjectJavascriptData = (
|
||||
let ToData = "";
|
||||
let TrainNumber = 列番データ;
|
||||
let isEdit = false;
|
||||
|
||||
let isSeason = false;
|
||||
let TrainNumberOverride;
|
||||
try{
|
||||
const diagram = trainDiagramData2[列番データ] || trainTimeInfo[列番データ];
|
||||
if(diagram){
|
||||
@@ -880,52 +881,64 @@ export const injectJavascriptData: InjectJavascriptData = (
|
||||
getThrew(列番データ);
|
||||
if(trainDataList.find(e => e.id === 列番データ) !== undefined){
|
||||
const data = trainDataList.find(e => e.id === 列番データ);
|
||||
//{id,isWanman,trainName,viaData,ToData,TrainNumber,JRF,type,infoUrl,trainNumDistance,info,infogram,isEdit}
|
||||
//{id,trainName,viaData,ToData,TrainNumber,TrainNumberOverride,type,infoUrl,trainNumDistance,info,infogram,isEdit}
|
||||
trainType = (()=>{
|
||||
switch(data.type){
|
||||
case "Normal":
|
||||
trainTypeColor = "black";
|
||||
isWanman = false;
|
||||
return "普通";
|
||||
case "OneMan":
|
||||
trainTypeColor = "black";
|
||||
isWanman = true;
|
||||
return "普通";
|
||||
case "Rapid":
|
||||
trainTypeColor = "rgba(0, 140, 255, 1)";
|
||||
isWanman = false;
|
||||
return "快速";
|
||||
case "OneManRapid":
|
||||
trainTypeColor = "rgba(0, 140, 255, 1)";
|
||||
isWanman = true;
|
||||
return "快速";
|
||||
case "LTDEXP":
|
||||
trainTypeColor = "red";
|
||||
isWanman = false;
|
||||
return "特急";
|
||||
case "NightLTDEXP":
|
||||
trainTypeColor = "#d300b0ff";
|
||||
isWanman = false;
|
||||
return "寝台特急";
|
||||
case "SPCL":
|
||||
case "SPCL_Normal":
|
||||
trainTypeColor = "#008d07ff";
|
||||
isWanman = false;
|
||||
return "臨時";
|
||||
case "SPCL_Rapid":
|
||||
trainTypeColor = "rgba(0, 81, 255, 1)";
|
||||
isWanman = false;
|
||||
return "臨時快速";
|
||||
case "SPCL_EXP":
|
||||
trainTypeColor = "#a52e2eff";
|
||||
isWanman = false;
|
||||
return "臨時特急";
|
||||
case "Freight":
|
||||
trainTypeColor = "#00869ecc";
|
||||
isWanman = false;
|
||||
return "貨物";
|
||||
case "Forwarding":
|
||||
trainTypeColor = "#727272cc";
|
||||
isWanman = false;
|
||||
return "回送";
|
||||
case "FreightForwarding":
|
||||
trainTypeColor = "#727272cc";
|
||||
isWanman = false;
|
||||
return "単機回送";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
})();
|
||||
isWanman = data.isWanman;
|
||||
isEdit = data.isEdit;
|
||||
isSeason = data.isSeason;
|
||||
if(data.trainName != ""){
|
||||
trainName = data.trainName;
|
||||
if(data.trainNumDistance != null){
|
||||
@@ -938,10 +951,12 @@ export const injectJavascriptData: InjectJavascriptData = (
|
||||
if(data.ToData != ""){
|
||||
ToData = data.ToData;
|
||||
}
|
||||
if(data.TrainNumberOverride){
|
||||
TrainNumberOverride = data.TrainNumberOverride;
|
||||
}
|
||||
}
|
||||
//列番付与
|
||||
const returnText1 = (isWanman ? "ワンマン " : "") + trainName + viaData;
|
||||
const returnText2 = (ToData ? ToData+"行 " : ToData)+ TrainNumber;
|
||||
行き先情報.innerText = "";
|
||||
${uiSetting === "tokyo" ? `
|
||||
let stationIDs = [];
|
||||
@@ -979,16 +994,19 @@ export const injectJavascriptData: InjectJavascriptData = (
|
||||
case "鳴門線直通":
|
||||
yosan2Color = "#881F61";
|
||||
break;
|
||||
case "予土線":
|
||||
yosan2Color = "#008a5a";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const gradient = getColors.length > 1 ? "linear-gradient(130deg, " + getColors[0] + " 0%, "+ getColors[0]+"50%, "+ getColors[1]+"50%, " + getColors[1] + " 100%)" : getColors[0];
|
||||
|
||||
行き先情報.insertAdjacentHTML('beforebegin', "<div style='width:100%;display:flex;flex:1;flex-direction:"+(isLeft ? "column-reverse" : "column") + ";'>"+( isEdit ? "<div style='position:absolute;"+ (isLeft ? "right" : "left") + ":0;"+ (isLeft ? "bottom" : "top") + ":0;background-color:#00b8bb;border-radius:15px;padding:0px;padding-left:4px;padding-right:4px;'><i class='fa-solid fa-user-group fa-sm' style='color:white;width:100%;height:100%;'></i></div>" : "")+"<p style='font-size:6px;padding:0;color:black;text-align:center;'>" + TrainNumber + (JRF ? "":"レ") + "</p><div style='flex:1;'></div><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + (isWanman ? "ワンマン " : "") + "</p><p style='font-size:6px;font-weight:bold;padding:0;color: black;text-align:center;border-style:solid;border-width: "+(!!yosan2Color ? "2px" : "0px")+";border-color:" + yosan2Color + "'>" + viaData + "</p><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + trainName + "</p><div style='width:100%;background:" + gradient + ";'><p style='font-size:10px;font-weight:bold;padding:0;margin:0;color:white;align-items:center;align-content:center;text-align:center;text-shadow:1px 1px 0px #00000030, -1px -1px 0px #00000030,-1px 1px 0px #00000030, 1px -1px 0px #00000030,1px 0px 0px #00000030, -1px 0px 0px #00000030,0px 1px 0px #00000030, 0px -1px 0px #00000030;'>" + (ToData ? ToData + "行" : ToData) + "</p></div><div style='width:100%;background:" + trainTypeColor + ";border-radius:"+(isLeft ? "4px 4px 0 0" : "0 0 4px 4px")+";'><p style='font-size:10px;font-weight:bold;font-style:italic;padding:0;color: white;text-align:center;'>" + trainType + "</p></div><p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p></div>");
|
||||
行き先情報.insertAdjacentHTML('beforebegin', "<div style='width:100%;display:flex;flex:1;flex-direction:"+(isLeft ? "column-reverse" : "column") + ";'>"+( isEdit ? "<div style='position:absolute;"+ (isLeft ? "right" : "left") + ":0;"+ (isLeft ? "bottom" : "top") + ":0;background-color:#00b8bb;border-radius:15px;padding:0px;padding-left:4px;padding-right:4px;'><i class='fa-solid fa-user-group fa-sm' style='color:white;width:100%;height:100%;'></i></div>" : isSeason ? "<div style='position:absolute;"+ (isLeft ? "right" : "left") + ":0;"+ (isLeft ? "bottom" : "top") + ":0;background-color:#00b8bb;border-radius:15px;padding:0px;padding-left:4px;padding-right:4px;'><i class='fa-solid fa-calendar fa-sm' style='color:white;width:100%;height:100%;'></i></div>" : "")+"<p style='font-size:6px;padding:0;color:black;text-align:center;'>" + (TrainNumberOverride ? TrainNumberOverride : TrainNumber) + "</p><div style='flex:1;'></div><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + (isWanman ? "ワンマン " : "") + "</p><p style='font-size:6px;font-weight:bold;padding:0;color: black;text-align:center;border-style:solid;border-width: "+(!!yosan2Color ? "2px" : "0px")+";border-color:" + yosan2Color + "'>" + viaData + "</p><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + trainName + "</p><div style='width:100%;background:" + gradient + ";'><p style='font-size:10px;font-weight:bold;padding:0;margin:0;color:white;align-items:center;align-content:center;text-align:center;text-shadow:1px 1px 0px #00000030, -1px -1px 0px #00000030,-1px 1px 0px #00000030, 1px -1px 0px #00000030,1px 0px 0px #00000030, -1px 0px 0px #00000030,0px 1px 0px #00000030, 0px -1px 0px #00000030;'>" + (ToData ? ToData + "行" : ToData) + "</p></div><div style='width:100%;background:" + trainTypeColor + ";border-radius:"+(isLeft ? "4px 4px 0 0" : "0 0 4px 4px")+";'><p style='font-size:10px;font-weight:bold;font-style:italic;padding:0;color: white;text-align:center;'>" + trainType + "</p></div><p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p></div>");
|
||||
`: `
|
||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: black;'>" + returnText1 + "</p>");
|
||||
行き先情報.insertAdjacentHTML('beforebegin', "<div style='display:inline-flex;flex-direction:row;'><p style='font-size:10px;font-weight: bold;padding:0;color:black;'>" + (ToData ? ToData + "行 " : ToData) + "</p><p style='font-size:10px;padding:0;color:black;'>" + TrainNumber + (JRF ? "":"レ") + "</p></div>");
|
||||
行き先情報.insertAdjacentHTML('beforebegin', "<div style='display:inline-flex;flex-direction:row;'><p style='font-size:10px;font-weight: bold;padding:0;color:black;'>" + (ToData ? ToData + "行 " : ToData) + "</p><p style='font-size:10px;padding:0;color:black;'>" + (TrainNumberOverride ? TrainNumberOverride : TrainNumber) + "</p></div>");
|
||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p>");
|
||||
`}
|
||||
}
|
||||
|
@@ -31,7 +31,14 @@ export const AllTrainDiagramProvider = ({ children }) => {
|
||||
const keys = Object.keys(d);
|
||||
data[keys] = d[keys];
|
||||
});
|
||||
return data;
|
||||
//dataのkeyで並び替え
|
||||
const sortedData = Object.keys(data)
|
||||
.sort((a, b) => a.replace(/[D,M]/, "") - b.replace(/[D,M]/, ""))
|
||||
.reduce((acc, key) => {
|
||||
acc[key] = data[key];
|
||||
return acc;
|
||||
}, {});
|
||||
return sortedData;
|
||||
})
|
||||
.then((res) => {
|
||||
setAllTrainDiagram(res);
|
||||
|
Reference in New Issue
Block a user