diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 70bf408..9d6ca8b 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -1,5 +1,4 @@ export * from './ui.ts'; -export * from './meteo.ts'; export const pad = (n: string | number) => { if (n === null || n === undefined) { diff --git a/src/lib/utils/location.ts b/src/lib/utils/location.ts index 4a2c3d7..6074e75 100644 --- a/src/lib/utils/location.ts +++ b/src/lib/utils/location.ts @@ -2,7 +2,10 @@ import { error, redirect } from '@sveltejs/kit'; import { type GeoLocation, storedLocation } from '$lib/stores/settings'; -import { geoLocationNameToRoute } from '$lib/utils/meteo'; +export const geoLocationNameToRoute = (name: string) => { + const lowerCase = name.toLowerCase().replaceAll(' ', '-'); + return lowerCase.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); +}; export function buildLocationRoute(location: GeoLocation): string { const locationRoute = geoLocationNameToRoute(location.name); @@ -61,6 +64,8 @@ export async function resolveLocationFromRoute({ const split = urlLocation.split('_'); urlLocationName = split[0]; urlLocationId = split[1]; + } else if (urlLocation.includes('-')) { + urlLocationName = urlLocation.replace(/-/g, ' '); } else if (/^\d+$/.test(urlLocation)) { urlLocationName = ''; urlLocationId = urlLocation; diff --git a/src/lib/utils/meteo.ts b/src/lib/utils/meteo.ts index cb08070..8b13789 100644 --- a/src/lib/utils/meteo.ts +++ b/src/lib/utils/meteo.ts @@ -1,7 +1 @@ -export function geoLocationNameToRoute(name: string): string { - // Placeholder implementation - return name - .toLowerCase() - .replace(/[^a-z0-9]+/g, '-') - .replace(/^-*|-*$/g, ''); -} + diff --git a/src/routes/weather/compare/[location]/ModelPictogramTimeline.svelte b/src/routes/weather/compare/[location]/ModelPictogramTimeline.svelte index 22567c5..d97b67f 100644 --- a/src/routes/weather/compare/[location]/ModelPictogramTimeline.svelte +++ b/src/routes/weather/compare/[location]/ModelPictogramTimeline.svelte @@ -98,7 +98,7 @@ > Model - {#each filteredIndices as idx, i} + {#each filteredIndices as idx, i (idx)} {@const ts = timestamps[idx]} {@const isNewDay = checkNewDay(i, ts)}