クエリの追加
This commit is contained in:
parent
7c6ef56ecb
commit
199d41fd83
@ -101,20 +101,16 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`;
|
else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const [platformNumber, setPlatformNumber] = useState<number>();
|
const [platformNumber, setPlatformNumber] = useState<number>();
|
||||||
useEffect(()=>{
|
useEffect(() => {
|
||||||
fetch("https://n8n.haruk.in/webhook/JR-shikoku-PosID?num="+currentTrainData?.PosNum)
|
fetch(
|
||||||
.then(res=>res.json())
|
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
||||||
.then(data=>{
|
)
|
||||||
if(data?.type == "Station"){
|
.then((res) => res.json())
|
||||||
setPlatformNumber(data?.platform);
|
.then((data) =>
|
||||||
}
|
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined)
|
||||||
else{
|
);
|
||||||
setPlatformNumber(undefined);
|
}, [currentTrainData, currentTrain]);
|
||||||
}
|
|
||||||
})
|
|
||||||
},[currentTrainData,currentTrain])
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -147,7 +143,7 @@ useEffect(()=>{
|
|||||||
trainIDSwitch
|
trainIDSwitch
|
||||||
? currentTrainData?.PosNum
|
? currentTrainData?.PosNum
|
||||||
: trainPositionText(currentTrainData)
|
: trainPositionText(currentTrainData)
|
||||||
} ${platformNumber? platformNumber+"番線":""}`}
|
} ${platformNumber ? platformNumber + "番線" : ""}`}
|
||||||
onLongClick={() => {
|
onLongClick={() => {
|
||||||
Linking.openURL(
|
Linking.openURL(
|
||||||
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"
|
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
export const checkDuplicateTrainData = (currentTrainArray) => {
|
import { trainDataType } from "./trainPositionTextArray";
|
||||||
|
|
||||||
|
export const checkDuplicateTrainData = (currentTrainArray: trainDataType[]) => {
|
||||||
const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線");
|
const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線");
|
||||||
if (currentTrainArray.length == 1) return currentTrainArray[0];
|
if (currentTrainArray.length == 1) return currentTrainArray[0];
|
||||||
if (notNyujoData.length == 0) return currentTrainArray[0];
|
if (notNyujoData.length == 0) return currentTrainArray[0];
|
@ -1,5 +1,7 @@
|
|||||||
|
import { trainDataType } from "./trainPositionTextArray";
|
||||||
|
|
||||||
type getTrainDelayStatus = (
|
type getTrainDelayStatus = (
|
||||||
current: { delay: number | "入線" | string; Pos: string },
|
current: trainDataType,
|
||||||
Station_JP: string
|
Station_JP: string
|
||||||
) => string | number;
|
) => string | number;
|
||||||
export const getTrainDelayStatus: getTrainDelayStatus = (
|
export const getTrainDelayStatus: getTrainDelayStatus = (
|
||||||
|
@ -14,6 +14,12 @@ type returnCurrentType = {
|
|||||||
export type trainDataType = {
|
export type trainDataType = {
|
||||||
Pos?: string;
|
Pos?: string;
|
||||||
Direction?: number;
|
Direction?: number;
|
||||||
|
Index?: number;
|
||||||
|
Line?: string;
|
||||||
|
PosNum?: number;
|
||||||
|
Type?: string;
|
||||||
|
delay?: string | number;
|
||||||
|
num?: string;
|
||||||
};
|
};
|
||||||
type trainData = (
|
type trainData = (
|
||||||
trainData: trainDataType
|
trainData: trainDataType
|
||||||
|
Loading…
Reference in New Issue
Block a user