From f6354dcd562d7c2c8a20604f5abe095a2cdb932e Mon Sep 17 00:00:00 2001 From: slothful-vassal <89943360+slothful-vassal@users.noreply.github.com> Date: Wed, 1 Apr 2026 19:07:27 +0200 Subject: [PATCH] narrow-wide trail list view mode added (#666) * narrow-wide trail list view mode added * change icon, change pos, add i18n * change icon --------- Co-authored-by: Christian Beutel <> Co-authored-by: Flomp --- .../lib/components/trail/trail_list.svelte | 57 ++++++--- web/src/lib/i18n/locales/cs.json | 12 ++ web/src/lib/i18n/locales/de.json | 6 +- web/src/lib/i18n/locales/en.json | 6 +- web/src/lib/i18n/locales/es.json | 12 ++ web/src/lib/i18n/locales/eu.json | 12 ++ web/src/lib/i18n/locales/fr.json | 12 ++ web/src/lib/i18n/locales/hu.json | 12 ++ web/src/lib/i18n/locales/it.json | 12 ++ web/src/lib/i18n/locales/nl.json | 12 ++ web/src/lib/i18n/locales/no.json | 12 ++ web/src/lib/i18n/locales/pl.json | 12 ++ web/src/lib/i18n/locales/pt.json | 12 ++ web/src/lib/i18n/locales/ru.json | 12 ++ web/src/lib/i18n/locales/zh.json | 12 ++ web/src/routes/trails/+page.svelte | 110 ++++++++++++++++-- 16 files changed, 290 insertions(+), 33 deletions(-) diff --git a/web/src/lib/components/trail/trail_list.svelte b/web/src/lib/components/trail/trail_list.svelte index c6614b2d..92c71d62 100644 --- a/web/src/lib/components/trail/trail_list.svelte +++ b/web/src/lib/components/trail/trail_list.svelte @@ -10,12 +10,13 @@ import SkeletonCard from "../base/skeleton_card.svelte"; import SkeletonListItem from "../base/skeleton_list_item.svelte"; import { onMount, tick } from "svelte"; + import type { Snippet } from "svelte"; import TrailDropdown from "$lib/components/trail/trail_dropdown.svelte"; interface Props { filter?: TrailFilter | null; trails: Trail[]; - pagination?: { page: number; totalPages: number, items: number }; + pagination?: { page: number; totalPages: number; items: number }; loading?: boolean; fullWidthCards?: boolean; onupdate?: ( @@ -23,6 +24,8 @@ selection: Set | undefined, ) => void; onpagination?: (page: number, items: number) => void; + ondisplaychange?: (display: string) => void; + trailWidthToggleSnippet?: Snippet; } let { @@ -37,6 +40,8 @@ fullWidthCards = false, onupdate, onpagination, + ondisplaychange, + trailWidthToggleSnippet: trailWidthToggleSnippet, }: Props = $props(); const displayOptions: SelectItem[] = [ @@ -44,14 +49,14 @@ { text: $_("list", { values: { n: 1 } }), value: "list" }, { text: $_("table"), value: "table" }, ]; - + const perPageOptions: SelectItem[] = [ { text: "10", value: 10 }, { text: "25", value: 25 }, { text: "50", value: 50 }, { text: "100", value: 100 }, ]; - + const perPageOptionsCards: SelectItem[] = [ { text: "12", value: 12 }, { text: "24", value: 24 }, @@ -64,6 +69,10 @@ let selection: Set | undefined = $state(); let hoveredTrail: Trail | undefined = $state(); + function notifyDisplayChange() { + ondisplaychange?.(selectedDisplayOption); + } + const sortOptions: SelectItem[] = [ { text: $_("name"), value: "name" }, { text: $_("distance"), value: "distance" }, @@ -96,7 +105,7 @@ } if (paginationItems) { pagination.items = +paginationItems; - + let itemsChanged = false; if (selectedDisplayOption == "cards") { if (pagination.items > 50) { @@ -129,10 +138,14 @@ } if (itemsChanged) { - localStorage.setItem("paginationItems", pagination.items.toString()); + localStorage.setItem( + "paginationItems", + pagination.items.toString(), + ); } } onupdate?.(filter, selection); + notifyDisplayChange(); }); function setDisplayOption() { @@ -170,8 +183,12 @@ } if (itemsChanged) { - localStorage.setItem("paginationItems", pagination.items.toString()); + localStorage.setItem( + "paginationItems", + pagination.items.toString(), + ); } + notifyDisplayChange(); } function setSort() { @@ -304,7 +321,7 @@
-
+
{#if selection !== undefined && selection.size > 0} -
+

{$_("display-as")}

- - +
+ + {#if trailWidthToggleSnippet} + {@render trailWidthToggleSnippet?.()} + {/if} +
@@ -428,8 +449,8 @@ {/if} {/if}
-
-
+
+
diff --git a/web/src/lib/i18n/locales/cs.json b/web/src/lib/i18n/locales/cs.json index 4f454fa5..d41f2f87 100644 --- a/web/src/lib/i18n/locales/cs.json +++ b/web/src/lib/i18n/locales/cs.json @@ -72,6 +72,7 @@ "clear-all": "Vymazat vše", "climbing": "Horolezectví", "close": "Zavřít", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Komentář} few {Komentáře} other {Komentářů}}", "completed": "Dokončeno", "completed-a-trail": "dokončil/a trasu", @@ -148,6 +149,7 @@ "error-exporting-trail": "Chyba při exportování trasy", "error-generating-token": "", "error-liking-trail": "Chyba při lajkování trasy", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Chyba při přihlášení do Komootu", "error-posting-comment": "Chyba při vkládání komentáře", "error-printing-map": "Při tisku mapy došlo k chybě", @@ -155,10 +157,14 @@ "error-saving-list": "Chyba při ukládání seznamu", "error-saving-trail": "Chyba při ukládání trasy", "error-setting-up-integration": "Chyba během nastavování {provider} integrace", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Chyba během aktualizace hesla", "error-updating-strava-integration": "Chyba při aktualizaci Komoot integrace", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Odhadovaná doba trvání", "everyone-with-the-link": "Každý, kdo má odkaz", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Objevování", @@ -195,6 +201,7 @@ "get-started": "Začněte", "grid": "Mřížka", "grocery-store": "Potraviny", + "hammerhead-integration-after-date-hint": "", "heading": "Nadpis", "height": "Výška", "help": "Nápověda", @@ -210,11 +217,13 @@ "hut": "Chatka", "hybrid": "Hybridní", "icon": "Ikonka", + "ignore-trails-before-date": "", "imperial": "Imperiální jednotky", "import": "Importovat", "import-hint": "Vyberte nebo sem přetáhněte soubory GPX, FIT, KML, či TCX...", "include-description": "Zahrnout popis", "include-waypoints": "Zahrnout body trasy", + "integration-description-hammerhead": "", "integration-description-komoot": "Synchronizuje vaše trasy z aplikace Komoot s Wandererem v pravidelných intervalech.", "integration-description-strava": "Synchronizuje vaše trasy a aktivity z aplikace Strava s Wandererem v pravidelných intervalech.", "integration-disabled": "integrace zakázána", @@ -371,6 +380,7 @@ "search-trails": "Vyhledat trasy", "select-list": "Vybrat seznam", "selected": "vybráno", + "send-to": "", "set-private": "", "set-public": "", "settings": "Nastavení", @@ -429,6 +439,7 @@ "tourism": "Turismus", "trail": "{n, plural, =1 {Trasa} few {Trasy} other {Tras}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Není sdíleno s nikým", "trail-saved-successfully": "Trasa úspěšně uložena", @@ -441,6 +452,7 @@ "upload-gpx": "Nahrát GPX", "upload-new-file": "Nahrát nový soubor", "uploaded": "nahráno", + "uploaded-trail-to-hammerhead": "", "use-hills": "Použít kopce", "use-roads": "Použít silnice", "username": "Uživatelské jméno", diff --git a/web/src/lib/i18n/locales/de.json b/web/src/lib/i18n/locales/de.json index 15fbed5b..7ce03d46 100644 --- a/web/src/lib/i18n/locales/de.json +++ b/web/src/lib/i18n/locales/de.json @@ -72,6 +72,7 @@ "clear-all": "Alle ausblenden", "climbing": "Klettern", "close": "Schließen", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Kommentar} other {Kommentare}}", "completed": "Abgeschlossen", "completed-a-trail": "hat eine Route abgeschlossen", @@ -156,13 +157,14 @@ "error-saving-list": "Fehler beim Speichern der Liste", "error-saving-trail": "Fehler beim Speichern der Route", "error-setting-up-integration": "Fehler beim Einrichten der {provider}-Integration", - "error-updating-password": "Fehler beim Aktualisieren des Passworts", "error-updating-hammerhead-integration": "Fehler bei Aktualisierung der Hammerhead-Integration", "error-updating-komoot-integration": "Fehler bei Aktualisierung der komoot-Integration", + "error-updating-password": "Fehler beim Aktualisieren des Passworts", "error-updating-strava-integration": "Fehler bei Aktualisierung der Strava-Integration", "error-uploading-trail-to-hammerhead": "Fehler beim Hochladen der Route zu Hammerhead", "est-duration": "Gesch. Dauer", "everyone-with-the-link": "Jeder mit dem Link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Erkunden", @@ -436,8 +438,8 @@ "top-speed": "Höchstgeschwindigkeit", "tourism": "Tourismus", "trail": "{n, plural, =1 {Route} other {Routen}}", - "trail-has-no-gpx": "Diese Route besitzt keine GPX Daten.", "trail-copied-successfully": "Route erfolgreich kopiert", + "trail-has-no-gpx": "Diese Route besitzt keine GPX Daten.", "trail-not-in-list": "Trail gehört zu keiner Liste.", "trail-not-shared": "Mit niemandem geteilt", "trail-saved-successfully": "Route gespeichert", diff --git a/web/src/lib/i18n/locales/en.json b/web/src/lib/i18n/locales/en.json index d214a8e6..53143141 100644 --- a/web/src/lib/i18n/locales/en.json +++ b/web/src/lib/i18n/locales/en.json @@ -71,6 +71,7 @@ "clear-all": "Clear all", "climbing": "Climbing", "close": "Close", + "collapse-trail-list": "Collapse trail list", "comment": "{n, plural, =1 {Comment} other {Comments}}", "completed": "Completed", "completed-a-trail": "completed a trail", @@ -155,13 +156,14 @@ "error-saving-list": "Error saving list", "error-saving-trail": "Error saving trail", "error-setting-up-integration": "Error setting up {provider} integration", - "error-updating-password": "Error updating password", "error-updating-hammerhead-integration": "Error updating Hammerhead integration", "error-updating-komoot-integration": "Error updating komoot integration", + "error-updating-password": "Error updating password", "error-updating-strava-integration": "Error updating Strava integration", "error-uploading-trail-to-hammerhead": "Error uploading trail to Hammerhead", "est-duration": "Est. duration", "everyone-with-the-link": "Everyone with the link", + "expand-trail-list": "Expand trail list", "expiration": "Expiration", "expires": "Expires", "explore": "Explore", @@ -435,8 +437,8 @@ "top-speed": "Top Speed", "tourism": "Tourism", "trail": "{n, plural, =1 {Trail} other {Trails}}", - "trail-has-no-gpx": "This trail has no GPX data.", "trail-copied-successfully": "trail copied successfully", + "trail-has-no-gpx": "This trail has no GPX data.", "trail-not-in-list": "Trail is not in any list", "trail-not-shared": "Not shared with anyone", "trail-saved-successfully": "Trail saved successfully", diff --git a/web/src/lib/i18n/locales/es.json b/web/src/lib/i18n/locales/es.json index edfab7e5..58866c79 100644 --- a/web/src/lib/i18n/locales/es.json +++ b/web/src/lib/i18n/locales/es.json @@ -72,6 +72,7 @@ "clear-all": "Limpiar todo", "climbing": "Escalada", "close": "Cerrar", + "collapse-trail-list": "", "comment": "{n, plural, one {}=1 {Comentario} other {Comentarios}}", "completed": "Completado", "completed-a-trail": "completó una ruta", @@ -148,6 +149,7 @@ "error-exporting-trail": "Error exportando la ruta", "error-generating-token": "", "error-liking-trail": "Error al dar \"me gusta\" a la ruta", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Error al iniciar sesión en komoot", "error-posting-comment": "Error publicando el comentario", "error-printing-map": "Error durante la impresión del mapa", @@ -155,10 +157,14 @@ "error-saving-list": "Error guardando la lista", "error-saving-trail": "Error guardando la ruta", "error-setting-up-integration": "Error al configurar la integración con {provider}", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Error actualizando la contraseña", "error-updating-strava-integration": "Error al actualizar la integración con komoot", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Duración estimada", "everyone-with-the-link": "Cualquier persona con el enlace", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Explora", @@ -195,6 +201,7 @@ "get-started": "Iniciar", "grid": "Cuadricula", "grocery-store": "Supermercado", + "hammerhead-integration-after-date-hint": "", "heading": "Título", "height": "Altura", "help": "Ayuda", @@ -210,11 +217,13 @@ "hut": "Cabaña", "hybrid": "Hibrido", "icon": "Icono", + "ignore-trails-before-date": "", "imperial": "Imperial", "import": "Importar", "import-hint": "Selecciona o arrastra aquí archivos GPX, FIT, KML o TCX...", "include-description": "Incluir descripción", "include-waypoints": "Incluir puntos de interés", + "integration-description-hammerhead": "", "integration-description-komoot": "Sincroniza tus recorridos de Komoot con Wanderer en intervalos regulares.", "integration-description-strava": "Sincroniza tus recorridos y actividades de Strava con Wanderer en intervalos regulares.", "integration-disabled": "integración desactivada", @@ -371,6 +380,7 @@ "search-trails": "Buscar ruta", "select-list": "Seleccionar Lista", "selected": "seleccionado", + "send-to": "", "set-private": "", "set-public": "", "settings": "Configuración", @@ -429,6 +439,7 @@ "tourism": "Turismo", "trail": "{n, plural, one {}=1 {Ruta} other {Rutas}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "No compartida con nadie", "trail-saved-successfully": "Ruta guardada con éxito", @@ -441,6 +452,7 @@ "upload-gpx": "Cargar GPX", "upload-new-file": "Subir nuevo archivo", "uploaded": "cargado", + "uploaded-trail-to-hammerhead": "", "use-hills": "Usar cuestas", "use-roads": "Utilizar carreteras", "username": "Nombre de usuario", diff --git a/web/src/lib/i18n/locales/eu.json b/web/src/lib/i18n/locales/eu.json index 31bcf09f..8016eb0c 100644 --- a/web/src/lib/i18n/locales/eu.json +++ b/web/src/lib/i18n/locales/eu.json @@ -71,6 +71,7 @@ "clear-all": "Garbitu dena", "climbing": "Eskalada", "close": "Itxi", + "collapse-trail-list": "", "comment": "{n, plural, one {}=1 {iruzkin} other {iruzkin}}", "completed": "Osatuta", "completed-a-trail": "ibilbide bat egin du", @@ -147,6 +148,7 @@ "error-exporting-trail": "Errorea ibilbidea esportatzean", "error-generating-token": "", "error-liking-trail": "Errorea ibilbidea atsegitean", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Errorea komoot-en login egitean", "error-posting-comment": "Errorea iruzkina egitean", "error-printing-map": "Errorea mapa inprimatzean", @@ -154,10 +156,14 @@ "error-saving-list": "Errorea zerrenda gordetzean", "error-saving-trail": "Errorea ibilbidea gordetzean", "error-setting-up-integration": "Errorea {provider} integrazioa egitean", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Errorea pasahitza eguneratzean", "error-updating-strava-integration": "Errorea komoot integrazioa eguneratzean", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Ustezko iraupena", "everyone-with-the-link": "Esteka duen edonor", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Arakatu", @@ -194,6 +200,7 @@ "get-started": "Hasi", "grid": "Sareta", "grocery-store": "Janari-denda", + "hammerhead-integration-after-date-hint": "", "heading": "Goiburukoa", "height": "Altuera", "help": "Laguntza", @@ -209,11 +216,13 @@ "hut": "Aterpea", "hybrid": "Hibridoa", "icon": "Ikonoa", + "ignore-trails-before-date": "", "imperial": "Inperiala", "import": "Inportatu", "import-hint": "Aukeratu edo arrastatu hona GPX, FIT, KML edo TCX fitxategiak...", "include-description": "Gehitu deskribapena", "include-waypoints": "Gehitu bidepuntuak", + "integration-description-hammerhead": "", "integration-description-komoot": "Zure komooteko ibilbideak wandererekin sinkronizatzen ditu aldian behin.", "integration-description-strava": "Zure stravako ibilbideak wandererekin sinkronizatzen ditu aldian behin.", "integration-disabled": "integrazioa desaktibatuta", @@ -370,6 +379,7 @@ "search-trails": "Bilatu ibilaldiak", "select-list": "Aukeratu zerrenda", "selected": "aukeratuta", + "send-to": "", "set-private": "", "set-public": "", "settings": "Ezarpenak", @@ -428,6 +438,7 @@ "tourism": "Turismoa", "trail": "{n, plural, one {}=1 {ibilbide} other {ibilbide}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Inorekin partekatu gabe", "trail-saved-successfully": "Ibilbidea ondo gorde da", @@ -440,6 +451,7 @@ "upload-gpx": "Kargatu GPX", "upload-new-file": "Kargatu fitxategi berria", "uploaded": "kargatuta", + "uploaded-trail-to-hammerhead": "", "use-hills": "Erabili aldapak", "use-roads": "Erabili errepideak", "username": "Erabiltzaile-izena", diff --git a/web/src/lib/i18n/locales/fr.json b/web/src/lib/i18n/locales/fr.json index eb18fede..c01b27f5 100644 --- a/web/src/lib/i18n/locales/fr.json +++ b/web/src/lib/i18n/locales/fr.json @@ -72,6 +72,7 @@ "clear-all": "Cacher tous", "climbing": "Escalade", "close": "Fermer", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Commentaire} other {Commentaires}}", "completed": "Terminé", "completed-a-trail": "a terminé un parcours", @@ -148,6 +149,7 @@ "error-exporting-trail": "Erreur lors de l'export de l'itinéraire", "error-generating-token": "", "error-liking-trail": "Erreur de like de l'itinéraire", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Erreur de connexion à Komoot", "error-posting-comment": "Erreur lors de la publication du commentaire", "error-printing-map": "Erreur d'impression de la carte", @@ -155,10 +157,14 @@ "error-saving-list": "Erreur lors de l'enregistrement de la liste", "error-saving-trail": "Erreur lors de l'enregistrement de l'itinéraire", "error-setting-up-integration": "Error setting up strava integration", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Erreur lors de la mise à jour du mot de passe", "error-updating-strava-integration": "Erreur lors de la mise à jour de l'intégration Komoot", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Temps estimé", "everyone-with-the-link": "Tout le monde avec ce lien", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Explorer", @@ -195,6 +201,7 @@ "get-started": "C'est parti", "grid": "Grille", "grocery-store": "Épicerie", + "hammerhead-integration-after-date-hint": "", "heading": "Titre", "height": "Hauteur", "help": "Aide", @@ -210,11 +217,13 @@ "hut": "Cabane", "hybrid": "Hybride", "icon": "Icône", + "ignore-trails-before-date": "", "imperial": "Impérial", "import": "Importer", "import-hint": "Sélectionnez ou glissez des fichiers GPX, FIT, KML ou TCX ici...", "include-description": "Inclure la description", "include-waypoints": "Inclure les points de passage", + "integration-description-hammerhead": "", "integration-description-komoot": "Synchronisez vos Tours Komoot avec wanderer à intervalles réguliers.", "integration-description-strava": "Synchronisez vos itinéraires et vos activités Strava avec wanderer à intervalles réguliers.", "integration-disabled": "Intégration désactivée", @@ -371,6 +380,7 @@ "search-trails": "Chercher un itinéraire", "select-list": "Liste de choix", "selected": "sélectionné(s)", + "send-to": "", "set-private": "", "set-public": "", "settings": "Paramètres", @@ -429,6 +439,7 @@ "tourism": "Tourisme", "trail": "{n, plural, =1 {Itinéraire} other {Itinéraires}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "L'itinéraire n'a pas été partagé", "trail-saved-successfully": "Itinéraire enregistrée", @@ -441,6 +452,7 @@ "upload-gpx": "Envoyer un GPX", "upload-new-file": "Importer un fichier", "uploaded": "importé", + "uploaded-trail-to-hammerhead": "", "use-hills": "Utiliser les collines", "use-roads": "Utiliser les routes", "username": "Nom d'utilisateur", diff --git a/web/src/lib/i18n/locales/hu.json b/web/src/lib/i18n/locales/hu.json index 182999fd..6a2ca179 100644 --- a/web/src/lib/i18n/locales/hu.json +++ b/web/src/lib/i18n/locales/hu.json @@ -71,6 +71,7 @@ "clear-all": "Clear all", "climbing": "Climbing", "close": "Close", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Megjegyzés} other {Megjegyzés}}", "completed": "Teljesítve", "completed-a-trail": "completed a trail", @@ -147,6 +148,7 @@ "error-exporting-trail": "Error exporting trail", "error-generating-token": "", "error-liking-trail": "Error liking trail", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Error logging in to komoot", "error-posting-comment": "Error posting comment", "error-printing-map": "Error printing map", @@ -154,10 +156,14 @@ "error-saving-list": "Error saving list", "error-saving-trail": "Error saving trail", "error-setting-up-integration": "Error setting up strava integration", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Error updating password", "error-updating-strava-integration": "Error updating komoot integration", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Becsült időtartam", "everyone-with-the-link": "Everyone with the link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Felfedezés", @@ -194,6 +200,7 @@ "get-started": "Get started", "grid": "Grid", "grocery-store": "Grocery store", + "hammerhead-integration-after-date-hint": "", "heading": "Heading", "height": "Height", "help": "Help", @@ -209,11 +216,13 @@ "hut": "Hut", "hybrid": "Hybrid", "icon": "Ikon", + "ignore-trails-before-date": "", "imperial": "Angolszász", "import": "Import", "import-hint": "Select or drag GPX, FIT, KML or TCX files here...", "include-description": "Include description", "include-waypoints": "Útpontok hozzáadása", + "integration-description-hammerhead": "", "integration-description-komoot": "Syncs your komoot tours with wanderer in regular intervals.", "integration-description-strava": "Syncs your strava routes & activities with wanderer in regular intervals.", "integration-disabled": "integration disabled", @@ -370,6 +379,7 @@ "search-trails": "Nyomvonalak keresése", "select-list": "Lista kiválasztása", "selected": "selected", + "send-to": "", "set-private": "", "set-public": "", "settings": "Beállítások", @@ -428,6 +438,7 @@ "tourism": "Tourism", "trail": "{n, plural, =1 {Útvonal} other {Útvonalak}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Not shared with anyone", "trail-saved-successfully": "Trail saved successfully", @@ -440,6 +451,7 @@ "upload-gpx": "GPX feltöltése", "upload-new-file": "Upload new file", "uploaded": "uploaded", + "uploaded-trail-to-hammerhead": "", "use-hills": "Use hills", "use-roads": "Use Roads", "username": "Felhasználónév", diff --git a/web/src/lib/i18n/locales/it.json b/web/src/lib/i18n/locales/it.json index 46733891..7f7ae48b 100644 --- a/web/src/lib/i18n/locales/it.json +++ b/web/src/lib/i18n/locales/it.json @@ -71,6 +71,7 @@ "clear-all": "Clear all", "climbing": "Climbing", "close": "Chiudi", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Commento} other {Commenti}}", "completed": "Completato", "completed-a-trail": "percorso completato", @@ -147,6 +148,7 @@ "error-exporting-trail": "Errore durante l'esportazione del percorso", "error-generating-token": "", "error-liking-trail": "Error liking trail", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Error logging in to komoot", "error-posting-comment": "Errore pubblicando il commento", "error-printing-map": "Errore durante la stampa della mappa", @@ -154,10 +156,14 @@ "error-saving-list": "Errore salvando la lista", "error-saving-trail": "Errore nel salvataggio del percorso", "error-setting-up-integration": "Error setting up strava integration", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Errore nell'aggiornamento della password", "error-updating-strava-integration": "Error updating komoot integration", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Durata stimata", "everyone-with-the-link": "Everyone with the link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Esplora", @@ -194,6 +200,7 @@ "get-started": "Get started", "grid": "Griglia", "grocery-store": "Grocery store", + "hammerhead-integration-after-date-hint": "", "heading": "Heading", "height": "Height", "help": "Aiuto", @@ -209,11 +216,13 @@ "hut": "Hut", "hybrid": "Hybrid", "icon": "Icona", + "ignore-trails-before-date": "", "imperial": "Imperiale", "import": "Importa", "import-hint": "Seleziona o trascina qui i file GPX, FIT, KML o TCX...", "include-description": "Adotta descrizione", "include-waypoints": "Includi waypoint", + "integration-description-hammerhead": "", "integration-description-komoot": "Syncs your komoot tours with wanderer in regular intervals.", "integration-description-strava": "Syncs your strava routes & activities with wanderer in regular intervals.", "integration-disabled": "integration disabled", @@ -370,6 +379,7 @@ "search-trails": "Cerca percorsi", "select-list": "Seleziona lista", "selected": "selected", + "send-to": "", "set-private": "", "set-public": "", "settings": "Impostazioni", @@ -428,6 +438,7 @@ "tourism": "Tourism", "trail": "{n, plural, =1 {Percorso} other {Percorsi}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Percorso non condiviso con nessuno", "trail-saved-successfully": "Percorso salvato con successo", @@ -440,6 +451,7 @@ "upload-gpx": "Carica file GPX", "upload-new-file": "Upload new file", "uploaded": "caricato", + "uploaded-trail-to-hammerhead": "", "use-hills": "Use hills", "use-roads": "Use Roads", "username": "Nome utente", diff --git a/web/src/lib/i18n/locales/nl.json b/web/src/lib/i18n/locales/nl.json index 335ca30b..7726ecb9 100644 --- a/web/src/lib/i18n/locales/nl.json +++ b/web/src/lib/i18n/locales/nl.json @@ -72,6 +72,7 @@ "clear-all": "Wis alles", "climbing": "Klimmen", "close": "Sluiten", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Opmerking} other {Opmerkingen}}", "completed": "Voltooid", "completed-a-trail": "heeft een route voltooid", @@ -148,6 +149,7 @@ "error-exporting-trail": "Fout bij exporteren van parcours", "error-generating-token": "", "error-liking-trail": "Fout bij het \"leuk vinden\" van route", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Fout tijdens inloggen in Komoot", "error-posting-comment": "Fout bij het plaatsen van een reactie", "error-printing-map": "Fout bij afdrukken van kaart", @@ -155,10 +157,14 @@ "error-saving-list": "Fout bij bewaren van lijst", "error-saving-trail": "Fout bij bewaren van route", "error-setting-up-integration": "Fout bij opzetten {provider} integratie", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Fout bij bijwerken van wachtwoord", "error-updating-strava-integration": "Fout bij bijwerken van Komoot integratie", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Geschatte duur", "everyone-with-the-link": "Iedereen met de link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Verkennen", @@ -195,6 +201,7 @@ "get-started": "Aan de slag", "grid": "Rooster", "grocery-store": "Kruidenier", + "hammerhead-integration-after-date-hint": "", "heading": "Titel", "height": "Hoogte", "help": "Help", @@ -210,11 +217,13 @@ "hut": "Hut", "hybrid": "Hybride", "icon": "Pictogram", + "ignore-trails-before-date": "", "imperial": "Imperiaal", "import": "Importeer", "import-hint": "Selecteer of sleep GPX-, FIT-, KML- of TCX-bestanden hierheen...", "include-description": "Inclusief beschrijving", "include-waypoints": "Waypoints toevoegen", + "integration-description-hammerhead": "", "integration-description-komoot": "Synchroniseert je Komoot-tochten met Wanderer op regelmatige tijdstippen.", "integration-description-strava": "Synchroniseert je Strava-routes en -activiteiten met Wanderer op regelmatige tijdstippen.", "integration-disabled": "Integratie uitgeschakeld", @@ -371,6 +380,7 @@ "search-trails": "Zoek routes", "select-list": "Kies een lijst", "selected": "geselecteerd", + "send-to": "", "set-private": "", "set-public": "", "settings": "Instellingen", @@ -429,6 +439,7 @@ "tourism": "Toerisme", "trail": "{n, plural, =1 {Route} other {Routes}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Niet gedeeld met iemand", "trail-saved-successfully": "Route succesvol bewaard", @@ -441,6 +452,7 @@ "upload-gpx": "GPX-bestand uploaden", "upload-new-file": "Nieuw bestand uploaden", "uploaded": "geüpload", + "uploaded-trail-to-hammerhead": "", "use-hills": "Gebruik heuvels", "use-roads": "Gebruik wegen", "username": "Gebruikersnaam", diff --git a/web/src/lib/i18n/locales/no.json b/web/src/lib/i18n/locales/no.json index 9f390a0a..12c78f63 100644 --- a/web/src/lib/i18n/locales/no.json +++ b/web/src/lib/i18n/locales/no.json @@ -73,6 +73,7 @@ "clear-all": "Fjern alle", "climbing": "Klatring", "close": "Lukk", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Comment} other {Comments}}", "completed": "Fullført", "completed-a-trail": "fullførte en sti", @@ -149,6 +150,7 @@ "error-exporting-trail": "Feil ved eksport av sti", "error-generating-token": "", "error-liking-trail": "Feil ved likerklikk på sti", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Feil ved innlogging til Komoot", "error-posting-comment": "Feil ved posting av kommentar", "error-printing-map": "Feil ved utskrift av kart", @@ -156,10 +158,14 @@ "error-saving-list": "Feil ved lagring av liste", "error-saving-trail": "Feil ved lagring av sti", "error-setting-up-integration": "Feil ved oppsett av {provider}-integrasjon", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Feil ved oppdatering av passord", "error-updating-strava-integration": "Feil ved oppdatering av Komoot-integrasjon", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Est. varighet", "everyone-with-the-link": "Alle med lenken", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Utforsk", @@ -196,6 +202,7 @@ "get-started": "Kom i gang", "grid": "Rutenett", "grocery-store": "Dagligvarebutikk", + "hammerhead-integration-after-date-hint": "", "heading": "Overskrift", "height": "Høyde", "help": "Hjelp", @@ -211,11 +218,13 @@ "hut": "Hytte", "hybrid": "Hybrid", "icon": "Ikon", + "ignore-trails-before-date": "", "imperial": "Imperisk", "import": "Importer", "import-hint": "Velg eller dra GPX, FIT, KML eller TCX-filer hit...", "include-description": "Inkluder beskrivelse", "include-waypoints": "Inkluder veipunkter", + "integration-description-hammerhead": "", "integration-description-komoot": "Synkroniserer dine Komoot-turer med Wanderer med jevne mellomrom.", "integration-description-strava": "Synkroniserer dine Strava-ruter og aktiviteter med Wanderer med jevne mellomrom.", "integration-disabled": "integrasjon deaktivert", @@ -372,6 +381,7 @@ "search-trails": "Søk etter stier", "select-list": "Velg liste", "selected": "valgt", + "send-to": "", "set-private": "", "set-public": "", "settings": "Innstillinger", @@ -430,6 +440,7 @@ "tourism": "Turisme", "trail": "{n, plural, =1 {Sti} other {Stier}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Ikke delt med noen", "trail-saved-successfully": "Sti lagret", @@ -442,6 +453,7 @@ "upload-gpx": "Last opp GPX", "upload-new-file": "Last opp ny fil", "uploaded": "lastet opp", + "uploaded-trail-to-hammerhead": "", "use-hills": "Bruk bakker", "use-roads": "Bruk veier", "username": "Brukernavn", diff --git a/web/src/lib/i18n/locales/pl.json b/web/src/lib/i18n/locales/pl.json index 3201ad74..4b6821e8 100644 --- a/web/src/lib/i18n/locales/pl.json +++ b/web/src/lib/i18n/locales/pl.json @@ -71,6 +71,7 @@ "clear-all": "Wyczyść wszystko", "climbing": "Climbing", "close": "Zamknij", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Komentarz} other {Komentarze}}", "completed": "Zakończono", "completed-a-trail": "ukończono szlak", @@ -147,6 +148,7 @@ "error-exporting-trail": "Błąd podczas eksportowania szlaku", "error-generating-token": "", "error-liking-trail": "Error liking trail", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Błąd zapisu do komoot", "error-posting-comment": "Błąd wysyłania komentarza", "error-printing-map": "Błąd podczas drukowania mapy", @@ -154,10 +156,14 @@ "error-saving-list": "Błąd przy zapisywaniu listy", "error-saving-trail": "Błąd podczas zapisywania szlaku", "error-setting-up-integration": "Error setting up strava integration", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Błąd podczas aktualizacji hasła", "error-updating-strava-integration": "Błąd aktualizacji integracji kamoot", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Szacowany czas", "everyone-with-the-link": "Everyone with the link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Eksploruj", @@ -194,6 +200,7 @@ "get-started": "Get started", "grid": "Siatka", "grocery-store": "Grocery store", + "hammerhead-integration-after-date-hint": "", "heading": "Heading", "height": "Wysokość", "help": "Pomoc", @@ -209,11 +216,13 @@ "hut": "Hut", "hybrid": "Hybrydowy", "icon": "Ikona", + "ignore-trails-before-date": "", "imperial": "Anglosaskie", "import": "Importuj", "import-hint": "Wybierz lub przeciągnij tutaj plik GPX, FIT, KML lub TCX...", "include-description": "Dołącz opis", "include-waypoints": "Uwzględnij punkty trasy", + "integration-description-hammerhead": "", "integration-description-komoot": "Synchronizuje trasy kamoot z wanderer w równych odstępach.", "integration-description-strava": "Synchronizuje trasy i aktywność z wanderer w równych odstępach.", "integration-disabled": "integracja wyłączona", @@ -370,6 +379,7 @@ "search-trails": "Szukaj szlaków", "select-list": "Wybierz Listę", "selected": "selected", + "send-to": "", "set-private": "", "set-public": "", "settings": "Ustawienia", @@ -428,6 +438,7 @@ "tourism": "Tourism", "trail": "{n, plural, one {Szlak} few {Szlaki} many {Szlaków}=1 {Szlak} other {Szlaki}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Szlak nie udostępniony", "trail-saved-successfully": "Szlak pomyślnie zapisany", @@ -440,6 +451,7 @@ "upload-gpx": "Importuj GPX", "upload-new-file": "Prześlij nowy plik", "uploaded": "wgrany", + "uploaded-trail-to-hammerhead": "", "use-hills": "Use hills", "use-roads": "Użyj dróg", "username": "Nazwa Użytkownika", diff --git a/web/src/lib/i18n/locales/pt.json b/web/src/lib/i18n/locales/pt.json index a08e6175..fdbd0fe8 100644 --- a/web/src/lib/i18n/locales/pt.json +++ b/web/src/lib/i18n/locales/pt.json @@ -71,6 +71,7 @@ "clear-all": "Clear all", "climbing": "Climbing", "close": "Fechar", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Comentário} other {Comentários}}", "completed": "Completada", "completed-a-trail": "completed a trail", @@ -147,6 +148,7 @@ "error-exporting-trail": "Erro na exportação do percurso", "error-generating-token": "", "error-liking-trail": "Error liking trail", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Error logging in to komoot", "error-posting-comment": "Error posting comment", "error-printing-map": "Erro na impressão do mapa", @@ -154,10 +156,14 @@ "error-saving-list": "Erro ao gravar lista", "error-saving-trail": "Erro ao gravar percurso", "error-setting-up-integration": "Error setting up strava integration", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Erro ao atualizar password", "error-updating-strava-integration": "Error updating komoot integration", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Duração prevista", "everyone-with-the-link": "Everyone with the link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Explorar", @@ -194,6 +200,7 @@ "get-started": "Get started", "grid": "Grelha", "grocery-store": "Grocery store", + "hammerhead-integration-after-date-hint": "", "heading": "Heading", "height": "Height", "help": "Ajuda", @@ -209,11 +216,13 @@ "hut": "Hut", "hybrid": "Hybrid", "icon": "Ícone", + "ignore-trails-before-date": "", "imperial": "Imperial", "import": "Importar", "import-hint": "Selecionar ou arrastar ficheiros GPX, FIT, KML ou TCX para aqui...", "include-description": "Incluir descrição", "include-waypoints": "Incluir pontos de passagem", + "integration-description-hammerhead": "", "integration-description-komoot": "Syncs your komoot tours with wanderer in regular intervals.", "integration-description-strava": "Syncs your strava routes & activities with wanderer in regular intervals.", "integration-disabled": "integration disabled", @@ -370,6 +379,7 @@ "search-trails": "Procurar trilhos", "select-list": "Selecionar lista", "selected": "selected", + "send-to": "", "set-private": "", "set-public": "", "settings": "Definições", @@ -428,6 +438,7 @@ "tourism": "Tourism", "trail": "{n, plural, =1 {Percurso} other {Percursos}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Não partilhado com ninguém", "trail-saved-successfully": "Percurso gravado com sucesso", @@ -440,6 +451,7 @@ "upload-gpx": "Carregar GPX", "upload-new-file": "Upload new file", "uploaded": "carregado", + "uploaded-trail-to-hammerhead": "", "use-hills": "Use hills", "use-roads": "Use Roads", "username": "Nome de utilizador", diff --git a/web/src/lib/i18n/locales/ru.json b/web/src/lib/i18n/locales/ru.json index 4428ef27..4f5317e8 100644 --- a/web/src/lib/i18n/locales/ru.json +++ b/web/src/lib/i18n/locales/ru.json @@ -71,6 +71,7 @@ "clear-all": "Очистить всё", "climbing": "Climbing", "close": "Закрыть", + "collapse-trail-list": "", "comment": "{n, plural, =1 {Комментарий} other {Комментарии}}", "completed": "Завершено", "completed-a-trail": "завершил(ла) трек", @@ -147,6 +148,7 @@ "error-exporting-trail": "Ошибка экспорта трека", "error-generating-token": "", "error-liking-trail": "Error liking trail", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "Ошибка входа в Komoot", "error-posting-comment": "Ошибка отправки комментария", "error-printing-map": "Ошибка печати карты", @@ -154,10 +156,14 @@ "error-saving-list": "Ошибка сохранения списка", "error-saving-trail": "Ошибка сохранения трека", "error-setting-up-integration": "Ошибка настройки {provider}", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "Ошибка изменения пароля", "error-updating-strava-integration": "Ошибка обновления Strava", + "error-uploading-trail-to-hammerhead": "", "est-duration": "Продолжительность", "everyone-with-the-link": "Everyone with the link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "Изучить", @@ -194,6 +200,7 @@ "get-started": "Get started", "grid": "Сетка", "grocery-store": "Продуктовый магазин", + "hammerhead-integration-after-date-hint": "", "heading": "Heading", "height": "Высота", "help": "Помощь", @@ -209,11 +216,13 @@ "hut": "Хижина", "hybrid": "Гибрид", "icon": "Иконка", + "ignore-trails-before-date": "", "imperial": "Имперская", "import": "Импорт", "import-hint": "Перетащите GPX, FIT, KML или TCX файлы сюда...", "include-description": "Добавить описание", "include-waypoints": "Include waypoints", + "integration-description-hammerhead": "", "integration-description-komoot": "Синхронизирует ваши данные с Komoot.", "integration-description-strava": "Синхронизирует ваши данные со Strava.", "integration-disabled": "интеграция отключена", @@ -370,6 +379,7 @@ "search-trails": "Поиск треков", "select-list": "Выбрать список", "selected": "selected", + "send-to": "", "set-private": "", "set-public": "", "settings": "Настройки", @@ -428,6 +438,7 @@ "tourism": "Туризм", "trail": "{n, plural, =1 {Трек} other {Треки}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "Нет общего доступа", "trail-saved-successfully": "Трек сохранён", @@ -440,6 +451,7 @@ "upload-gpx": "Загрузить GPX", "upload-new-file": "Загрузить новый файл", "uploaded": "загружено", + "uploaded-trail-to-hammerhead": "", "use-hills": "Use hills", "use-roads": "Использование дорог", "username": "Никнейм", diff --git a/web/src/lib/i18n/locales/zh.json b/web/src/lib/i18n/locales/zh.json index 2e6e46ea..9c473eea 100644 --- a/web/src/lib/i18n/locales/zh.json +++ b/web/src/lib/i18n/locales/zh.json @@ -71,6 +71,7 @@ "clear-all": "清除全部", "climbing": "攀爬", "close": "关闭", + "collapse-trail-list": "", "comment": "{n, plural, =1 {评论} other {评论}}", "completed": "已完成", "completed-a-trail": "完成轨迹", @@ -147,6 +148,7 @@ "error-exporting-trail": "导出路线失败", "error-generating-token": "", "error-liking-trail": "赞轨迹时出错", + "error-logging-in-to-hammerhead": "", "error-logging-in-to-komoot": "登录到 komoot 时出错", "error-posting-comment": "发布评论时出错", "error-printing-map": "打印地图失败", @@ -154,10 +156,14 @@ "error-saving-list": "保存列表失败", "error-saving-trail": "保存路线失败", "error-setting-up-integration": "Error setting up strava integration", + "error-updating-hammerhead-integration": "", + "error-updating-komoot-integration": "", "error-updating-password": "更新密码失败", "error-updating-strava-integration": "更新 komoot 集成出错", + "error-uploading-trail-to-hammerhead": "", "est-duration": "预计时长", "everyone-with-the-link": "Everyone with the link", + "expand-trail-list": "", "expiration": "", "expires": "", "explore": "探索", @@ -194,6 +200,7 @@ "get-started": "Get started", "grid": "网格", "grocery-store": "杂货店", + "hammerhead-integration-after-date-hint": "", "heading": "标题", "height": "高度", "help": "帮助", @@ -209,11 +216,13 @@ "hut": "小屋", "hybrid": "混合", "icon": "图标", + "ignore-trails-before-date": "", "imperial": "英制", "import": "导入", "import-hint": "在此选择或拖拽GPX、FIT、KML或TCX文件...", "include-description": "包含描述", "include-waypoints": "包括途径点", + "integration-description-hammerhead": "", "integration-description-komoot": "定期与komoot同步您的wanderer。", "integration-description-strava": "定期与strava同步您的wanderer路线和活动。", "integration-disabled": "整合已停用", @@ -370,6 +379,7 @@ "search-trails": "搜索路线", "select-list": "选择列表", "selected": "已选", + "send-to": "", "set-private": "", "set-public": "", "settings": "设置", @@ -428,6 +438,7 @@ "tourism": "旅游", "trail": "{n, plural, =1 {路线} other {路线}}", "trail-copied-successfully": "", + "trail-has-no-gpx": "", "trail-not-in-list": "", "trail-not-shared": "未与任何人分享", "trail-saved-successfully": "路线保存成功", @@ -440,6 +451,7 @@ "upload-gpx": "上传 GPX", "upload-new-file": "上传新文件", "uploaded": "已上传", + "uploaded-trail-to-hammerhead": "", "use-hills": "使用山地", "use-roads": "使用道路", "username": "用户名", diff --git a/web/src/routes/trails/+page.svelte b/web/src/routes/trails/+page.svelte index 1a257c9b..d9919ccd 100644 --- a/web/src/routes/trails/+page.svelte +++ b/web/src/routes/trails/+page.svelte @@ -37,7 +37,10 @@ if (!browser) { return; } - localStorage.setItem(TRAIL_LIST_FILTER_STORAGE_KEY, JSON.stringify(filter)); + localStorage.setItem( + TRAIL_LIST_FILTER_STORAGE_KEY, + JSON.stringify(filter), + ); } let filterExpanded: boolean = $state(true); @@ -45,14 +48,19 @@ let loading: boolean = $state(true); let filter: TrailFilter = $state(restoreStoredFilter(page.data.filter)); - const pagination: { page: number; totalPages: number, items: number } = $state({ - page: page.url.searchParams.has("page") - ? parseInt(page.url.searchParams.get("page")!) - : 1, - totalPages: 1, - items: 25, - }); + const pagination: { page: number; totalPages: number; items: number } = + $state({ + page: page.url.searchParams.has("page") + ? parseInt(page.url.searchParams.get("page")!) + : 1, + totalPages: 1, + items: 25, + }); let trails: Trail[] = $state([]); + let trailsFullWidth = $state(false); + let widthPreferences: Record = $state({}); + let currentDisplayMode: string = $state("cards"); + const widthPreferenceStorageKey = "trailWidthPreferences"; export const snapshot: Snapshot = { capture: () => filter, @@ -66,8 +74,60 @@ if (window.innerWidth < 768) { filterExpanded = false; } + loadWidthPreferences(); }); + function loadWidthPreferences() { + if (typeof localStorage === "undefined") { + return; + } + try { + const stored = localStorage.getItem(widthPreferenceStorageKey); + if (stored) { + const parsed = JSON.parse(stored); + if (parsed && typeof parsed === "object") { + widthPreferences = parsed; + } + } + } catch (err) { + console.warn("Failed to parse trail width preferences", err); + } + applyWidthPreference(currentDisplayMode); + } + + function applyWidthPreference(mode: string) { + trailsFullWidth = widthPreferences[mode] ?? false; + } + + function persistWidthPreferences() { + if (typeof localStorage === "undefined") { + return; + } + try { + localStorage.setItem( + widthPreferenceStorageKey, + JSON.stringify(widthPreferences), + ); + } catch (err) { + console.warn("Failed to persist trail width preferences", err); + } + } + + function updateWidthPreference(mode: string, value: boolean) { + widthPreferences = { ...widthPreferences, [mode]: value }; + persistWidthPreferences(); + } + + function handleDisplayModeChange(mode: string) { + currentDisplayMode = mode; + applyWidthPreference(mode); + } + + function toggleTrailWidth() { + trailsFullWidth = !trailsFullWidth; + updateWidthPreference(currentDisplayMode, trailsFullWidth); + } + beforeNavigate(({ to }) => { if (!browser || !to?.url) { return; @@ -90,7 +150,11 @@ loading = false; } - async function paginate(newPage: number, items: number, scrollToTop: boolean = true) { + async function paginate( + newPage: number, + items: number, + scrollToTop: boolean = true, + ) { pagination.page = newPage; try { @@ -130,7 +194,10 @@ } page.url.searchParams.set("page", newPage.toString()); - goto(`?${page.url.searchParams.toString()}`, { keepFocus: true, noScroll: !scrollToTop }); + goto(`?${page.url.searchParams.toString()}`, { + keepFocus: true, + noScroll: !scrollToTop, + }); } async function doPaginate(newPage: number, items: number) { @@ -149,7 +216,7 @@
handleFilterUpdate(false)} onpagination={paginate} - > + ondisplaychange={handleDisplayModeChange} + > + {#snippet trailWidthToggleSnippet()} + + {/snippet} +