1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 04:49:37 +02:00

feat: add auto-generation for item name in LocationDropdown and improve theme handling in Navbar

This commit is contained in:
Sean Morley 2025-06-04 14:41:29 -04:00
parent 6c338b8c0f
commit d6ab4e9f64
2 changed files with 9 additions and 2 deletions

View file

@ -22,6 +22,8 @@
let places: GeocodeSearchResult[] = []; let places: GeocodeSearchResult[] = [];
let noPlaces: boolean = false; let noPlaces: boolean = false;
let isNameAutoGenerated: boolean = false;
onMount(() => { onMount(() => {
if (initialLatLng) { if (initialLatLng) {
markers = [ markers = [
@ -277,8 +279,10 @@
activity_type: place.type ?? '' activity_type: place.type ?? ''
} }
]; ];
if (isNameAutoGenerated || !item.name) {
item.name = place.name ?? ''; item.name = place.name ?? '';
isNameAutoGenerated = true;
}
}} }}
> >
<span>{place.name}</span> <span>{place.name}</span>

View file

@ -40,6 +40,7 @@
// Attach event listener on component mount // Attach event listener on component mount
document.addEventListener('keydown', handleKeydown); document.addEventListener('keydown', handleKeydown);
// @ts-ignore
theme = document.documentElement.getAttribute('data-theme'); theme = document.documentElement.getAttribute('data-theme');
// Cleanup event listener on component destruction // Cleanup event listener on component destruction
@ -74,7 +75,9 @@
window.location.reload(); window.location.reload();
}; };
const submitThemeChange = (event: Event) => { const submitThemeChange = (event: Event) => {
// @ts-ignore
const theme = event.target.value; const theme = event.target.value;
// @ts-ignore
const themeForm = event.target.parentNode; const themeForm = event.target.parentNode;
themeForm.action = `/?/setTheme&theme=${theme}`; themeForm.action = `/?/setTheme&theme=${theme}`;
themeForm.submit(); themeForm.submit();