1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-24 23:39:37 +02:00

Add location from map

This commit is contained in:
Sean Morley 2024-07-24 18:55:40 -04:00
parent 3e328f408a
commit 13590c5c3c
2 changed files with 18 additions and 4 deletions

View file

@ -9,8 +9,8 @@
export let type: string = 'visited'; export let type: string = 'visited';
export let longitude: number | undefined = undefined; export let longitude: number | null = null;
export let latitude: number | undefined = undefined; export let latitude: number | null = null;
import Wikipedia from '~icons/mdi/wikipedia'; import Wikipedia from '~icons/mdi/wikipedia';
import ClipboardList from '~icons/mdi/clipboard-list'; import ClipboardList from '~icons/mdi/clipboard-list';
@ -145,6 +145,8 @@
query={newAdventure.name} query={newAdventure.name}
on:close={() => (isPointModalOpen = false)} on:close={() => (isPointModalOpen = false)}
on:submit={setLongLat} on:submit={setLongLat}
latitude={newAdventure.latitude || null}
longitude={newAdventure.longitude || null}
/> />
{/if} {/if}
@ -340,7 +342,8 @@
<button <button
type="button" type="button"
class="btn btn-secondary" class="btn btn-secondary"
on:click={() => (isPointModalOpen = true)}>Define Location</button on:click={() => (isPointModalOpen = true)}
>{newAdventure.latitude && newAdventure.longitude ? 'Change' : 'Select'} Location</button
> >
</div> </div>
<button type="submit" class="btn btn-primary mr-4 mt-4">Create</button> <button type="submit" class="btn btn-primary mr-4 mt-4">Create</button>

View file

@ -43,6 +43,12 @@
visitArray.push(el.region); visitArray.push(el.region);
}); });
function clearMarkers() {
newMarker = [];
newLatitude = null;
newLongitude = null;
}
// mapped to the checkbox // mapped to the checkbox
let showGEO = true; let showGEO = true;
@ -50,9 +56,14 @@
</script> </script>
{#if newMarker.length > 0} {#if newMarker.length > 0}
<button type="button" class="btn btn-primary" on:click={() => (createModalOpen = true)} <button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}
>Add New Adventure at Marker</button >Add New Adventure at Marker</button
> >
<button type="button" class="btn btn-neutral mb-2" on:click={clearMarkers}>Clear Marker</button>
{:else}
<button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}
>Add New Adventure</button
>
{/if} {/if}
{#if createModalOpen} {#if createModalOpen}