From d6ab4e9f649b85d22e438f653c578ab58103ed8d Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Wed, 4 Jun 2025 14:41:29 -0400 Subject: [PATCH] feat: add auto-generation for item name in LocationDropdown and improve theme handling in Navbar --- frontend/src/lib/components/LocationDropdown.svelte | 8 ++++++-- frontend/src/lib/components/Navbar.svelte | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/LocationDropdown.svelte b/frontend/src/lib/components/LocationDropdown.svelte index cc38486..f9e88c0 100644 --- a/frontend/src/lib/components/LocationDropdown.svelte +++ b/frontend/src/lib/components/LocationDropdown.svelte @@ -22,6 +22,8 @@ let places: GeocodeSearchResult[] = []; let noPlaces: boolean = false; + let isNameAutoGenerated: boolean = false; + onMount(() => { if (initialLatLng) { markers = [ @@ -277,8 +279,10 @@ activity_type: place.type ?? '' } ]; - - item.name = place.name ?? ''; + if (isNameAutoGenerated || !item.name) { + item.name = place.name ?? ''; + isNameAutoGenerated = true; + } }} > {place.name} diff --git a/frontend/src/lib/components/Navbar.svelte b/frontend/src/lib/components/Navbar.svelte index 5ab54aa..a65c390 100644 --- a/frontend/src/lib/components/Navbar.svelte +++ b/frontend/src/lib/components/Navbar.svelte @@ -40,6 +40,7 @@ // Attach event listener on component mount document.addEventListener('keydown', handleKeydown); + // @ts-ignore theme = document.documentElement.getAttribute('data-theme'); // Cleanup event listener on component destruction @@ -74,7 +75,9 @@ window.location.reload(); }; const submitThemeChange = (event: Event) => { + // @ts-ignore const theme = event.target.value; + // @ts-ignore const themeForm = event.target.parentNode; themeForm.action = `/?/setTheme&theme=${theme}`; themeForm.submit();