main page now fetches status with timestamp from netstatus backend. not styled yet

This commit is contained in:
2026-03-31 23:42:55 +02:00
parent 7d0a51a4d9
commit f9011db517

View File

@@ -8,12 +8,36 @@
import UpdateEntry from "$lib/components/update-entry.svelte"; import UpdateEntry from "$lib/components/update-entry.svelte";
import IndieButton from "$lib/components/indie-button.svelte"; import IndieButton from "$lib/components/indie-button.svelte";
import { buttons } from "$lib/components/indie-button"; import { buttons } from "$lib/components/indie-button";
import { onMount } from "svelte";
let latestDevlogDate = devlogPosts[0].post.date; let latestDevlogDate = devlogPosts[0].post.date;
let latestBlogDate = blogPosts[0].post.date; let latestBlogDate = blogPosts[0].post.date;
let updateEntriesTrimmed = updateEntries.slice(0, 4); let updateEntriesTrimmed = updateEntries.slice(0, 4);
let latestStatusContent = $state("fetching status...");
let latestStatusTimestamp = $state("?");
async function getLatestStatus() {
await fetch(`https://back.natconf.dev/netstatus/latestStatus`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
}).then((response) => {
return response.json();
}).then((data) => {
latestStatusContent = data.content;
// using sv-SE because they use ISO 8601 for the formatting. they also luckily follow the same timezone as Germany. thank you sweden, u cool 🇸🇪🇩🇪
latestStatusTimestamp = new Date(data.timestamp).toLocaleString("sv-SE").replace(" ", ", ");
});
}
onMount(() => {
getLatestStatus();
})
const galleryTopRow: GalleryRowEntry[] = [ const galleryTopRow: GalleryRowEntry[] = [
{ {
title: "Homesick devlog", title: "Homesick devlog",
@@ -98,6 +122,8 @@
</div> </div>
</div> </div>
<p>{latestStatusTimestamp} :: {latestStatusContent}</p>
<GalleryRow entries={galleryTopRow} /> <GalleryRow entries={galleryTopRow} />
<GalleryRow entries={galleryBottomRow} /> <GalleryRow entries={galleryBottomRow} />