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