From 53695b82447aba617ab6e54c869047e652e0d912 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 22 May 2026 13:06:47 +0200 Subject: [PATCH] feat(hikes): in-season toggle + unified canton/country filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add two filters to the /hikes filter panel: - "Nur Touren in der aktuellen Saison" toggle — keeps only hikes whose recommended season window covers the current month (year-wrap aware; hikes without a window count as year-round). - "Kanton / Land" — a typeahead that abstracts the hike's area over the border: Swiss hikes group by canton (coat-of-arms), hikes abroad by country (flag). Generalised the tag typeahead into ChipTypeahead (optional icon + label mapping) and reused it for both tags and areas. Supporting bits: countries.ts (ISO/name → flag), hikeArea.ts (the canton-or-country resolver, namespaced so codes can't collide), prepared flag SVGs for CH/DE/IT/AT/FR, and an optional `country` field on the hike manifest type (populated by the build script; the app falls back to canton for Swiss hikes until a rebuild). --- package.json | 2 +- ...gTypeahead.svelte => ChipTypeahead.svelte} | 109 ++++++++++++------ .../components/hikes/HikesFilterBar.svelte | 85 +++++++++++++- src/lib/data/countries.ts | 52 +++++++++ src/lib/hikes/hikeArea.ts | 27 +++++ src/routes/hikes/+page.svelte | 20 +++- src/types/hikes.ts | 5 + static/countries/at.svg | 1 + static/countries/ch.svg | 1 + static/countries/de.svg | 1 + static/countries/fr.svg | 1 + static/countries/it.svg | 1 + 12 files changed, 265 insertions(+), 40 deletions(-) rename src/lib/components/hikes/{TagTypeahead.svelte => ChipTypeahead.svelte} (56%) create mode 100644 src/lib/data/countries.ts create mode 100644 src/lib/hikes/hikeArea.ts create mode 100644 static/countries/at.svg create mode 100644 static/countries/ch.svg create mode 100644 static/countries/de.svg create mode 100644 static/countries/fr.svg create mode 100644 static/countries/it.svg diff --git a/package.json b/package.json index e0177882..caaba18a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homepage", - "version": "1.79.1", + "version": "1.80.0", "private": true, "type": "module", "scripts": { diff --git a/src/lib/components/hikes/TagTypeahead.svelte b/src/lib/components/hikes/ChipTypeahead.svelte similarity index 56% rename from src/lib/components/hikes/TagTypeahead.svelte rename to src/lib/components/hikes/ChipTypeahead.svelte index a605e3fb..4bf12644 100644 --- a/src/lib/components/hikes/TagTypeahead.svelte +++ b/src/lib/components/hikes/ChipTypeahead.svelte @@ -1,42 +1,63 @@