implement state api

This commit is contained in:
2022-10-01 16:11:54 +03:00
parent 04041ecf63
commit e614734b8a
10 changed files with 2431 additions and 1730 deletions

View File

@@ -2,20 +2,9 @@
import SvelteSeo from "svelte-seo";
import Hero from "$lib/Hero.svelte";
import LinkButton from "$lib/LinkButton.svelte";
import Note from "$lib/Form/Note.svelte";
import dayjs from "dayjs";
import Announcements from "$lib/Announcements.svelte";
let description: string = "Open source development and hosted services.";
let announcements: any = [];
async function fetchAnnouncements() {
const url = `https://segfautils.projectsegfau.lt/api/announcements`;
const response = await fetch(url);
announcements = await response.json();
return announcements;
}
const promise = fetchAnnouncements();
</script>
<SvelteSeo title="Home | Project Segfault" {description} />
@@ -41,76 +30,7 @@
</div>
</Hero>
<div class="announcements">
{#await promise}
<span />
{:then}
<div class="announcement-container">
<div class="announcement">
<div class="general">
{#if announcements.severity === "info"}
<div class="i-fa6-solid:circle-info" />
{:else}
<div class="i-fa6-solid:triangle-exclamation" />
{/if}
<span>
{dayjs
.unix(announcements.created)
.format("DD/MM/YYYY HH:mm")}
</span>
</div>
<div class="title">
<h1>{announcements.title}</h1>
</div>
{#if announcements.link}
<div class="read-more">
<a href={announcements.link}>Read more...</a>
</div>
{/if}
</div>
</div>
{:catch}
<span />
{/await}
</div>
<noscript>
<div class="no-js">
<Note content="Announcements do not work without JavaScript enabled." />
</div>
<style>
.announcements {
display: none;
}
</style>
</noscript>
{#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}
<Announcements />
<style>
.buttons {
@@ -127,33 +47,4 @@
flex-direction: column;
}
}
.announcement-container {
display: flex;
justify-content: center;
margin-top: 4rem;
}
.announcement {
color: #252525 !important;
padding: 2rem 1rem;
border-radius: 10px;
width: fit-content;
display: flex;
flex-direction: column;
}
.announcement a {
color: #252525;
}
.announcement .general {
display: flex;
align-items: center;
gap: 8px;
}
.no-js {
@apply flex justify-center text-center text-red;
}
</style>

View File

@@ -14,5 +14,6 @@ description: We're not anarchists, so we have some rules.
5. While we do try to keep your data safe, you have to acknowledge that **we are not responsible** if anything **unintentional** happens (such as **data loss**, **inability to extract your data** due to the server being down.). It is also **your responsibility** to **keep a backup of your data** if it matters to you.
### Failure to comply will either end up **disabling** your account, and/or if it is illegal, **reporting** to the police.
* Be aware that "**reporting** to the police" only happens if the individual is using our services to **post, promote, or encourage** actions that are **morally unnacceptable**. (Such as: pedophilia, murder, or CSAM.)
* **No warnings will be issued if we find this out.**
- Be aware that "**reporting** to the police" only happens if the individual is using our services to **post, promote, or encourage** actions that are **morally unnacceptable**. (Such as: pedophilia, murder, or CSAM.)
- **No warnings will be issued if we find this out.**

View File

@@ -232,11 +232,15 @@
<TimelineConnector />
</TimelineSeparator>
<TimelineContent>
<h3>
Resignation of members and the start of a new era.
</h3>
<h3>Resignation of members and the start of a new era.</h3>
<p>
Devnol, Odyssey and akisblack resigned from the team leading to a serious loss of manpower. To combat this, we decided to shut down some of our unused instances as well as the ones that were painful to deal with. You can read more over at <a href="https://blog.projectsegfau.lt/resignation-of-3-members-of-projectsegfault/">this blog post</a>.
Devnol, Odyssey and akisblack resigned from the team leading to
a serious loss of manpower. To combat this, we decided to shut
down some of our unused instances as well as the ones that were
painful to deal with. You can read more over at <a
href="https://blog.projectsegfau.lt/resignation-of-3-members-of-projectsegfault/"
>this blog post</a
>.
</p>
</TimelineContent>
</TimelineItem>