diff --git a/frontend/src/lib/components/ImageDisplayModal.svelte b/frontend/src/lib/components/ImageDisplayModal.svelte index c13855b..f4c8661 100644 --- a/frontend/src/lib/components/ImageDisplayModal.svelte +++ b/frontend/src/lib/components/ImageDisplayModal.svelte @@ -3,7 +3,6 @@ const dispatch = createEventDispatcher(); import { onMount } from 'svelte'; let modal: HTMLDialogElement; - import { appVersion, copyrightYear, versionChangelog } from '$lib/config'; import type { Adventure } from '$lib/types'; export let image: string; @@ -18,25 +17,59 @@ function close() { dispatch('close'); + if (modal) { + modal.close(); + } } function handleKeydown(event: KeyboardEvent) { if (event.key === 'Escape') { - dispatch('close'); + close(); + } + } + + function handleClickOutside(event: MouseEvent) { + if (event.target === modal) { + close(); } } - + + + + diff --git a/frontend/src/routes/adventures/[id]/+page.svelte b/frontend/src/routes/adventures/[id]/+page.svelte index 00e1a39..3227faa 100644 --- a/frontend/src/routes/adventures/[id]/+page.svelte +++ b/frontend/src/routes/adventures/[id]/+page.svelte @@ -34,10 +34,12 @@ let notFound: boolean = false; let isEditModalOpen: boolean = false; + let image_url: string | null = null; import ClipboardList from '~icons/mdi/clipboard-list'; import EditAdventure from '$lib/components/AdventureModal.svelte'; import AdventureModal from '$lib/components/AdventureModal.svelte'; + import ImageDisplayModal from '$lib/components/ImageDisplayModal.svelte'; onMount(() => { if (data.props.adventure) { @@ -83,6 +85,10 @@ /> {/if} +{#if image_url} + (image_url = null)} {adventure} /> +{/if} + {#if !adventure && !notFound}
@@ -102,18 +108,25 @@ {#if adventure.images && adventure.images.length > 0}