項目の最適化
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
<View
|
||||
style={{
|
||||
@@ -100,15 +100,12 @@ export const TrainDataView = ({
|
||||
platformDescription == undefined
|
||||
)
|
||||
return;
|
||||
setStationInput(`${Pos.from}→${Pos.to}間`);
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
setPosInput(platformNumber?.toString() || "");
|
||||
setLineInput(lineNumber?.toString() || "");
|
||||
setDeleteDialog(true);
|
||||
} else {
|
||||
setStationInput(Pos.Pos);
|
||||
setStationNumberInput(
|
||||
getStationID(currentTrainData?.Pos, stationList)
|
||||
);
|
||||
@@ -147,7 +144,7 @@ export const TrainDataView = ({
|
||||
currentTrainData={currentTrainData}
|
||||
platformNumber={platformNumber}
|
||||
lineNumber={lineNumber}
|
||||
platformDescription={platformDescription ? `${platformDescription}` : ""}
|
||||
platformDescription={platformDescription || ""}
|
||||
style={
|
||||
onLine
|
||||
? { borderWidth: 1, borderColor: "red", borderStyle: "solid" }
|
||||
|
Reference in New Issue
Block a user