Compare commits
No commits in common. "f0964d8fb79fae6b9ac5780460a32ec9bb4c35a2" and "af61173e9d8132bf9df73d3ec72e50e29d656959" have entirely different histories.
f0964d8fb7
...
af61173e9d
|
@ -26,6 +26,7 @@ function DateTimeSelector({datetime, setDatetime}) {
|
||||||
Modifier la date et l'heure de recherche :
|
Modifier la date et l'heure de recherche :
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<DateTimePicker name="date" label="Date" onChange={setDatetime} value={datetime} />
|
<DateTimePicker name="date" label="Date" onChange={setDatetime} value={datetime} />
|
||||||
|
<Button type="submit">Rechercher</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
@ -35,11 +36,7 @@ function Station() {
|
||||||
let {theme, stationId} = useParams()
|
let {theme, stationId} = useParams()
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
let [searchParams, setSearchParams] = useSearchParams()
|
let [searchParams, setSearchParams] = useSearchParams()
|
||||||
const [datetime, setDatetime] = useState(dayjs(searchParams.get('time') || undefined))
|
const [datetime, setDatetime] = useState(dayjs())
|
||||||
if (datetime.format() !== searchParams.get('time')) {
|
|
||||||
searchParams.set('time', datetime.format())
|
|
||||||
window.history.replaceState({}, '', '?' + searchParams.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
useQueryClient()
|
useQueryClient()
|
||||||
const stationQuery = useQuery({
|
const stationQuery = useQuery({
|
||||||
|
|
|
@ -69,10 +69,10 @@ function TrainsTableBody({station, datetime, tableType}) {
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => data.stopTimes)
|
.then(data => data.stopTimes)
|
||||||
.then(data => [...data])
|
.then(data => [...data])
|
||||||
}, [station.stopId, tableType, datetime])
|
}, [station.stopId, datetime, tableType])
|
||||||
|
|
||||||
const trainsQuery = useQuery({
|
const trainsQuery = useQuery({
|
||||||
queryKey: ['trains', station.stopId, tableType, datetime],
|
queryKey: ['trains', station.stopId, tableType],
|
||||||
queryFn: updateTrains,
|
queryFn: updateTrains,
|
||||||
enabled: !!station.stopId,
|
enabled: !!station.stopId,
|
||||||
})
|
})
|
||||||
|
@ -202,13 +202,9 @@ function getTrainType(train) {
|
||||||
default:
|
default:
|
||||||
return trainType
|
return trainType
|
||||||
}
|
}
|
||||||
case "FR-IDFM":
|
case "FR-IDF-IDFM":
|
||||||
const route_split = train.routeShortName.split(" ")
|
|
||||||
if (route_split[0] === "Bus")
|
|
||||||
return route_split[1]
|
|
||||||
return route_split[0]
|
|
||||||
case "FR-GES-CTS":
|
case "FR-GES-CTS":
|
||||||
return train.routeShortName.split(" ")[1]
|
return "A"
|
||||||
case "FR-EUROSTAR":
|
case "FR-EUROSTAR":
|
||||||
return "Eurostar"
|
return "Eurostar"
|
||||||
case "IT-FRA-TI":
|
case "IT-FRA-TI":
|
||||||
|
@ -220,6 +216,7 @@ function getTrainType(train) {
|
||||||
return "NJ"
|
return "NJ"
|
||||||
return "ÖBB"
|
return "ÖBB"
|
||||||
case "CH-ALL":
|
case "CH-ALL":
|
||||||
|
return "A"
|
||||||
default:
|
default:
|
||||||
return train.routeShortName?.split(" ")[0]
|
return train.routeShortName?.split(" ")[0]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue