Skip to content

Commit

Permalink
chore: Update CollectionCard component to display correct toast messa…
Browse files Browse the repository at this point in the history
…ge when archiving/unarchiving a collection
  • Loading branch information
seanmorley15 committed Aug 7, 2024
1 parent 14e4a5c commit 879b182
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/lib/components/CollectionCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
});
if (res.ok) {
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);
} else {
console.log('Error archiving adventure');
console.log('Error archiving collection');
}
}
Expand Down
22 changes: 21 additions & 1 deletion frontend/src/routes/collections/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
</div>
{/if}
{#if collection}
{#if data.user}
{#if data.user && !collection.is_archived}
<div class="fixed bottom-4 right-4 z-[999]">
<div class="flex flex-row items-center justify-center gap-4">
<div class="dropdown dropdown-top dropdown-end">
Expand Down Expand Up @@ -384,6 +384,26 @@
</div>
</div>
{/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}
<h1 class="text-center font-extrabold text-4xl mb-2">{collection.name}</h1>
{/if}
Expand Down

0 comments on commit 879b182

Please sign in to comment.