website/src/routes/+page.svelte

153 lines
4.3 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 SvelteSeo from "svelte-seo";
import Hero from "$lib/Hero.svelte";
import LinkButton from "$lib/LinkButton.svelte";
2022-11-10 00:12:34 +05:30
import dayjs from "dayjs";
import type { PageData } from "./$types";
export let data: PageData;
let announcements = data.announcements;
2022-08-05 18:16:54 +05:30
2022-08-08 10:50:29 +05:30
let description: string = "Open source development and hosted services.";
2022-11-29 21:12:15 +05:30
2022-08-04 14:54:22 +05:30
</script>
2022-08-07 15:12:09 +05:30
<SvelteSeo title="Home | Project Segfault" {description} />
2022-08-05 19:31:15 +05:30
<Hero
title="Project Segfault"
2022-11-11 19:02:29 +05:30
{description}
marginTop=7
2022-08-05 19:31:15 +05:30
>
<div class="buttons">
2022-08-31 16:46:12 +05:30
<LinkButton
2022-09-10 21:28:19 +05:30
url="/instances"
title="Explore our instances"
2022-08-31 16:46:12 +05:30
icon="i-fa6-solid:bell-concierge"
/>
<LinkButton
url="/donate"
icon="i-fa6-solid:money-bill"
title="Donate"
bg="#F6C915"
color="#151515"
/>
2022-08-05 19:31:15 +05:30
</div>
2022-08-05 18:16:54 +05:30
</Hero>
2022-08-04 14:54:22 +05:30
2022-11-10 00:12:34 +05:30
{#if data.state.enabled}
2022-11-11 19:02:29 +05:30
{#if !announcements.error}
2022-11-10 20:37:14 +05:30
<div class="announcements">
2022-11-10 00:12:34 +05:30
<div class="announcement-container">
<div class="announcement">
2022-11-11 19:02:29 +05:30
<div class="flex gap-4 flex-col sm:flex-row border-b-2 p-2 pt-0">
2022-11-10 00:12:34 +05:30
{#if announcements.severity === "info"}
2022-11-11 19:02:29 +05:30
<div class="flex items-center gap-2">
<div class="i-fa6-solid:circle-info" />
<span>Info</span>
</div>
2022-11-10 00:12:34 +05:30
{:else}
2022-11-11 19:02:29 +05:30
<div class="flex items-center gap-2">
<div class="i-fa6-solid:triangle-exclamation" />
<span>Attention</span>
</div>
2022-11-10 00:12:34 +05:30
{/if}
2022-11-11 19:02:29 +05:30
<span class="flex items-center gap-2">
<div class="i-fa6-solid:user" />
{announcements.author}
2022-11-10 00:12:34 +05:30
</span>
2022-11-11 19:02:29 +05:30
<span class="flex items-center gap-2">
<div class="i-fa6-solid:calendar" />
2022-11-10 00:12:34 +05:30
{dayjs
.unix(announcements.created)
.format("DD/MM/YYYY HH:mm")}
</span>
</div>
2022-11-29 21:12:15 +05:30
2022-11-10 00:12:34 +05:30
<div class="title">
2022-11-29 21:12:15 +05:30
<div class="text-xl font-semibold font-[var(--font-primary)]">{@html data.content}</div>
2022-11-10 00:12:34 +05:30
</div>
{#if announcements.link}
<div class="read-more">
<a href={announcements.link}>Read more...</a>
</div>
{/if}
</div>
</div>
2022-11-11 19:02:29 +05:30
</div>
{#if announcements.severity === "info"}
<style>
.announcement {
background-color: #8caaee;
}
</style>
{:else if announcements.severity === "low"}
<style>
.announcement {
background-color: #a6d189;
}
</style>
{:else if announcements.severity === "medium"}
<style>
.announcement {
background-color: #e5c890;
}
</style>
{:else if announcements.severity === "high"}
<style>
.announcement {
background-color: #e78284;
}
</style>
{/if}
2022-11-10 00:12:34 +05:30
<style>
2022-11-11 19:02:29 +05:30
.announcement-container {
display: flex;
justify-content: center;
margin-top: 4rem;
2022-11-10 00:12:34 +05:30
}
2022-11-11 19:02:29 +05:30
2022-11-10 00:12:34 +05:30
.announcement {
2022-11-11 19:02:29 +05:30
color: #252525 !important;
padding: 1.5rem;
border-radius: 10px;
width: fit-content;
display: flex;
flex-direction: column;
gap: 1rem;
2022-11-10 00:12:34 +05:30
}
2022-11-11 19:02:29 +05:30
.announcement a {
color: #252525;
2022-11-10 00:12:34 +05:30
}
</style>
{/if}
{:else}
<div class="flex items-center gap-1 text-center justify-center mt-16">
<div class="i-fa6-solid:circle-info" />
<span>Announcements are currently disabled.</span>
</div>
{/if}
2022-08-05 18:16:54 +05:30
<style>
2022-08-05 19:31:15 +05:30
.buttons {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 1rem;
margin: 1rem;
}
2022-08-04 21:20:02 +05:30
2022-08-05 19:31:15 +05:30
@media screen and (max-width: 452px) {
.buttons {
flex-direction: column;
}
}
</style>