From 433001dbcc19b7d70c350ca9117fcf1b93d7ba91 Mon Sep 17 00:00:00 2001 From: simonredfern Date: Thu, 15 Oct 2026 09:45:52 +0200 Subject: [PATCH 1/2] Show All activities --- .../components/RegistryActivitiesMap.svelte | 18 ++++++++++++++++-- src/routes/registry/activities/+page.svelte | 18 +++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/lib/components/RegistryActivitiesMap.svelte b/src/lib/components/RegistryActivitiesMap.svelte index a8bd15a..b4daadd 100644 --- a/src/lib/components/RegistryActivitiesMap.svelte +++ b/src/lib/components/RegistryActivitiesMap.svelte @@ -30,6 +30,19 @@ let map = $state(null); /** Each drawn outline by activity id, so the page can zoom to one. Not reactive. */ const outlinesById = new Map(); + /** Every drawn outline, for zooming back out to them all. Not reactive. */ + let allOutlines: import('leaflet').FeatureGroup | null = null; + + /** Frames every drawn area again, as the map first opened. */ + export function showAll() { + map?.closePopup(); + frameAll(); + } + + function frameAll() { + const bounds = allOutlines?.getBounds(); + if (map && bounds?.isValid()) map.fitBounds(bounds, { padding: [32, 32], maxZoom: 14 }); + } /** Zooms to one activity's area and opens its popup. Returns false if it has none drawn. */ export function focusActivity(activityId: string): boolean { @@ -109,8 +122,8 @@ }; m.on('zoomend', syncDots); - const bounds = outlines.getBounds(); - if (bounds.isValid()) m.fitBounds(bounds, { padding: [32, 32], maxZoom: 14 }); + allOutlines = outlines; + frameAll(); syncDots(); return () => { @@ -118,6 +131,7 @@ outlines.remove(); dots.remove(); outlinesById.clear(); + allOutlines = null; }; }); diff --git a/src/routes/registry/activities/+page.svelte b/src/routes/registry/activities/+page.svelte index 3dcb4ab..37dbf15 100644 --- a/src/routes/registry/activities/+page.svelte +++ b/src/routes/registry/activities/+page.svelte @@ -4,6 +4,7 @@ import Pill from '$lib/components/Pill.svelte'; import ObpErrorDisplay from '$lib/components/ObpErrorDisplay.svelte'; import ToggleGroup from '$lib/components/ToggleGroup.svelte'; + import Button from '$lib/components/Button.svelte'; import RegistryActivitiesMap from '$lib/components/RegistryActivitiesMap.svelte'; import { goto } from '$app/navigation'; import { page } from '$app/state'; @@ -15,7 +16,7 @@ registryOperatorHref, type RegistryActivity } from '$lib/registry/activities'; - import { Search, List, Map as MapIcon, Layers } from '@lucide/svelte'; + import { Search, List, Map as MapIcon, Layers, Maximize } from '@lucide/svelte'; import { findAreaOverlaps } from '$lib/registry/areaOverlaps'; let { data }: { data: PageData } = $props(); @@ -91,6 +92,10 @@ function focusOnMap(activityId: string) { if (activitiesMap?.focusActivity(activityId)) focusedId = activityId; } + function showAllOnMap() { + activitiesMap?.showAll(); + focusedId = null; + } const filtersApplied = $derived( search.trim() !== '' || creditType !== 'all' || country !== 'all' || status !== 'all' @@ -237,6 +242,12 @@
Verified Unverified + {#if mapped.length > 0} + + {/if}
{#if overlappingCount > 0}

@@ -406,8 +417,13 @@ .ogcr-legend { display: flex; flex-wrap: wrap; + align-items: center; gap: var(--space-xs); } + /* Sits at the right, above the map it acts on. */ + .ogcr-legend :global(.ogcr-legend__action) { + margin-left: auto; + } /* Small and capped at a few lines, so the map stays the main thing on the page. */ .ogcr-map-list { From 55f299972030791583889c55af5e84948053a919 Mon Sep 17 00:00:00 2001 From: simonredfern Date: Thu, 15 Oct 2026 10:29:15 +0200 Subject: [PATCH 2/2] tweak text --- src/routes/registry/activities/+page.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/routes/registry/activities/+page.svelte b/src/routes/registry/activities/+page.svelte index 37dbf15..c3ff518 100644 --- a/src/routes/registry/activities/+page.svelte +++ b/src/routes/registry/activities/+page.svelte @@ -254,7 +254,6 @@

{/if} {#if mapped.length > 0}