feat: Add image upload functionality to adventure creation and editing

This commit is contained in:
Sean Morley
2024-06-14 16:25:45 +00:00
parent 2acfc1defb
commit 0637ab2df6
3 changed files with 49 additions and 25 deletions

View File

@@ -83,16 +83,6 @@
}
}
async function searchImage() {
try {
const imageUrl = await getImage(newAdventure.name);
newAdventure.imageUrl = imageUrl;
} catch (error) {
console.error(error);
// Handle the error
}
}
let activityInput: string = "";
function activitySetup() {
@@ -108,7 +98,11 @@
</script>
{#if isImageModalOpen}
<ImageModal on:submit={upload} on:close={() => (isImageModalOpen = false)} />
<ImageModal
name={newAdventure.name}
on:submit={upload}
on:close={() => (isImageModalOpen = false)}
/>
{/if}
<dialog id="my_modal_1" class="modal">
@@ -188,7 +182,6 @@
/>
</div>
<div>
<label for="rating">Image URL</label>
<button
type="button"
class="btn btn-secondary"
@@ -196,6 +189,7 @@
isImageModalOpen = true;
}}
>
Upload Image
</button>
</div>
@@ -211,9 +205,6 @@
<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>