番線表示機能開発開始

This commit is contained in:
harukin-expo-dev-env 2024-09-16 14:35:46 +00:00
parent 6fad8e23d2
commit 6653cbf65a

View File

@ -92,6 +92,22 @@ export const EachData: FC<Props> = (props) => {
.split("")[currentTrainData?.Direction == 1 ? 1 : 0] .split("")[currentTrainData?.Direction == 1 ? 1 : 0]
}` }`
: `現在地:${currentTrainData?.Pos}`; : `現在地:${currentTrainData?.Pos}`;
const [platformNumber, setPlatformNumber] = useState<number>();
useEffect(()=>{
fetch("https://n8n.haruk.in/webhook/JR-shikoku-PosID?num="+currentTrainData?.PosNum)
.then(res=>res.json())
.then(data=>{
if(data?.type == "Station"){
setPlatformNumber(data?.platform);
}
else{
setPlatformNumber(undefined);
}
})
},[currentTrainData,currentTrain])
return ( return (
<> <>
<TouchableOpacity <TouchableOpacity
@ -121,7 +137,7 @@ export const EachData: FC<Props> = (props) => {
<Description <Description
info={`${ info={`${
trainIDSwitch ? currentTrainData?.PosNum : trainPositionText trainIDSwitch ? currentTrainData?.PosNum : trainPositionText
}`} } ${platformNumber? platformNumber+"番線":""}`}
onLongClick={() => { onLongClick={() => {
Linking.openURL( Linking.openURL(
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw" "https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"