From d412941635c2e972b21b1fdcbba62736596cbfc7 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 12 Aug 2025 16:47:35 +0000 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9A=AB=E5=AE=9A=E7=9A=84=E3=81=AB?= =?UTF-8?q?=E6=8A=95=E7=A8=BF=E6=A9=9F=E8=83=BD=E6=96=B0=E5=9E=8B=E3=82=92?= =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/TrainDataView.js | 28 +++-- .../EachTrainInfoCore/HeaderText.tsx | 109 +++++++++++------- components/発車時刻表/EachData.tsx | 3 + .../LED_inside_Component/TrainPosition.tsx | 2 +- .../TrainPositionDataDelete.tsx | 2 +- .../TrainPositionDataPush.tsx | 27 +++-- 6 files changed, 114 insertions(+), 57 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 120af56..8119a15 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -26,19 +26,27 @@ export const TrainDataView = ({ const [mapsStationData, setMapsStationData] = useState(undefined); const [platformNumber, setPlatformNumber] = useState(); + const [lineNumber, setLineNumber] = 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}` + `https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3?PosId=${currentTrainData?.PosNum}&lineName=${currentTrainData?.Line}&StationName=${currentTrainData?.Pos}` ) .then((res) => res.json()) .then((data) => { - setPlatformNumber(data?.type == "Station" ? data?.platform : undefined); - setPlatformDescription( - data?.type == "Station" ? data?.description : undefined - ); + if (!data) return; + const {type, stationName, lineNumber, platformNumber, position, description} = data; + if (type == "Station") { + setLineNumber(lineNumber); + setPlatformNumber(platformNumber); + setPlatformDescription(description); + } else { + setLineNumber(undefined); + setPlatformNumber(undefined); + setPlatformDescription(undefined); + } }); }, [currentTrainData]); useEffect(() => { @@ -50,7 +58,8 @@ export const TrainDataView = ({ const { from, to, Pos } = PosData; if (isBetween === true) return `${from}~${to}`; if (Pos == "") return ""; - return `${Pos}${platformNumber ? ` ${platformNumber}番線` : ""}`; + if (platformNumber) return `${Pos} ${platformNumber}番乗り場`; + if (lineNumber) return `${Pos} ${lineNumber}番線`; }; const [dialog, setDialog] = useState(false); const [deleteDialog, setDeleteDialog] = useState(false); @@ -58,6 +67,7 @@ export const TrainDataView = ({ const [descInput, setDescInput] = useState(""); const [stationInput, setStationInput] = useState(""); const [stationNumberInput, setStationNumberInput] = useState(""); + const [lineInput, setLineInput] = useState(""); return ( <> @@ -100,6 +112,7 @@ export const TrainDataView = ({ getStationID(currentTrainData?.Pos, stationList) ); setPosInput(platformNumber?.toString() || ""); + setLineInput(lineNumber?.toString() || ""); setDeleteDialog(true); } else { setStationInput(Pos.Pos); @@ -108,6 +121,7 @@ export const TrainDataView = ({ ); setDescInput(platformDescription || ""); setPosInput(platformNumber?.toString() || ""); + setLineInput(lineNumber?.toString() || ""); setDialog(true); } }} diff --git a/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx b/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx index 9caced5..2a4ad6b 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx +++ b/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx @@ -50,45 +50,62 @@ export const HeaderText: FC = ({ const { expoPushToken } = useNotification(); // 列車名、種別、フォントの取得 - const [typeName, trainName, fontAvailable, isOneMan, infogram, isEdit] = - useMemo(() => { - const { type, trainName, trainNumDistance, infogram, isEdit } = - customTrainDataDetector(trainNum, allCustomTrainData); - const [typeString, fontAvailable, isOneMan] = getStringConfig( - type, - trainNum - ); - switch (true) { - case trainName !== "": - // 特急の場合は、列車名を取得 - // 列番対称データがある場合はそれから列車番号を取得 - return [ - typeString, - trainName + - (trainNumDistance !== null - ? ` ${parseInt(trainNum) - trainNumDistance}号` - : ""), - fontAvailable, - isOneMan, - infogram, - isEdit, - ]; - case trainData[trainData.length - 1] === undefined: - return [typeString, "", fontAvailable, isOneMan, infogram, isEdit]; - default: - // 行先がある場合は、行先を取得 - return [ - typeString, - migrateTrainName( - trainData[trainData.length - 1].split(",")[0] + "行き" - ), - fontAvailable, - isOneMan, - infogram, - isEdit - ]; - } - }, [trainData]); + const [ + typeName, + trainName, + fontAvailable, + isOneMan, + infogram, + isEdit, + uwasa, + ] = useMemo(() => { + const { type, trainName, trainNumDistance, infogram, isEdit, uwasa } = + customTrainDataDetector(trainNum, allCustomTrainData); + const [typeString, fontAvailable, isOneMan] = getStringConfig( + type, + trainNum + ); + switch (true) { + case trainName !== "": + // 特急の場合は、列車名を取得 + // 列番対称データがある場合はそれから列車番号を取得 + return [ + typeString, + trainName + + (trainNumDistance !== null + ? ` ${parseInt(trainNum) - trainNumDistance}号` + : ""), + fontAvailable, + isOneMan, + infogram, + isEdit, + uwasa, + ]; + case trainData[trainData.length - 1] === undefined: + return [ + typeString, + "", + fontAvailable, + isOneMan, + infogram, + isEdit, + uwasa, + ]; + default: + // 行先がある場合は、行先を取得 + return [ + typeString, + migrateTrainName( + trainData[trainData.length - 1].split(",")[0] + "行き" + ), + fontAvailable, + isOneMan, + infogram, + isEdit, + uwasa, + ]; + } + }, [trainData]); return ( = ({ {isOneMan && } {trainName} - {isEdit &&alert("このアイコン、列車データはコミュニティによってリアルタイム追加されています。")} />} + {isEdit && ( + + alert( + `[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n↓投稿者メモ↓\n${uwasa}` + ) + } + /> + )} diff --git a/components/発車時刻表/EachData.tsx b/components/発車時刻表/EachData.tsx index e9d5467..a228c5c 100644 --- a/components/発車時刻表/EachData.tsx +++ b/components/発車時刻表/EachData.tsx @@ -121,6 +121,7 @@ export const EachData: FC = (props) => { 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(""); @@ -164,6 +165,8 @@ export const EachData: FC = (props) => { setPosInput, setDescInput, station, + lineInput, + setLineInput, }} /> = ({ useEffect(() => { fetch( - `https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}` + `https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3?PosId=${currentTrainData?.PosNum}&lineName=${currentTrainData?.Line}&StationName=${currentTrainData?.Pos}` ) .then((res) => res.json()) .then((data: { type: string; platform: number; description: string }) => { diff --git a/components/発車時刻表/LED_inside_Component/TrainPositionDataDelete.tsx b/components/発車時刻表/LED_inside_Component/TrainPositionDataDelete.tsx index b266d6c..439d989 100644 --- a/components/発車時刻表/LED_inside_Component/TrainPositionDataDelete.tsx +++ b/components/発車時刻表/LED_inside_Component/TrainPositionDataDelete.tsx @@ -17,7 +17,7 @@ export const TrainPositionDataDelete: FC = ({ stationNumberInput, }) => { const sendPlatformData = () => { - fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID`, { + fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3`, { method: "DELETE", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ diff --git a/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx b/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx index 7bf8be2..59cdaf3 100644 --- a/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx +++ b/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx @@ -11,8 +11,10 @@ type Props = { stationNumberInput: string; posInput: string; descInput: string; + lineInput: string; setPosInput: (pos: string) => void; setDescInput: (desc: string) => void; + setLineInput: (line: string) => void; station: { Station_JP: string; StationNumber: string; @@ -24,6 +26,8 @@ export const TrainPositionDataPush: FC = ({ currentTrainData, stationInput, stationNumberInput, + lineInput, + setLineInput, posInput, descInput, setPosInput, @@ -31,16 +35,17 @@ export const TrainPositionDataPush: FC = ({ station, }) => { const sendPlatformData = () => { - fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID`, { + fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3`, { 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, + PosId: currentTrainData?.PosNum,//自動:位置情報ID + StationId: station.StationNumber,//自動:駅ID + StationName: station.Station_JP,//自動:駅名、漢字 + lineName: currentTrainData?.Line,//自動:位置情報路線ID(koutoku/yosan) + Description: descInput,//手動入力、参考情報 + platformNumber: parseInt(posInput),//手動入力、乗り場表記 + lineNumber: parseInt(lineInput),//手動入力、番線表記 }), }) .then(() => { @@ -60,11 +65,17 @@ export const TrainPositionDataPush: FC = ({ 駅名: {stationInput} 駅ナンバー: {stationNumberInput} + Date: Tue, 12 Aug 2025 16:51:42 +0000 Subject: [PATCH 2/8] =?UTF-8?q?=E5=B0=8F=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../発車時刻表/LED_inside_Component/TrainPosition.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/発車時刻表/LED_inside_Component/TrainPosition.tsx b/components/発車時刻表/LED_inside_Component/TrainPosition.tsx index c6243b4..7e41950 100644 --- a/components/発車時刻表/LED_inside_Component/TrainPosition.tsx +++ b/components/発車時刻表/LED_inside_Component/TrainPosition.tsx @@ -53,10 +53,9 @@ export const TrainPosition: FC = ({ ) .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 - ); + const { type, platform, description } = data; + setPlatformNumber(type == "Station" ? platform : undefined); + setPlatformDescription(type == "Station" ? description : undefined); }); }, [currentTrainData, currentTrain]); From 6518b53de98939e9d36fb8c2610b91a57c6d66a2 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 12 Aug 2025 17:14:47 +0000 Subject: [PATCH 3/8] =?UTF-8?q?positionBox=E3=81=AE=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/PositionBox.tsx | 97 +++++++++++++++++++ .../EachTrainInfo/StateBox.tsx | 16 +-- .../EachTrainInfo/TrainDataView.js | 15 +-- 3 files changed, 103 insertions(+), 25 deletions(-) create mode 100644 components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx diff --git a/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx new file mode 100644 index 0000000..187d0ff --- /dev/null +++ b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx @@ -0,0 +1,97 @@ +import { trainPosition } from "@/lib/trainPositionTextArray"; +import React, { CSSProperties, FC } from "react"; +import { View, Text, StyleProp, TextStyle, ViewStyle } from "react-native"; + +type stateBox = { + currentTrainData: any; + platformNumber: any; + title: string; + style?: ViewStyle; + mode?: number; + endText?: string; + lineNumber: string; +}; +export const PositionBox: FC = (props) => { + const { + currentTrainData, + platformNumber, + title, + style, + mode, + endText, + lineNumber, + } = props; + const trainPositionText = (trainData) => { + const { isBetween, Pos: PosData } = trainPosition(trainData); + if (isBetween === true) { + const { from, to } = PosData; + return `${from}~${to}`; + } else { + const { Pos } = PosData; + if (Pos == "") return ""; + if (platformNumber) return `${Pos} ${platformNumber}番乗り場`; + if (lineNumber) return `${Pos} ${lineNumber}番線`; + } + }; + const text = trainPositionText(currentTrainData); + return ( + + {title} + + + {text?.match("~") ? ( + <> + + {text.split("~")[0]} + + + {mode == 2 ? "→" : "↓"} + + + {text.split("~")[1]} + + + ) : ( + {text} + )} + + {endText && ( + + + {endText} + + + )} + + ); +}; +const boxStyle: ViewStyle = { + flex: 1, + backgroundColor: "white", + borderRadius: 10, + padding: 10, + margin: 10, +}; +const boxStyle2: ViewStyle = { + flex: 1, + backgroundColor: "white", + borderRadius: 10, + padding: 5, + margin: 5, +}; +const boxTextStyle2: TextStyle = { + fontSize: 18, + color: "#0099CC", + textAlign: "right", +}; + +const boxTextStyle: TextStyle = { + fontSize: 25, + color: "#0099CC", + textAlign: "right", +}; diff --git a/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx b/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx index fa5f65c..c124e32 100644 --- a/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx +++ b/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx @@ -15,21 +15,7 @@ export const StateBox: FC = (props) => { {title} - {text?.match("~") ? ( - <> - - {text.split("~")[0]} - - - {mode == 2 ? "→" : "↓"} - - - {text.split("~")[1]} - - - ) : ( - {text} - )} + {text} {endText && ( diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 8119a15..4e89aec 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -1,6 +1,7 @@ import React, { useState, useEffect } from "react"; import { View, TouchableOpacity, useWindowDimensions } from "react-native"; import { StateBox } from "./StateBox"; +import { PositionBox } from "./PositionBox"; import { useDeviceOrientationChange } from "../../../stateBox/useDeviceOrientationChange"; import { getStationList2 } from "../../../lib/getStationList"; import { useCurrentTrain } from "../../../stateBox/useCurrentTrain"; @@ -53,14 +54,6 @@ export const TrainDataView = ({ getStationList2().then(setMapsStationData); }, []); const onLine = !!currentPosition?.toString().length; - const trainPositionText = (trainData) => { - const { isBetween, Pos: PosData } = trainPosition(trainData); - const { from, to, Pos } = PosData; - if (isBetween === true) return `${from}~${to}`; - if (Pos == "") return ""; - if (platformNumber) return `${Pos} ${platformNumber}番乗り場`; - if (lineNumber) return `${Pos} ${lineNumber}番線`; - }; const [dialog, setDialog] = useState(false); const [deleteDialog, setDeleteDialog] = useState(false); const [posInput, setPosInput] = useState(""); @@ -148,10 +141,12 @@ export const TrainDataView = ({ SheetManager.hide("EachTrainInfo"); }} > - Date: Tue, 12 Aug 2025 18:27:06 +0000 Subject: [PATCH 4/8] =?UTF-8?q?=E6=AE=B5=E9=9A=8E=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/PositionBox.tsx | 76 +++++++++++-------- .../EachTrainInfo/TrainDataView.js | 2 +- 2 files changed, 45 insertions(+), 33 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx index 187d0ff..9a41c1e 100644 --- a/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx +++ b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx @@ -1,6 +1,6 @@ import { trainPosition } from "@/lib/trainPositionTextArray"; -import React, { CSSProperties, FC } from "react"; -import { View, Text, StyleProp, TextStyle, ViewStyle } from "react-native"; +import React, { FC } from "react"; +import { View, Text, TextStyle, ViewStyle } from "react-native"; type stateBox = { currentTrainData: any; @@ -8,7 +8,7 @@ type stateBox = { title: string; style?: ViewStyle; mode?: number; - endText?: string; + platformDescription: string; lineNumber: string; }; export const PositionBox: FC = (props) => { @@ -18,44 +18,55 @@ export const PositionBox: FC = (props) => { title, style, mode, - endText, + platformDescription, lineNumber, } = props; - const trainPositionText = (trainData) => { - const { isBetween, Pos: PosData } = trainPosition(trainData); - if (isBetween === true) { - const { from, to } = PosData; - return `${from}~${to}`; - } else { - const { Pos } = PosData; - if (Pos == "") return ""; - if (platformNumber) return `${Pos} ${platformNumber}番乗り場`; - if (lineNumber) return `${Pos} ${lineNumber}番線`; + let firstText = ""; + let secondText = ""; + let marginText = ""; + let externalText = ""; + const { isBetween, Pos: PosData } = trainPosition(currentTrainData); + if (isBetween === true) { + const { from, to } = PosData; + firstText = from; + secondText = to; + marginText = mode == 2 ? "→" : "↓"; + } else { + const { Pos } = PosData; + if (Pos !== "") { + firstText = Pos; + if (platformNumber) { + secondText = `${platformNumber}番乗り場`; + if (lineNumber) { + externalText = `${lineNumber}番線`; + } + } else if (lineNumber) { + secondText = `${lineNumber}番線`; + } } - }; - const text = trainPositionText(currentTrainData); + } return ( {title} - {text?.match("~") ? ( - <> - - {text.split("~")[0]} - - - {mode == 2 ? "→" : "↓"} - - - {text.split("~")[1]} - - - ) : ( - {text} + {firstText && ( + + {firstText} + + )} + {marginText && ( + + {marginText} + + )} + {secondText && ( + + {secondText} + )} - {endText && ( + {(platformDescription || externalText) && ( = (props) => { fontSize: 10, }} > - {endText} + {" " + externalText} + {" " + platformDescription} )} diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 4e89aec..75ca93b 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -147,7 +147,7 @@ export const TrainDataView = ({ currentTrainData={currentTrainData} platformNumber={platformNumber} lineNumber={lineNumber} - endText={platformDescription ? `${platformDescription}` : ""} + platformDescription={platformDescription ? `${platformDescription}` : ""} style={ onLine ? { borderWidth: 1, borderColor: "red", borderStyle: "solid" } From fe5baba0376ba5770b4be3d2cc4a42a0fe268d91 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 13 Aug 2025 11:33:07 +0000 Subject: [PATCH 5/8] =?UTF-8?q?=E9=A0=85=E7=9B=AE=E3=81=AE=E6=9C=80?= =?UTF-8?q?=E9=81=A9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/TrainDataView.js | 29 +++--- components/発車時刻表/EachData.tsx | 15 ++-- .../LED_inside_Component/TrainPosition.tsx | 88 ++++++++++++------- .../TrainPositionDataPush.tsx | 34 ++++--- 4 files changed, 90 insertions(+), 76 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 75ca93b..9dd81fa 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -38,7 +38,14 @@ export const TrainDataView = ({ .then((res) => res.json()) .then((data) => { if (!data) return; - const {type, stationName, lineNumber, platformNumber, position, description} = data; + const { + type, + stationName, + lineNumber, + platformNumber, + position, + description, + } = data; if (type == "Station") { setLineNumber(lineNumber); setPlatformNumber(platformNumber); @@ -55,10 +62,8 @@ export const TrainDataView = ({ }, []); const onLine = !!currentPosition?.toString().length; 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(""); const [lineInput, setLineInput] = useState(""); return ( @@ -67,18 +72,13 @@ export const TrainDataView = ({ dialog={dialog} setDialog={setDialog} currentTrainData={currentTrainData} - stationInput={stationInput} stationNumberInput={stationNumberInput} - posInput={posInput} - descInput={descInput} - setPosInput={setPosInput} - setDescInput={setDescInput} lineInput={lineInput} setLineInput={setLineInput} - station={{ - Station_JP: currentTrainData?.Pos, - StationNumber: currentPosition[0], - }} + posInput={posInput} + setPosInput={setPosInput} + descInput={descInput} + setDescInput={setDescInput} /> = (props) => { setDialog={setDialog} {...{ currentTrainData, - stationInput, stationNumberInput, - posInput, - descInput, - setPosInput, - setDescInput, - station, lineInput, setLineInput, + posInput, + setPosInput, + descInput, + setDescInput }} /> = (props) => { setPlatformNumber={setPlatformNumber} platformDescription={platformDescription} platformNumber={platformNumber} + lineInput={lineInput} + setLineInput={setLineInput} key={d.train + "-trainPosition"} /> )} diff --git a/components/発車時刻表/LED_inside_Component/TrainPosition.tsx b/components/発車時刻表/LED_inside_Component/TrainPosition.tsx index 7e41950..a371f7c 100644 --- a/components/発車時刻表/LED_inside_Component/TrainPosition.tsx +++ b/components/発車時刻表/LED_inside_Component/TrainPosition.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect } from "react"; +import React, { FC, useEffect, useState } from "react"; import { Text, TextStyle, View, TouchableOpacity } from "react-native"; import { useStationList } from "../../../stateBox/useStationList"; import { @@ -24,9 +24,11 @@ type Props = { setDialog: (dialog: boolean) => void; setDeleteDialog: (dialog: boolean) => void; platformDescription: string; - platformNumber: number; + platformNumber: string; setPlatformDescription: (desc: string) => void; - setPlatformNumber: (num: number) => void; + setPlatformNumber: (num: string) => void; + lineInput: string; + setLineInput: (line: string) => void; }; export const TrainPosition: FC = ({ @@ -43,27 +45,55 @@ export const TrainPosition: FC = ({ setPlatformNumber, platformDescription, platformNumber, + setLineInput, }) => { - const { currentTrain } = useCurrentTrain(); const { stationList } = useStationList(); - + type data = { + type: string; + lineNumber: string; + platformNumber: string; + position: string; + stationName: string; + description: string; + }; + const [database, setDatabase] = useState(null); + const [text, setText] = useState(""); + const [masterText, setMasterText] = useState(""); + useEffect(() => { + const text = `${currentTrainData?.PosNum} ${currentTrainData?.Line} ${currentTrainData?.Pos}`; + setText(trainIDSwitch ? text : masterText); + return () => { + setText(""); + }; + }, [masterText, trainIDSwitch]); useEffect(() => { fetch( `https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3?PosId=${currentTrainData?.PosNum}&lineName=${currentTrainData?.Line}&StationName=${currentTrainData?.Pos}` ) .then((res) => res.json()) - .then((data: { type: string; platform: number; description: string }) => { - const { type, platform, description } = data; - setPlatformNumber(type == "Station" ? platform : undefined); - setPlatformDescription(type == "Station" ? description : undefined); + .then((data: data) => { + const { type, platformNumber, description, lineNumber } = data; + setDatabase(data); + const { isBetween, Pos } = trainPosition(currentTrainData); + if (isBetween === true) { + // 移動中 + setMasterText(`現在地:${Pos.from}→${Pos.to}間を走行中`); + } else { + if (Pos.Pos) { + let platform = platformNumber ? `${platformNumber}番乗り場` : ""; + let line = lineNumber ? `${lineNumber}番線` : ""; + setMasterText( + `現在地:${Pos.Pos} ${platform || line} ${description || ""}` + ); + } else { + setMasterText(""); + } + } }); - }, [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 () => { + setMasterText(""); + }; + }, [currentTrainData?.PosNum, currentTrainData?.Line, currentTrainData?.Pos]); return ( = ({ }} onLongPress={() => { const { isBetween, Pos } = trainPosition(currentTrainData); + setStationNumberInput(getStationID(currentTrainData?.Pos, stationList)); + setPosInput(database?.platformNumber?.toString() || ""); if (isBetween === true) { - if (platformNumber == undefined && platformDescription == undefined) + if (database?.platformNumber == undefined && database?.description == 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() || ""); + setStationInput(currentTrainData?.Pos); + setDescInput(database?.description || ""); + setLineInput(database?.lineNumber?.toString() || ""); + setPlatformNumber(database?.platformNumber?.toString() || ""); setDialog(true); } }} @@ -104,13 +130,7 @@ export const TrainPosition: FC = ({ style={{ ...descriptionStyle, color: "green" }} numberOfLines={numberOfLines} > - {`${ - trainIDSwitch - ? currentTrainData?.PosNum + currentTrainData?.Line - : trainPositionText(currentTrainData) - } ${platformNumber ? platformNumber + "番線" : ""} ${ - platformDescription ? "(" + platformDescription + ")" : "" - }`} + {text} diff --git a/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx b/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx index 59cdaf3..7145ef1 100644 --- a/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx +++ b/components/発車時刻表/LED_inside_Component/TrainPositionDataPush.tsx @@ -1,13 +1,13 @@ -import React, { FC, useState } from "react"; +import React, { FC } 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"; +import { getStationID } from "@/lib/eachTrainInfoCoreLib/getStationData"; +import { useStationList } from "@/stateBox/useStationList"; type Props = { dialog: boolean; setDialog: (dialog: boolean) => void; currentTrainData: trainDataType; - stationInput: string; stationNumberInput: string; posInput: string; descInput: string; @@ -15,37 +15,33 @@ type Props = { setPosInput: (pos: string) => void; setDescInput: (desc: string) => void; setLineInput: (line: string) => void; - station: { - Station_JP: string; - StationNumber: string; - }; + }; export const TrainPositionDataPush: FC = ({ dialog, setDialog, currentTrainData, - stationInput, stationNumberInput, lineInput, setLineInput, posInput, - descInput, setPosInput, + descInput, setDescInput, - station, }) => { + const { stationList } = useStationList(); const sendPlatformData = () => { fetch(`https://n8n.haruk.in/webhook/JR-shikoku-PosID-v3`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ - PosId: currentTrainData?.PosNum,//自動:位置情報ID - StationId: station.StationNumber,//自動:駅ID - StationName: station.Station_JP,//自動:駅名、漢字 - lineName: currentTrainData?.Line,//自動:位置情報路線ID(koutoku/yosan) - Description: descInput,//手動入力、参考情報 - platformNumber: parseInt(posInput),//手動入力、乗り場表記 - lineNumber: parseInt(lineInput),//手動入力、番線表記 + PosId: currentTrainData?.PosNum, //自動:位置情報ID + StationId: getStationID(currentTrainData?.Pos, stationList), //自動:駅ID + StationName: currentTrainData?.Pos, //自動:駅名、漢字 + lineName: currentTrainData?.Line, //自動:位置情報路線ID(koutoku/yosan) + Description: descInput, //手動入力、参考情報 + platformNumber: parseInt(posInput), //手動入力、乗り場表記 + lineNumber: parseInt(lineInput), //手動入力、番線表記 }), }) .then(() => { @@ -60,9 +56,10 @@ export const TrainPositionDataPush: FC = ({ }; return ( setDialog(false)}> + 駅番線情報投稿機能 路線: {currentTrainData?.Line} 地点ID: {currentTrainData?.PosNum} - 駅名: {stationInput} + 駅名: {currentTrainData?.Pos} 駅ナンバー: {stationNumberInput} = ({ value={descInput} onChangeText={setDescInput} /> + この機能は駅の停車位置に関する情報を投稿する機能です。列車の遅れ、運行情報を投稿するフォームではありませんのでご注意ください。 ); From fdc8b95406c3c02f1d8a8b15e85a5b8a313a5151 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 13 Aug 2025 12:19:04 +0000 Subject: [PATCH 6/8] =?UTF-8?q?=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=81=AE=E3=82=B5=E3=82=A4=E3=82=BA=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/PositionBox.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx index 9a41c1e..ed962e5 100644 --- a/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx +++ b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx @@ -51,7 +51,7 @@ export const PositionBox: FC = (props) => { {firstText && ( - + {firstText} )} @@ -61,7 +61,7 @@ export const PositionBox: FC = (props) => { )} {secondText && ( - + {secondText} )} @@ -101,6 +101,19 @@ const boxTextStyle2: TextStyle = { color: "#0099CC", textAlign: "right", }; +const boxTextStyleBig: TextStyle = { + fontSize: 28, + color: "#0099CC", + textAlign: "right", +}; + + +const boxTextStyleMini: TextStyle = { + fontSize: 16, + color: "#0099CC", + textAlign: "right", +}; + const boxTextStyle: TextStyle = { fontSize: 25, From dc552aada46593207591de94ab53cd93f5c7627e Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 13 Aug 2025 12:40:17 +0000 Subject: [PATCH 7/8] =?UTF-8?q?alert=E3=81=AB=E8=BB=8A=E4=B8=A1=E6=83=85?= =?UTF-8?q?=E5=A0=B1=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfoCore/HeaderText.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx b/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx index 2a4ad6b..5468647 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx +++ b/components/ActionSheetComponents/EachTrainInfoCore/HeaderText.tsx @@ -58,8 +58,9 @@ export const HeaderText: FC = ({ infogram, isEdit, uwasa, + vehicleFormation, ] = useMemo(() => { - const { type, trainName, trainNumDistance, infogram, isEdit, uwasa } = + const { type, trainName, trainNumDistance, infogram, isEdit, uwasa, vehicleFormation } = customTrainDataDetector(trainNum, allCustomTrainData); const [typeString, fontAvailable, isOneMan] = getStringConfig( type, @@ -80,6 +81,7 @@ export const HeaderText: FC = ({ infogram, isEdit, uwasa, + vehicleFormation ]; case trainData[trainData.length - 1] === undefined: return [ @@ -90,6 +92,7 @@ export const HeaderText: FC = ({ infogram, isEdit, uwasa, + vehicleFormation ]; default: // 行先がある場合は、行先を取得 @@ -103,6 +106,7 @@ export const HeaderText: FC = ({ infogram, isEdit, uwasa, + vehicleFormation ]; } }, [trainData]); @@ -146,7 +150,7 @@ export const HeaderText: FC = ({ style={{ marginLeft: 5 }} onPress={() => alert( - `[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n↓投稿者メモ↓\n${uwasa}` + `[このアイコン、列車データはコミュニティによってリアルタイム追加されています。]\n使用車両情報:\n${vehicleFormation}\n投稿者メモ:\n${uwasa || "なし"}` ) } /> From 911d6942f6a6c33f8e29247ed362cfa0e78acad2 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 13 Aug 2025 12:50:37 +0000 Subject: [PATCH 8/8] 6.1.4 --- components/Menu/FixedContentBottom.js | 13 +++++++++++++ components/Settings/SettingTopPage.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/Menu/FixedContentBottom.js b/components/Menu/FixedContentBottom.js index c900df6..1f08cb2 100644 --- a/components/Menu/FixedContentBottom.js +++ b/components/Menu/FixedContentBottom.js @@ -197,6 +197,19 @@ export const FixedContentBottom = (props) => { その他 + Linking.openURL("https://twitter.com/Xprocess_main/status/1955242437817012300")} + + > + + 公式Discordのご案内 + + + 皆さんの目撃情報をアプリに反映しませんか?Discordに登録して運用を報告しましょう! + +