mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 13:15:18 +02:00
commit
e4ab8185bd
5 changed files with 66 additions and 23 deletions
|
@ -163,6 +163,7 @@
|
||||||
<!-- if there is a button in form, it will close the modal -->
|
<!-- if there is a button in form, it will close the modal -->
|
||||||
<button class="btn mt-4" on:click={close}>Close</button>
|
<button class="btn mt-4" on:click={close}>Close</button>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="flex items-center justify-center flex-wrap gap-4 mt-4">
|
||||||
<button class="btn btn-secondary" on:click={generate}
|
<button class="btn btn-secondary" on:click={generate}
|
||||||
>Generate Description</button
|
>Generate Description</button
|
||||||
>
|
>
|
||||||
|
@ -171,4 +172,5 @@
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import type { Adventure } from "$lib/utils/types";
|
import type { Adventure } from "$lib/utils/types";
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { addActivityType } from "$lib";
|
import { addActivityType, generateDescription, getImage } from "$lib";
|
||||||
let modal: HTMLDialogElement;
|
let modal: HTMLDialogElement;
|
||||||
|
|
||||||
console.log(adventureToEdit.id);
|
console.log(adventureToEdit.id);
|
||||||
|
@ -41,6 +41,28 @@
|
||||||
adventureToEdit = addActivityType(activityInput, adventureToEdit);
|
adventureToEdit = addActivityType(activityInput, adventureToEdit);
|
||||||
activityInput = "";
|
activityInput = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function generate() {
|
||||||
|
try {
|
||||||
|
console.log(adventureToEdit.name);
|
||||||
|
const desc = await generateDescription(adventureToEdit.name);
|
||||||
|
adventureToEdit.description = desc;
|
||||||
|
// Do something with the updated newAdventure object
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
// Handle the error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function searchImage() {
|
||||||
|
try {
|
||||||
|
const imageUrl = await getImage(adventureToEdit.name);
|
||||||
|
adventureToEdit.imageUrl = imageUrl;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
// Handle the error
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<dialog id="my_modal_1" class="modal">
|
<dialog id="my_modal_1" class="modal">
|
||||||
|
@ -124,6 +146,14 @@
|
||||||
<!-- if there is a button in form, it will close the modal -->
|
<!-- if there is a button in form, it will close the modal -->
|
||||||
<button class="btn mt-4" on:click={close}>Close</button>
|
<button class="btn mt-4" on:click={close}>Close</button>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="flex items-center justify-center flex-wrap gap-4 mt-4">
|
||||||
|
<button class="btn btn-secondary" on:click={generate}
|
||||||
|
>Generate Description</button
|
||||||
|
>
|
||||||
|
<button class="btn btn-secondary" on:click={searchImage}
|
||||||
|
>Search for Image</button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
|
@ -97,7 +97,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a class="btn btn-ghost text-xl" href="/">AdventureLog 🗺️</a>
|
<a class="btn btn-ghost text-xl" href="/"
|
||||||
|
>AdventureLog <img src="/favicon.png" alt="Map Logo" class="w-8" /></a
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-center hidden lg:flex">
|
<div class="navbar-center hidden lg:flex">
|
||||||
<ul class="menu menu-horizontal px-1 gap-2">
|
<ul class="menu menu-horizontal px-1 gap-2">
|
||||||
|
|
|
@ -242,7 +242,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if adventuresPlans.length == 0 && !isLoadingIdeas && !isLoadingTrips && !isShowingMoreFields && !isShowingNewTrip && tripPlans.length == 0}
|
{#if adventuresPlans.length == 0 && !isLoadingIdeas && !isLoadingTrips && !isShowingMoreFields && !isShowingNewTrip && tripPlans.length > 0}
|
||||||
<div class="flex flex-col items-center justify-center mt-16">
|
<div class="flex flex-col items-center justify-center mt-16">
|
||||||
<article class="prose mb-4"><h2>Add some plans!</h2></article>
|
<article class="prose mb-4"><h2>Add some plans!</h2></article>
|
||||||
<img src={mapDrawing} width="25%" alt="Logo" />
|
<img src={mapDrawing} width="25%" alt="Logo" />
|
||||||
|
@ -284,13 +284,20 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if tripPlans.length == 0 && !isLoadingIdeas && !isLoadingTrips && !isShowingMoreFields && !isShowingNewTrip}
|
{#if tripPlans.length == 0 && !isLoadingIdeas && !isLoadingTrips && !isShowingMoreFields && !isShowingNewTrip && adventuresPlans.length > 0}
|
||||||
<div class="flex flex-col items-center justify-center mt-16">
|
<div class="flex flex-col items-center justify-center mt-16">
|
||||||
<article class="prose mb-4"><h2>Add some trips!</h2></article>
|
<article class="prose mb-4"><h2>Add some trips!</h2></article>
|
||||||
<img src={mapDrawing} width="25%" alt="Logo" />
|
<img src={mapDrawing} width="25%" alt="Logo" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{#if tripPlans.length == 0 && !isLoadingIdeas && !isLoadingTrips && !isShowingMoreFields && !isShowingNewTrip && adventuresPlans.length == 0}
|
||||||
|
<div class="flex flex-col items-center justify-center mt-16">
|
||||||
|
<article class="prose mb-4"><h2>Add some trips and plans!</h2></article>
|
||||||
|
<img src={mapDrawing} width="25%" alt="Logo" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>My Plans | AdventureLog</title>
|
<title>My Plans | AdventureLog</title>
|
||||||
<meta
|
<meta
|
||||||
|
|
|
@ -12,9 +12,10 @@
|
||||||
|
|
||||||
<h1 class="text-center font-bold text-4xl mb-4">Country List</h1>
|
<h1 class="text-center font-bold text-4xl mb-4">Country List</h1>
|
||||||
|
|
||||||
{#each data.response as item}
|
<div class="flex items-center justify-center flex-wrap">
|
||||||
|
{#each data.response as item}
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary mr-4 mb-2"
|
class="btn btn-primary mr-2 ml-2 mb-2"
|
||||||
on:click={() => nav(item.country_code)}
|
on:click={() => nav(item.country_code)}
|
||||||
>{item.name}
|
>{item.name}
|
||||||
<img
|
<img
|
||||||
|
@ -24,7 +25,8 @@
|
||||||
/></button
|
/></button
|
||||||
>
|
>
|
||||||
<!-- <p>Name: {item.name}, Continent: {item.continent}</p> -->
|
<!-- <p>Name: {item.name}, Continent: {item.continent}</p> -->
|
||||||
{/each}
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>WorldTravel | AdventureLog</title>
|
<title>WorldTravel | AdventureLog</title>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue