diff options
feat: small changes
Diffstat (limited to 'src/routes/(app)/fahrplan')
-rw-r--r-- | src/routes/(app)/fahrplan/+page.svelte | 30 | ||||
-rw-r--r-- | src/routes/(app)/fahrplan/route/[id]/+page.svelte | 1 |
2 files changed, 11 insertions, 20 deletions
diff --git a/src/routes/(app)/fahrplan/+page.svelte b/src/routes/(app)/fahrplan/+page.svelte index 336c7bb..7584530 100644 --- a/src/routes/(app)/fahrplan/+page.svelte +++ b/src/routes/(app)/fahrplan/+page.svelte @@ -10,24 +10,11 @@ import { page } from '$app/state'; import { m } from '$lib/paraglide/messages'; import motis from '$lib/motis-api'; - import { placeNameMap } from '$lib/aliases'; - - const normaliseGermanUmlauts = (n: string) => { - return n - .replace(/ü/gu, 'ue') - .replace(/Ü/gu, 'UE') - .replace(/ä/gu, 'ae') - .replace(/Ä/gu, 'AE') - .replace(/ö/gu, 'oe') - .replace(/ß/gu, 'ss'); - }; - const normalisePlaceName = (n: string) => - placeNameMap.has(n.toLowerCase()) ? placeNameMap.get(n.toLowerCase())! : n; - const arePlacenamesEqual = (n1: string, n2: string) => - normalisePlaceName( - normaliseGermanUmlauts(n1).toUpperCase() - ).toUpperCase() === - normalisePlaceName(normaliseGermanUmlauts(n2)).toUpperCase(); + import { + arePlacenamesEqual, + normalisePlaceName, + placeNameMap, + } from '$lib/aliases'; let searchQuery = $state(''); let searchSuggestionIdx = $state(0); @@ -107,7 +94,10 @@ let stopTimes = $state(null as null | StoptimesResponse); let hasQueriedResults = $state(false); let renderedObjectIdName = $derived( - normalisePlaceName(objectIdName || (stopTimes?.place?.name ?? '')) + normalisePlaceName( + objectIdName || (stopTimes?.place?.name ?? ''), + objectId ?? undefined + ) ); const search = async (query: string) => { @@ -190,7 +180,7 @@ progressKind = 'fetch'; try { resultsLoopCancel = new AbortController(); - const json = await motis.getStopTimes( + const json = await motis.getStationTimetable( objectId, resultsLoopCancel.signal, isArrivals diff --git a/src/routes/(app)/fahrplan/route/[id]/+page.svelte b/src/routes/(app)/fahrplan/route/[id]/+page.svelte new file mode 100644 index 0000000..5bf03f4 --- /dev/null +++ b/src/routes/(app)/fahrplan/route/[id]/+page.svelte @@ -0,0 +1 @@ +<script lang="ts"></script> |