From 2ca24b9f15063ea2b67819981c41a2fd73d7c422 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 18 Jul 2024 18:37:46 -0400 Subject: [PATCH 1/3] adventure card improvements --- .../src/lib/components/AdventureCard.svelte | 94 ++++++++++--------- .../src/lib/components/AdventureLink.svelte | 6 +- frontend/src/routes/adventures/+page.svelte | 1 + frontend/src/routes/collections/+page.svelte | 2 +- .../src/routes/collections/[id]/+page.svelte | 2 + frontend/src/routes/search/+page.svelte | 7 +- 6 files changed, 65 insertions(+), 47 deletions(-) diff --git a/frontend/src/lib/components/AdventureCard.svelte b/frontend/src/lib/components/AdventureCard.svelte index 4824208..d8c1649 100644 --- a/frontend/src/lib/components/AdventureCard.svelte +++ b/frontend/src/lib/components/AdventureCard.svelte @@ -1,7 +1,7 @@ {#if isPointModalOpen} - (isPointModalOpen = false)} on:submit={setLongLat} /> + (isPointModalOpen = false)} + on:submit={setLongLat} + /> {/if} {#if isImageFetcherOpen} - (isImageFetcherOpen = false)} /> + (isImageFetcherOpen = false)} + /> {/if} diff --git a/frontend/src/lib/components/PointSelectionModal.svelte b/frontend/src/lib/components/PointSelectionModal.svelte index e9e89d2..eb44a9e 100644 --- a/frontend/src/lib/components/PointSelectionModal.svelte +++ b/frontend/src/lib/components/PointSelectionModal.svelte @@ -10,7 +10,11 @@ let markers: Point[] = []; - let query: string = ''; + export let query: string | null = null; + + if (query) { + geocode(); + } export let longitude: number | null = null; export let latitude: number | null = null; @@ -43,8 +47,10 @@ let places: OpenStreetMapPlace[] = []; - async function geocode(e: Event) { - e.preventDefault(); + async function geocode(e: Event | null) { + if (e) { + e.preventDefault(); + } if (!query) { alert('Please enter a location'); return; diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts index 978f0f7..d0dbdf5 100644 --- a/frontend/src/lib/types.ts +++ b/frontend/src/lib/types.ts @@ -25,7 +25,8 @@ export type Adventure = { latitude: number | null; longitude: number | null; is_public: boolean; - created_at?: string; + created_at?: string | null; + updated_at?: string | null; }; export type Country = { diff --git a/frontend/src/routes/adventures/+page.svelte b/frontend/src/routes/adventures/+page.svelte index 353b4a7..d5d598e 100644 --- a/frontend/src/routes/adventures/+page.svelte +++ b/frontend/src/routes/adventures/+page.svelte @@ -271,9 +271,9 @@ class="join-item btn btn-neutral" type="radio" name="order_by" - id="created_at" - value="created_at" - aria-label="Created" + id="updated_at" + value="updated_at" + aria-label="Updated" checked />

Sort

-

Order Direction

- - - - +

Order Direction

+
+ + +

Online Results
{#each osmResults as result} -
+

{result.display_name}

{result.type}

{result.lat}, {result.lon}