Compare commits

..

No commits in common. "f0964d8fb79fae6b9ac5780460a32ec9bb4c35a2" and "af61173e9d8132bf9df73d3ec72e50e29d656959" have entirely different histories.

2 changed files with 7 additions and 13 deletions

View File

@ -26,6 +26,7 @@ function DateTimeSelector({datetime, setDatetime}) {
Modifier la date et l'heure de recherche :
</FormLabel>
<DateTimePicker name="date" label="Date" onChange={setDatetime} value={datetime} />
<Button type="submit">Rechercher</Button>
</Box>
</>
}
@ -35,11 +36,7 @@ function Station() {
let {theme, stationId} = useParams()
// eslint-disable-next-line no-unused-vars
let [searchParams, setSearchParams] = useSearchParams()
const [datetime, setDatetime] = useState(dayjs(searchParams.get('time') || undefined))
if (datetime.format() !== searchParams.get('time')) {
searchParams.set('time', datetime.format())
window.history.replaceState({}, '', '?' + searchParams.toString())
}
const [datetime, setDatetime] = useState(dayjs())
useQueryClient()
const stationQuery = useQuery({

View File

@ -69,10 +69,10 @@ function TrainsTableBody({station, datetime, tableType}) {
.then(response => response.json())
.then(data => data.stopTimes)
.then(data => [...data])
}, [station.stopId, tableType, datetime])
}, [station.stopId, datetime, tableType])
const trainsQuery = useQuery({
queryKey: ['trains', station.stopId, tableType, datetime],
queryKey: ['trains', station.stopId, tableType],
queryFn: updateTrains,
enabled: !!station.stopId,
})
@ -202,13 +202,9 @@ function getTrainType(train) {
default:
return trainType
}
case "FR-IDFM":
const route_split = train.routeShortName.split(" ")
if (route_split[0] === "Bus")
return route_split[1]
return route_split[0]
case "FR-IDF-IDFM":
case "FR-GES-CTS":
return train.routeShortName.split(" ")[1]
return "A"
case "FR-EUROSTAR":
return "Eurostar"
case "IT-FRA-TI":
@ -220,6 +216,7 @@ function getTrainType(train) {
return "NJ"
return "ÖBB"
case "CH-ALL":
return "A"
default:
return train.routeShortName?.split(" ")[0]
}