diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index 2434252..e5bed98 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -20,6 +20,7 @@ dispatch("remove", adventure.id); } function edit() { + console.log(adventure.activityTypes); dispatch("edit", adventure.id); } function add() { @@ -49,6 +50,17 @@

{adventure.date}

{/if} + {#if adventure.activityTypes && adventure.activityTypes.length > 0} + + {/if}
{#if type == "mylog"} {/if} + {#if type == "planner"} + + + + {/if} {#if type == "featured"}
- + + + +
+ + +
+ diff --git a/src/lib/components/EditModal.svelte b/src/lib/components/EditModal.svelte index 5b1db35..b566521 100644 --- a/src/lib/components/EditModal.svelte +++ b/src/lib/components/EditModal.svelte @@ -6,6 +6,8 @@ import { onMount } from "svelte"; let modal: HTMLDialogElement; + console.log(adventureToEdit.id); + let originalName = adventureToEdit.name; onMount(() => { @@ -13,9 +15,11 @@ if (modal) { modal.showModal(); } + activityInput = (adventureToEdit?.activityTypes || []).join(", "); }); function submit() { + addActivityType(); dispatch("submit", adventureToEdit); console.log(adventureToEdit); } @@ -29,6 +33,19 @@ close(); } } + + let activityInput: string = ""; + + function addActivityType() { + if (activityInput.trim() !== "") { + const activities = activityInput + .split(",") + .filter((activity) => activity.trim() !== ""); + adventureToEdit.activityTypes = activities; + activityInput = ""; + } + console.log(adventureToEdit.activityTypes); + } @@ -78,6 +95,26 @@ class="input input-bordered w-full max-w-xs" /> +
+ + +
+
+ + +
diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 1e6e2c6..7efe33f 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -78,6 +78,11 @@ + +