fix announcements

This commit is contained in:
Akis 2022-10-11 17:20:42 +03:00
parent 8bdef782d7
commit 15b14bbd8e
Signed by untrusted user: akis
GPG Key ID: 267BF5C6677944ED

View File

@ -1,8 +1,6 @@
<script lang="ts"> <script lang="ts">
import fetchState from "$lib/fetchState"; import fetchState from "$lib/fetchState";
const promise = fetchState("announcements");
import Note from "$lib/Form/Note.svelte"; import Note from "$lib/Form/Note.svelte";
import dayjs from "dayjs"; import dayjs from "dayjs";
@ -15,14 +13,10 @@
} }
</script> </script>
{#await promise} {#await fetchState("announcements") then state}
<span />
{:then state}
{#if state.enabled === "true"} {#if state.enabled === "true"}
<div class="announcements"> <div class="announcements">
{#await fetchAnnouncements()} {#await fetchAnnouncements() then announcements}
<span />
{:then}
<div class="announcement-container"> <div class="announcement-container">
<div class="announcement"> <div class="announcement">
<div class="general"> <div class="general">
@ -38,7 +32,7 @@
</span> </span>
</div> </div>
<div class="title"> <div class="title">
<h1>{announcements.title}</h1> <span class="text-xl font-semibold">{announcements.title}</span>
</div> </div>
{#if announcements.link} {#if announcements.link}
@ -48,8 +42,6 @@
{/if} {/if}
</div> </div>
</div> </div>
{:catch}
<span />
{/await} {/await}
</div> </div>
@ -106,6 +98,7 @@
width: fit-content; width: fit-content;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem;
} }
.announcement a { .announcement a {