1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-21 13:59:36 +02:00

chore: Update CollectionCard component to display correct toast message when archiving/unarchiving a collection

This commit is contained in:
Sean Morley 2024-08-07 17:36:25 -04:00
parent 14e4a5c86d
commit 879b182e56
2 changed files with 23 additions and 3 deletions

View file

@ -37,10 +37,10 @@
}); });
if (res.ok) { if (res.ok) {
console.log(`Collection ${is_archived ? 'archived' : 'unarchived'}`); console.log(`Collection ${is_archived ? 'archived' : 'unarchived'}`);
addToast('info', `Adventure ${is_archived ? 'archived' : 'unarchived'} successfully!`); addToast('info', `Collection ${is_archived ? 'archived' : 'unarchived'} successfully!`);
dispatch('delete', collection.id); dispatch('delete', collection.id);
} else { } else {
console.log('Error archiving adventure'); console.log('Error archiving collection');
} }
} }

View file

@ -287,7 +287,7 @@
</div> </div>
{/if} {/if}
{#if collection} {#if collection}
{#if data.user} {#if data.user && !collection.is_archived}
<div class="fixed bottom-4 right-4 z-[999]"> <div class="fixed bottom-4 right-4 z-[999]">
<div class="flex flex-row items-center justify-center gap-4"> <div class="flex flex-row items-center justify-center gap-4">
<div class="dropdown dropdown-top dropdown-end"> <div class="dropdown dropdown-top dropdown-end">
@ -384,6 +384,26 @@
</div> </div>
</div> </div>
{/if} {/if}
{#if collection.is_archived}
<div class="flex items-center justify-center mt-4 mb-4">
<div role="alert" class="alert alert-warning w-96 inline-flex items-center justify-center">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6 shrink-0 stroke-current"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
/>
</svg>
<span>This collection has been archived.</span>
</div>
</div>
{/if}
{#if collection.name} {#if collection.name}
<h1 class="text-center font-extrabold text-4xl mb-2">{collection.name}</h1> <h1 class="text-center font-extrabold text-4xl mb-2">{collection.name}</h1>
{/if} {/if}