website/src/routes/+page.svelte

71 lines
1.8 KiB
Svelte
Raw Normal View History

2022-08-04 14:54:22 +05:30
<script lang="ts">
2022-08-05 19:31:15 +05:30
import Hero from "$lib/Hero.svelte";
2023-01-25 22:41:11 +05:30
import sanitizeHtml from "sanitize-html";
2022-11-10 00:12:34 +05:30
import type { PageData } from "./$types";
2022-12-27 20:58:47 +05:30
export let data: PageData;
2022-08-05 18:16:54 +05:30
2023-01-25 22:41:11 +05:30
$: backgroundColor = "#5cdd8b";
$: if (!data.error) {
if (data.announcements.incident) {
if (data.announcements.incident.style === "info") {
backgroundColor = "#0dcaf0";
} else if (data.announcements.incident.style === "warning") {
backgroundColor = "#f8a306";
} else if (data.announcements.incident.style === "danger") {
backgroundColor = "#dc3545";
} else if (data.announcements.incident.style === "primary") {
backgroundColor = "#5cdd8b";
} else if (data.announcements.incident.style === "light") {
backgroundColor = "#f8f9fa";
} else if (data.announcements.incident.style === "dark") {
backgroundColor = "#212529";
}
}
}
2022-08-04 14:54:22 +05:30
</script>
2023-01-25 22:41:11 +05:30
<Hero />
{#if !data.error}
{#if data.announcements.incident}
<div class="flex flex-col items-center mt-16">
2023-02-03 23:25:33 +05:30
<div
class="flex flex-col prose break-words rounded p-4 lt-sm:max-w-74 sm:(p-8) {backgroundColor ===
'#212529'
? 'text-text'
: 'text-black'}"
style="background-color: {backgroundColor};"
>
2023-01-25 22:41:11 +05:30
{#if data.announcements.incident.title}
2023-02-03 23:25:33 +05:30
<span class="text-xl font-semibold"
>{data.announcements.incident.title}</span
>
2023-01-25 22:41:11 +05:30
{/if}
2022-08-05 19:31:15 +05:30
2023-01-25 22:41:11 +05:30
{#if data.announcements.incident.content}
2023-02-03 23:25:33 +05:30
<p>
{@html sanitizeHtml(
data.announcements.incident.content.replace(
/\n/g,
"<br />"
)
)}
</p>
2023-01-25 22:41:11 +05:30
{/if}
2022-08-04 14:54:22 +05:30
2023-01-25 22:41:11 +05:30
<span>Created - {data.announcements.incident.createdDate}</span>
{#if data.announcements.incident.lastUpdatedDate}
2023-02-03 23:25:33 +05:30
<span
>Updated - {data.announcements.incident
.lastUpdatedDate}</span
>
2023-01-25 22:41:11 +05:30
{/if}
</div>
2023-02-03 23:25:33 +05:30
</div>
2023-01-25 22:41:11 +05:30
{/if}
{:else}
<p>{data.message}</p>
2023-02-03 23:25:33 +05:30
{/if}