mirror of
https://github.com/ProjectSegfault/website.git
synced 2024-11-16 05:03:05 +05:30
adjust to new api
This commit is contained in:
parent
5a76748208
commit
5ab0e2ecdc
@ -2,5 +2,8 @@ import type { PageServerLoad } from "./$types";
|
||||
import { env } from "$env/dynamic/private";
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
return await fetch(env.VITE_API_URL + "/api/v1/status").then((res) => res.json());
|
||||
return {
|
||||
state: await fetch(env.VITE_API_URL + "/api/v1/state/status").then((res) => res.json()),
|
||||
instances: await fetch(env.VITE_API_URL + "/api/v1/status").then((res) => res.json())
|
||||
}
|
||||
}
|
@ -13,52 +13,60 @@
|
||||
</svelte:head>
|
||||
|
||||
<h1>Our instances</h1>
|
||||
<div class="flex flex-col gap-4">
|
||||
<CardOuter>
|
||||
<div class="wrapper">
|
||||
{#each data.status as group}
|
||||
<h2>{group.name}</h2>
|
||||
<div class="items">
|
||||
{#each group.data as item}
|
||||
<CardInner
|
||||
title={item.name}
|
||||
description={item.description}
|
||||
icon={item.icon}
|
||||
>
|
||||
<LinksOuter>
|
||||
<InstanceLink url={item.link} item={item.status} type="main" />
|
||||
|
||||
{#if item.us}
|
||||
<InstanceLink url={item.us} item={item.statusUs} type="us" />
|
||||
{/if}
|
||||
{#if data.state.enabled}
|
||||
<div class="flex flex-col gap-4">
|
||||
<CardOuter>
|
||||
<div class="wrapper">
|
||||
{#each data.instances.status as group}
|
||||
<h2>{group.name}</h2>
|
||||
<div class="items">
|
||||
{#each group.data as item}
|
||||
<CardInner
|
||||
title={item.name}
|
||||
description={item.description}
|
||||
icon={item.icon}
|
||||
>
|
||||
<LinksOuter>
|
||||
<InstanceLink url={item.link} item={item.status} type="main" />
|
||||
|
||||
{#if item.bp}
|
||||
<InstanceLink url={item.bp} item={item.statusBp} type="backup" />
|
||||
{/if}
|
||||
</LinksOuter>
|
||||
</CardInner>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</CardOuter>
|
||||
{#if item.us}
|
||||
<InstanceLink url={item.us} item={item.statusUs} type="us" />
|
||||
{/if}
|
||||
|
||||
<span>Last updated: {dayjs
|
||||
.unix(data.updated)
|
||||
.format("DD/MM/YYYY HH:mm:ss")}
|
||||
</span>
|
||||
</div>
|
||||
{#if item.bp}
|
||||
<InstanceLink url={item.bp} item={item.statusBp} type="backup" />
|
||||
{/if}
|
||||
</LinksOuter>
|
||||
</CardInner>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</CardOuter>
|
||||
|
||||
<style>
|
||||
.wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
<span>Last updated: {dayjs
|
||||
.unix(data.instances.updated)
|
||||
.format("DD/MM/YYYY HH:mm:ss")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
.items {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 2rem;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.items {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 2rem;
|
||||
}
|
||||
</style>
|
||||
{:else}
|
||||
<div class="flex items-center gap-1 mt-16">
|
||||
<div class="i-fa6-solid:circle-info" />
|
||||
<span>Instances are currently disabled.</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user