Merge commit '9d1ef5681a503c8af795119c425957e7bf9ffe4b' into develop
This commit is contained in:
commit
72b82e84fe
@ -6,30 +6,46 @@ type stateBox = {
|
||||
title: string;
|
||||
style?: ViewStyle;
|
||||
mode?: number;
|
||||
endText?: string;
|
||||
};
|
||||
export const StateBox: FC<stateBox> = ({ text, title, style, mode }) => (
|
||||
<View style={{ ...(mode == 2 ? boxStyle2 : boxStyle), ...style }}>
|
||||
<Text style={{ fontSize: 12, color: "#0099CC" }}>{title}</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<View style={{ flexDirection: mode == 2 ? "row" : "column" }}>
|
||||
{text?.match("~") ? (
|
||||
<>
|
||||
<Text style={mode == 2 ? boxTextStyle2 : boxTextStyle}>
|
||||
{text.split("~")[0]}
|
||||
export const StateBox: FC<stateBox> = (props) => {
|
||||
const { text, title, style, mode, endText } = props;
|
||||
return (
|
||||
<View style={{ ...(mode == 2 ? boxStyle2 : boxStyle), ...style }}>
|
||||
<Text style={{ fontSize: 12, color: "#0099CC" }}>{title}</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<View style={{ flexDirection: mode == 2 ? "row" : "column" }}>
|
||||
{text?.match("~") ? (
|
||||
<>
|
||||
<Text style={mode == 2 ? boxTextStyle2 : boxTextStyle}>
|
||||
{text.split("~")[0]}
|
||||
</Text>
|
||||
<Text style={{ color: "#0099CC", textAlign: "right" }}>
|
||||
{mode == 2 ? "→" : "↓"}
|
||||
</Text>
|
||||
<Text style={mode == 2 ? boxTextStyle2 : boxTextStyle}>
|
||||
{text.split("~")[1]}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<Text style={mode == 2 ? boxTextStyle2 : boxTextStyle}>{text}</Text>
|
||||
)}
|
||||
</View>
|
||||
{endText && (
|
||||
<View style={{ flexDirection: mode == 2 ? "row" : "column" }}>
|
||||
<Text
|
||||
style={{
|
||||
...{ ...(mode == 2 ? boxTextStyle2 : boxTextStyle) },
|
||||
fontSize: 10,
|
||||
}}
|
||||
>
|
||||
{endText}
|
||||
</Text>
|
||||
<Text style={{ color: "#0099CC", textAlign: "right" }}>
|
||||
{mode == 2 ? "→" : "↓"}
|
||||
</Text>
|
||||
<Text style={mode == 2 ? boxTextStyle2 : boxTextStyle}>
|
||||
{text.split("~")[1]}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<Text style={mode == 2 ? boxTextStyle2 : boxTextStyle}>{text}</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
);
|
||||
};
|
||||
const boxStyle: ViewStyle = {
|
||||
flex: 1,
|
||||
backgroundColor: "white",
|
||||
|
@ -6,6 +6,12 @@ import { getStationList2 } from "../../../lib/getStationList2";
|
||||
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 { getStationID } from "../../../lib/eachTrainInfoCoreLib/getStationData";
|
||||
import { useStationList } from "../../../stateBox/useStationList";
|
||||
import { lineList } from "../../../lib/getStationList";
|
||||
|
||||
|
||||
|
||||
export const TrainDataView = ({
|
||||
currentTrainData,
|
||||
@ -15,20 +21,67 @@ export const TrainDataView = ({
|
||||
mode = 0,
|
||||
navigate,
|
||||
}) => {
|
||||
|
||||
const { originalStationList } = useStationList();
|
||||
|
||||
const stationList =
|
||||
originalStationList &&
|
||||
lineList.map((d) =>
|
||||
originalStationList[d].map((a) => ({
|
||||
StationNumber: a.StationNumber,
|
||||
StationName: a.Station_JP,
|
||||
}))
|
||||
);
|
||||
const { width, height } = useWindowDimensions();
|
||||
const { isLandscape } = useDeviceOrientationChange();
|
||||
const { inject } = useCurrentTrain();
|
||||
const [mapsStationData, setMapsStationData] = useState(undefined);
|
||||
|
||||
const [platformNumber, setPlatformNumber] = useState();
|
||||
const [platformDescription, setPlatformDescription] = useState();
|
||||
useEffect(() => {
|
||||
//currentTrainData.Pos = "鴨川~端岡"; //test
|
||||
if (!currentTrainData) return;
|
||||
fetch(
|
||||
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined);
|
||||
setPlatformDescription(
|
||||
data?.type == "Station" ? data?.description : undefined
|
||||
);
|
||||
});
|
||||
}, [currentTrainData]);
|
||||
useEffect(() => {
|
||||
getStationList2().then(setMapsStationData);
|
||||
}, []);
|
||||
const onLine = !!currentPosition?.toString().length;
|
||||
const trainPositionText = (trainData) => {
|
||||
const { isBetween, Pos } = trainPosition(trainData);
|
||||
if (isBetween === true) return `${Pos.from}~${Pos.to}`;
|
||||
else return Pos.Pos == "" ? "" : `${Pos.Pos}`;
|
||||
const { isBetween, Pos: PosData } = trainPosition(trainData);
|
||||
const { from, to, Pos } = PosData;
|
||||
if (isBetween === true) return `${from}~${to}`;
|
||||
if (Pos == "") return "";
|
||||
return `${Pos}${platformNumber ? ` ${platformNumber}番線` : ""}`;
|
||||
};
|
||||
return (
|
||||
const [dialog, setDialog] = useState(false);
|
||||
const [deleteDialog, setDeleteDialog] = useState(false);
|
||||
const [posInput, setPosInput] = useState("");
|
||||
const [descInput, setDescInput] = useState("");
|
||||
const [stationInput, setStationInput] = useState("");
|
||||
const [stationNumberInput, setStationNumberInput] = useState("");
|
||||
return (<>
|
||||
<TrainPositionDataPush
|
||||
dialog={dialog}
|
||||
setDialog={setDialog}
|
||||
currentTrainData={currentTrainData}
|
||||
stationInput={stationInput}
|
||||
stationNumberInput={stationNumberInput}
|
||||
posInput={posInput}
|
||||
descInput={descInput}
|
||||
setPosInput={setPosInput}
|
||||
setDescInput={setDescInput}
|
||||
station={{Station_JP:trainPositionText(currentTrainData),StationNumber:currentPosition[0]}} />
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
@ -40,8 +93,30 @@ export const TrainDataView = ({
|
||||
>
|
||||
<TouchableOpacity
|
||||
style={{ flex: 1, flexDirection: "row" }}
|
||||
disabled={!onLine}
|
||||
//disabled={!onLine}
|
||||
onLongPress={() => {
|
||||
const { isBetween, Pos } = trainPosition(currentTrainData);
|
||||
if (isBetween === true) {
|
||||
if (platformNumber == undefined && platformDescription == undefined)
|
||||
return;
|
||||
setStationInput(`${Pos.from}→${Pos.to}間`);
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
setPosInput(platformNumber?.toString() || "");
|
||||
setDeleteDialog(true);
|
||||
} else {
|
||||
setStationInput(Pos.Pos);
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
setDescInput(platformDescription || "");
|
||||
setPosInput(platformNumber?.toString() || "");
|
||||
setDialog(true);
|
||||
}
|
||||
}}
|
||||
onPress={() => {
|
||||
if(!onLine) return;
|
||||
const test = [];
|
||||
Object.keys(mapsStationData).forEach((d) => {
|
||||
mapsStationData[d].forEach((x) => {
|
||||
@ -67,6 +142,7 @@ export const TrainDataView = ({
|
||||
mode={mode}
|
||||
title={`現在地 ${currentPosition?.toString()}${onLine ? "▶️" : ""}`}
|
||||
text={trainPositionText(currentTrainData)}
|
||||
endText={platformDescription ? `${platformDescription}` : ""}
|
||||
style={
|
||||
onLine
|
||||
? { borderWidth: 1, borderColor: "red", borderStyle: "solid" }
|
||||
@ -110,5 +186,6 @@ export const TrainDataView = ({
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -82,7 +82,7 @@ export default function TrainMenu({ style }) {
|
||||
d={d}
|
||||
navigate={navigate}
|
||||
webview={webview}
|
||||
key={index + indexBase}
|
||||
key={D.StationNumber+d}
|
||||
/>
|
||||
))}
|
||||
</MapView>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { FC, useEffect, useState } from "react";
|
||||
import { Linking, TouchableOpacity } from "react-native";
|
||||
import { Linking, TouchableOpacity, Text } from "react-native";
|
||||
import { Dialog, Button, Input } from "react-native-elements";
|
||||
import { checkDuplicateTrainData } from "../../lib/checkDuplicateTrainData";
|
||||
import { getTrainDelayStatus } from "../../lib/getTrainDelayStatus";
|
||||
import { getTrainType } from "../../lib/getTrainType";
|
||||
@ -11,7 +12,9 @@ import { LastStation } from "./LED_inside_Component/LastStation";
|
||||
import { StatusAndDelay } from "./LED_inside_Component/StatusAndDelay";
|
||||
import { TrainName } from "./LED_inside_Component/TrainName";
|
||||
import { customTrainDataDetector } from "../custom-train-data";
|
||||
import { trainDataType, trainPosition } from "../../lib/trainPositionTextArray";
|
||||
import { TrainPosition } from "./LED_inside_Component/TrainPosition";
|
||||
import { TrainPositionDataPush } from "./LED_inside_Component/TrainPositionDataPush";
|
||||
import { TrainPositionDataDelete } from "./LED_inside_Component/TrainPositionDataDelete";
|
||||
|
||||
type Props = {
|
||||
d: {
|
||||
@ -23,6 +26,7 @@ type Props = {
|
||||
trainDescriptionSwitch: boolean;
|
||||
station: {
|
||||
Station_JP: string;
|
||||
StationNumber: string;
|
||||
};
|
||||
navigate: (screen: string, data?: any) => void;
|
||||
openStationACFromEachTrainInfo: (station: string) => void;
|
||||
@ -83,6 +87,7 @@ export const EachData: FC<Props> = (props) => {
|
||||
}
|
||||
return customTrainData;
|
||||
};
|
||||
|
||||
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
|
||||
useEffect(() => {
|
||||
setTrain(getTrainDataFromCurrentTrain(d.train));
|
||||
@ -95,29 +100,37 @@ export const EachData: FC<Props> = (props) => {
|
||||
currentTrainData,
|
||||
station.Station_JP
|
||||
)}`;
|
||||
const trainPositionText = (trainData: trainDataType) => {
|
||||
const { isBetween, Pos } = trainPosition(trainData);
|
||||
if (isBetween === true) return `現在地:${Pos.from}→${Pos.to}間を走行中`;
|
||||
else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`;
|
||||
};
|
||||
|
||||
const [platformNumber, setPlatformNumber] = useState<number>();
|
||||
const [platformDescription, setPlatformDescription] = useState<string>();
|
||||
useEffect(() => {
|
||||
fetch(
|
||||
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined);
|
||||
setPlatformDescription(
|
||||
data?.type == "Station" ? data?.description : undefined
|
||||
);
|
||||
});
|
||||
}, [currentTrainData, currentTrain]);
|
||||
|
||||
const [dialog, setDialog] = useState(false);
|
||||
const [deleteDialog, setDeleteDialog] = useState(false);
|
||||
const [posInput, setPosInput] = useState("");
|
||||
const [descInput, setDescInput] = useState("");
|
||||
const [stationInput, setStationInput] = useState("");
|
||||
const [stationNumberInput, setStationNumberInput] = useState("");
|
||||
return (
|
||||
<>
|
||||
<TrainPositionDataDelete
|
||||
dialog={deleteDialog}
|
||||
setDialog={setDeleteDialog}
|
||||
currentTrainData={currentTrainData}
|
||||
stationInput={stationInput}
|
||||
stationNumberInput={stationNumberInput}
|
||||
/>
|
||||
<TrainPositionDataPush
|
||||
dialog={dialog}
|
||||
setDialog={setDialog}
|
||||
currentTrainData={currentTrainData}
|
||||
stationInput={stationInput}
|
||||
stationNumberInput={stationNumberInput}
|
||||
posInput={posInput}
|
||||
descInput={descInput}
|
||||
setPosInput={setPosInput}
|
||||
setDescInput={setDescInput}
|
||||
station={station}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
alignContent: "center",
|
||||
@ -142,19 +155,20 @@ export const EachData: FC<Props> = (props) => {
|
||||
<StatusAndDelay trainDelayStatus={trainDelayStatus} />
|
||||
</TouchableOpacity>
|
||||
{trainDescriptionSwitch && (
|
||||
<Description
|
||||
info={`${
|
||||
trainIDSwitch
|
||||
? currentTrainData?.PosNum + currentTrainData?.Line
|
||||
: trainPositionText(currentTrainData)
|
||||
} ${platformNumber ? platformNumber + "番線" : ""} ${
|
||||
platformDescription ? "("+platformDescription+")" : ""
|
||||
}`}
|
||||
onLongClick={() => {
|
||||
Linking.openURL(
|
||||
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"
|
||||
);
|
||||
}}
|
||||
<TrainPosition
|
||||
trainIDSwitch={trainIDSwitch}
|
||||
currentTrainData={currentTrainData}
|
||||
setStationInput={setStationInput}
|
||||
setStationNumberInput={setStationNumberInput}
|
||||
setDescInput={setDescInput}
|
||||
setPosInput={setPosInput}
|
||||
setDialog={setDialog}
|
||||
setDeleteDialog={setDeleteDialog}
|
||||
setPlatformDescription={setPlatformDescription}
|
||||
setPlatformNumber={setPlatformNumber}
|
||||
platformDescription={platformDescription}
|
||||
platformNumber={platformNumber}
|
||||
key={d.train+"-trainPosition"}
|
||||
/>
|
||||
)}
|
||||
{trainDescriptionSwitch && !!train.info && (
|
||||
|
127
components/発車時刻表/LED_inside_Component/TrainPosition.tsx
Normal file
127
components/発車時刻表/LED_inside_Component/TrainPosition.tsx
Normal file
@ -0,0 +1,127 @@
|
||||
import React, { FC, useEffect } from "react";
|
||||
import { Text, TextStyle, View, TouchableOpacity } from "react-native";
|
||||
import { useStationList } from "../../../stateBox/useStationList";
|
||||
import {
|
||||
trainDataType,
|
||||
trainPosition,
|
||||
} from "../../../lib/trainPositionTextArray";
|
||||
import { lineList } from "../../../lib/getStationList";
|
||||
import { getStationID } from "../../../lib/eachTrainInfoCoreLib/getStationData";
|
||||
import { useCurrentTrain } from "../../../stateBox/useCurrentTrain";
|
||||
|
||||
const descriptionStyle: TextStyle = {
|
||||
fontSize: parseInt("16%"),
|
||||
fontWeight: "bold",
|
||||
};
|
||||
|
||||
type Props = {
|
||||
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: number;
|
||||
setPlatformDescription: (desc: string) => void;
|
||||
setPlatformNumber: (num: number) => void;
|
||||
};
|
||||
|
||||
export const TrainPosition: FC<Props> = ({
|
||||
numberOfLines = 0,
|
||||
trainIDSwitch,
|
||||
currentTrainData,
|
||||
setStationInput,
|
||||
setStationNumberInput,
|
||||
setDescInput,
|
||||
setPosInput,
|
||||
setDialog,
|
||||
setDeleteDialog,
|
||||
setPlatformDescription,
|
||||
setPlatformNumber,
|
||||
platformDescription,
|
||||
platformNumber,
|
||||
}) => {
|
||||
const { currentTrain } = useCurrentTrain();
|
||||
const { originalStationList } = useStationList();
|
||||
const stationList =
|
||||
originalStationList &&
|
||||
lineList.map((d) =>
|
||||
originalStationList[d].map((a) => ({
|
||||
StationNumber: a.StationNumber,
|
||||
StationName: a.Station_JP,
|
||||
}))
|
||||
);
|
||||
useEffect(() => {
|
||||
fetch(
|
||||
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data: { type: string; platform: number; description: string }) => {
|
||||
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined);
|
||||
setPlatformDescription(
|
||||
data?.type == "Station" ? data?.description : undefined
|
||||
);
|
||||
});
|
||||
}, [currentTrainData, currentTrain]);
|
||||
|
||||
const trainPositionText = (trainData: trainDataType) => {
|
||||
const { isBetween, Pos } = trainPosition(trainData);
|
||||
if (isBetween === true) return `現在地:${Pos.from}→${Pos.to}間を走行中`;
|
||||
else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
width: "94%",
|
||||
marginVertical: 5,
|
||||
marginHorizontal: "3%",
|
||||
backgroundColor: "#000",
|
||||
flexDirection: "row",
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onLongPress={() => {
|
||||
const { isBetween, Pos } = trainPosition(currentTrainData);
|
||||
if (isBetween === true) {
|
||||
if (platformNumber == undefined && platformDescription == undefined)
|
||||
return;
|
||||
setStationInput(`${Pos.from}→${Pos.to}間`);
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
setPosInput(platformNumber?.toString() || "");
|
||||
setDeleteDialog(true);
|
||||
} else {
|
||||
setStationInput(Pos.Pos);
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
setDescInput(platformDescription || "");
|
||||
setPosInput(platformNumber?.toString() || "");
|
||||
setDialog(true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<View style={{ flex: 4, flexDirection: "row" }}>
|
||||
<Text
|
||||
style={{ ...descriptionStyle, color: "green" }}
|
||||
numberOfLines={numberOfLines}
|
||||
>
|
||||
{`${
|
||||
trainIDSwitch
|
||||
? currentTrainData?.PosNum + currentTrainData?.Line
|
||||
: trainPositionText(currentTrainData)
|
||||
} ${platformNumber ? platformNumber + "番線" : ""} ${
|
||||
platformDescription ? "(" + platformDescription + ")" : ""
|
||||
}`}
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
};
|
@ -0,0 +1,46 @@
|
||||
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;
|
||||
};
|
||||
export const TrainPositionDataDelete: FC<Props> = ({
|
||||
dialog,
|
||||
setDialog,
|
||||
currentTrainData,
|
||||
stationInput,
|
||||
stationNumberInput,
|
||||
}) => {
|
||||
const sendPlatformData = () => {
|
||||
fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID`, {
|
||||
method: "DELETE",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
PosId: currentTrainData?.PosNum,
|
||||
lineName: currentTrainData?.Line,
|
||||
}),
|
||||
})
|
||||
.then(() => {
|
||||
alert("位置情報データ削除要求を送信しました。");
|
||||
setDialog(false);
|
||||
})
|
||||
.catch(() => {
|
||||
alert("位置情報データ削除要求の送信に失敗しました。");
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Dialog isVisible={dialog} onBackdropPress={() => setDialog(false)}>
|
||||
<Text>以下のデータを誤情報として削除要求を出しますか?</Text>
|
||||
<Text>路線: {currentTrainData?.Line}</Text>
|
||||
<Text>地点ID: {currentTrainData?.PosNum}</Text>
|
||||
<Text>駅名: {stationInput}</Text>
|
||||
<Text>駅ナンバー: {stationNumberInput}</Text>
|
||||
<Button title="送信" onPress={sendPlatformData} />
|
||||
</Dialog>
|
||||
);
|
||||
};
|
@ -0,0 +1,77 @@
|
||||
import React, { FC, useState } from "react";
|
||||
import { Text } from "react-native";
|
||||
import { Dialog, Input, Button } from "react-native-elements";
|
||||
import { trainDataType } from "../../../lib/trainPositionTextArray";
|
||||
import { useCurrentTrain } from "../../../stateBox/useCurrentTrain";
|
||||
type Props = {
|
||||
dialog: boolean;
|
||||
setDialog: (dialog: boolean) => void;
|
||||
currentTrainData: trainDataType;
|
||||
stationInput: string;
|
||||
stationNumberInput: string;
|
||||
posInput: string;
|
||||
descInput: string;
|
||||
setPosInput: (pos: string) => void;
|
||||
setDescInput: (desc: string) => void;
|
||||
station: {
|
||||
Station_JP: string;
|
||||
StationNumber: string;
|
||||
};
|
||||
};
|
||||
export const TrainPositionDataPush: FC<Props> = ({
|
||||
dialog,
|
||||
setDialog,
|
||||
currentTrainData,
|
||||
stationInput,
|
||||
stationNumberInput,
|
||||
posInput,
|
||||
descInput,
|
||||
setPosInput,
|
||||
setDescInput,
|
||||
station,
|
||||
}) => {
|
||||
const sendPlatformData = () => {
|
||||
fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
PosId: currentTrainData?.PosNum,
|
||||
lineName: currentTrainData?.Line,
|
||||
PlatformNum: parseInt(posInput),
|
||||
Description: descInput,
|
||||
StationName: station.Station_JP,
|
||||
StationId: station.StationNumber,
|
||||
}),
|
||||
})
|
||||
.then(() => {
|
||||
alert("位置情報データを送信しました。");
|
||||
setDialog(false);
|
||||
setPosInput("");
|
||||
setDescInput("");
|
||||
})
|
||||
.catch(() => {
|
||||
alert("位置情報データの送信に失敗しました。");
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Dialog isVisible={dialog} onBackdropPress={() => setDialog(false)}>
|
||||
<Text>路線: {currentTrainData?.Line}</Text>
|
||||
<Text>地点ID: {currentTrainData?.PosNum}</Text>
|
||||
<Text>駅名: {stationInput}</Text>
|
||||
<Text>駅ナンバー: {stationNumberInput}</Text>
|
||||
<Input
|
||||
label="番線"
|
||||
inputMode="numeric"
|
||||
value={posInput}
|
||||
onChangeText={setPosInput}
|
||||
/>
|
||||
<Input
|
||||
label="参考情報"
|
||||
inputMode="text"
|
||||
value={descInput}
|
||||
onChangeText={setDescInput}
|
||||
/>
|
||||
<Button title="送信" onPress={sendPlatformData} />
|
||||
</Dialog>
|
||||
);
|
||||
};
|
@ -206,6 +206,7 @@ export default function LED_vision(props) {
|
||||
openStationACFromEachTrainInfo,
|
||||
}}
|
||||
station={station[0]}
|
||||
key={d.train}
|
||||
/>
|
||||
))}
|
||||
{areaString != "" && isInfoArea && (
|
||||
|
4
menu.js
4
menu.js
@ -362,10 +362,10 @@ const JRSTraInfoBox = () => {
|
||||
/>
|
||||
</View>
|
||||
) : delayData ? (
|
||||
delayData.map((d) => {
|
||||
delayData.map((d,index,array) => {
|
||||
let data = d.split(" ");
|
||||
return (
|
||||
<View style={{ flexDirection: "row" }} key={data[1] + "key"}>
|
||||
<View style={{ flexDirection: "row" }} key={data[1] + "key"+index}>
|
||||
<Text style={{ flex: 15, fontSize: 18 }}>
|
||||
{data[0].replace("\n", "")}
|
||||
</Text>
|
||||
|
Loading…
Reference in New Issue
Block a user