From 3e3ba32d51049694cf7912791df72670f9d6a2fe Mon Sep 17 00:00:00 2001 From: escapedcat Date: Mon, 2 Feb 2026 20:18:57 +0100 Subject: [PATCH] feat(map): add desktop category filters to main view --- src/routes/map/+page.svelte | 1 + .../map/components/MapCategoryFilters.svelte | 67 +++++++++++++++++++ src/routes/map/components/MapSearchBar.svelte | 31 ++++++++- 3 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 src/routes/map/components/MapCategoryFilters.svelte diff --git a/src/routes/map/+page.svelte b/src/routes/map/+page.svelte index ec97a29e9..e41a81820 100644 --- a/src/routes/map/+page.svelte +++ b/src/routes/map/+page.svelte @@ -1339,6 +1339,7 @@ }} nearbyCount={$merchantList.totalCount} isLoadingCount={$merchantList.isLoadingList} + zoomLevel={currentZoom} /> {/if} diff --git a/src/routes/map/components/MapCategoryFilters.svelte b/src/routes/map/components/MapCategoryFilters.svelte new file mode 100644 index 000000000..da6315d52 --- /dev/null +++ b/src/routes/map/components/MapCategoryFilters.svelte @@ -0,0 +1,67 @@ + + +{#if shouldShowFilters} +
+

Filter by category

+
+ {#each CATEGORY_ENTRIES as [key, category] (key)} + + {/each} +
+
+{/if} + + diff --git a/src/routes/map/components/MapSearchBar.svelte b/src/routes/map/components/MapSearchBar.svelte index 75113bd93..1478e3fd8 100644 --- a/src/routes/map/components/MapSearchBar.svelte +++ b/src/routes/map/components/MapSearchBar.svelte @@ -3,6 +3,7 @@ import { merchantList } from '$lib/merchantListStore'; import Icon from '$components/Icon.svelte'; import SearchInput from '$components/SearchInput.svelte'; + import MapCategoryFilters from './MapCategoryFilters.svelte'; import { trackEvent } from '$lib/analytics'; import { formatNearbyCount } from '$lib/utils'; @@ -12,6 +13,7 @@ export let onNearbyClick: (() => void) | undefined = undefined; export let nearbyCount = 0; export let isLoadingCount = false; + export let zoomLevel = 0; $: formattedCount = formatNearbyCount(nearbyCount); @@ -22,6 +24,7 @@ $: mode = $merchantList.mode; $: isSearching = $merchantList.isSearching; $: isOpen = $merchantList.isOpen; + $: selectedCategory = $merchantList.selectedCategory; // Placeholder based on mode $: placeholder = mode === 'search' ? 'Search worldwide...' : 'Search nearby...'; @@ -73,7 +76,9 @@ {#if !isOpen} -
+
handleModeSwitch('search')} class="rounded-full px-4 py-2.5 text-sm font-medium shadow-sm transition-colors md:px-3 md:py-1.5 md:text-xs - {mode === 'search' + {mode === 'search' ? 'bg-link text-white' : 'bg-white text-gray-600 hover:bg-gray-50 dark:bg-dark dark:text-white/70 dark:hover:bg-white/10'}" > @@ -127,7 +132,7 @@ aria-checked={mode === 'nearby'} on:click={() => handleModeSwitch('nearby')} class="rounded-full px-4 py-2.5 text-sm font-medium shadow-sm transition-colors md:px-3 md:py-1.5 md:text-xs - {mode === 'nearby' + {mode === 'nearby' ? 'bg-link text-white' : 'bg-white text-gray-600 hover:bg-gray-50 dark:bg-dark dark:text-white/70 dark:hover:bg-white/10'}" > @@ -135,5 +140,25 @@ {formattedCount}{/if}
+ +
+ +
+ +
{/if}