From 30c58ca1183de42940465d37bcb86dba2453121e Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Mon, 20 Jan 2025 09:01:11 -0500 Subject: [PATCH] feat: refactor AttachmentCard component to handle delete action locally and simplify adventure page logic --- frontend/src/lib/components/AttachmentCard.svelte | 6 +++--- frontend/src/routes/adventures/[id]/+page.svelte | 8 +------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/components/AttachmentCard.svelte b/frontend/src/lib/components/AttachmentCard.svelte index 7d90f2f..1de97e8 100644 --- a/frontend/src/lib/components/AttachmentCard.svelte +++ b/frontend/src/lib/components/AttachmentCard.svelte @@ -90,10 +90,10 @@ > {$t('transportation.edit')} + {/if} - diff --git a/frontend/src/routes/adventures/[id]/+page.svelte b/frontend/src/routes/adventures/[id]/+page.svelte index 96b7cbb..a471572 100644 --- a/frontend/src/routes/adventures/[id]/+page.svelte +++ b/frontend/src/routes/adventures/[id]/+page.svelte @@ -12,12 +12,6 @@ return marked(markdown); }; - function deleteAttachment(event: CustomEvent) { - adventure.attachments = adventure.attachments.filter( - (attachment) => attachment.id !== event.detail - ); - } - export let data: PageData; console.log(data); @@ -395,7 +389,7 @@ {#if adventure.attachments && adventure.attachments.length > 0}
{#each adventure.attachments as attachment} - + {/each}
{/if}