diff --git a/frontend/src/lib/components/AdventureModal.svelte b/frontend/src/lib/components/AdventureModal.svelte index 64d94b9..f1e3064 100644 --- a/frontend/src/lib/components/AdventureModal.svelte +++ b/frontend/src/lib/components/AdventureModal.svelte @@ -23,6 +23,8 @@ export let startDate: string | null = null; export let endDate: string | null = null; + let wikiError: string = ''; + let noPlaces: boolean = false; export let adventureToEdit: Adventure | null = null; @@ -57,7 +59,8 @@ lngLat: { lng: adventure.longitude, lat: adventure.latitude }, location: adventure.location || '', name: adventure.name, - activity_type: '' + activity_type: '', + lng: 0 } ]; } @@ -210,7 +213,8 @@ lngLat: { lng: longitude, lat: latitude }, location: data[0]?.display_name || '', name: data[0]?.name || '', - activity_type: data[0]?.type || '' + activity_type: data[0]?.type || '', + lng: 0 } ]; } @@ -240,17 +244,28 @@ } } - // async function generateDesc() { - // let res = await fetch(`/api/generate/desc/?name=${adventureToEdit.name}`); - // let data = await res.json(); - // if (data.extract) { - // adventureToEdit.description = data.extract; - // } - // } + async function generateDesc() { + let res = await fetch(`/api/generate/desc/?name=${adventure.name}`); + let data = await res.json(); + if (data.extract?.length > 0) { + adventure.description = data.extract; + } else { + wikiError = 'No description found'; + } + } function addMarker(e: CustomEvent) { markers = []; - markers = [...markers, { lngLat: e.detail.lngLat, name: '', location: '', activity_type: '' }]; + markers = [ + ...markers, + { + lngLat: e.detail.lngLat, + name: '', + location: '', + activity_type: '', + lng: 0 + } + ]; console.log(markers); } @@ -393,199 +408,206 @@ bind:value={adventure.description} class="textarea textarea-bordered w-full h-32" > - -
-
- - -
-
-
- -
- - (adventure.rating = 1)} - checked={adventure.rating === 1} - /> - (adventure.rating = 2)} - checked={adventure.rating === 2} - /> - (adventure.rating = 3)} - checked={adventure.rating === 3} - /> - (adventure.rating = 4)} - checked={adventure.rating === 4} - /> - (adventure.rating = 5)} - checked={adventure.rating === 5} - /> - {#if adventure.rating} - - {/if} +
+ +

{wikiError}

-
-
-
- +
+ + +
+
+
+ +
+ + (adventure.rating = 1)} + checked={adventure.rating === 1} + /> + (adventure.rating = 2)} + checked={adventure.rating === 2} + /> + (adventure.rating = 3)} + checked={adventure.rating === 3} + /> + (adventure.rating = 4)} + checked={adventure.rating === 4} + /> + (adventure.rating = 5)} + checked={adventure.rating === 5} + /> + {#if adventure.rating} + + {/if} +
+
+
+
+
+ +
-
-
-

Location Information

- -
-
- -
-
-
+
+

Location Information

+ +
+
- - -
- {#if places.length > 0} -
-

Search Results

- -
- {#each places as place} - - {/each} -
- {:else if noPlaces} -

No results found

- {/if} - -
- - +
+ + - + - {#each markers as marker} - - {/each} - -
- -
- - -
- {#if adventure.is_public} -
-

Share this Adventure!

-
-

- {window.location.origin}/adventures/{adventure.id} -

- -
+ {#each markers as marker} + + {/each} +
- {/if} + +
+ + +
+ {#if adventure.is_public} +
+

Share this Adventure!

+
+

+ {window.location.origin}/adventures/{adventure.id} +

+ +
+
+ {/if} +
{:else} diff --git a/frontend/src/routes/adventures/+page.svelte b/frontend/src/routes/adventures/+page.svelte index 7c92963..c4f9cef 100644 --- a/frontend/src/routes/adventures/+page.svelte +++ b/frontend/src/routes/adventures/+page.svelte @@ -22,9 +22,6 @@ includeCollections: true }; - let isShowingCreateModal: boolean = false; - let newType: string = ''; - let resultsPerPage: number = 25; let count = data.props.count || 0; @@ -152,7 +149,6 @@ class="btn btn-primary" on:click={() => { isAdventureModalOpen = true; - newType = 'visited'; adventureToEdit = null; }} >