Skip to content

Commit

Permalink
feat: Hide archived announcements for non-admin viewers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ushie committed Dec 16, 2024
1 parent 2373f85 commit 63dfe65
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/routes/announcements/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import type { ResponseAnnouncement } from '$lib/types';
import { admin_login } from '$lib/stores';
import Button from '$lib/components/Button.svelte';
import moment from 'moment';
let searchParams: Readable<URLSearchParams>;
Expand Down Expand Up @@ -113,11 +114,13 @@
<Query {query} let:data>
<div class="cards">
{#each filter(data.announcements, displayedTerm) as announcement}
{#key selectedTags || displayedTerm}
<div in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
<AnnouncementCard {announcement} />
</div>
{/key}
{#if !moment(announcement.archived_at).isBefore(moment()) || $admin_login.logged_in}
{#key selectedTags || displayedTerm}
<div in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
<AnnouncementCard {announcement} />
</div>
{/key}
{/if}
{/each}
</div>
</Query>
Expand Down

0 comments on commit 63dfe65

Please sign in to comment.