2024-01-01 18:40:02 +01:00
|
|
|
<svelte:options runes={true} />
|
|
|
|
|
2024-01-01 07:07:55 +01:00
|
|
|
<script lang="ts">
|
2024-01-02 02:10:18 +01:00
|
|
|
import ServiceCard from '$lib/components/ServiceCard.svelte';
|
2024-01-01 20:10:19 +01:00
|
|
|
import type { Service } from '$lib/types/data-types';
|
2024-01-01 07:07:55 +01:00
|
|
|
|
2024-01-02 02:10:18 +01:00
|
|
|
let services: readonly Service[] = $state.frozen([]);
|
|
|
|
|
|
|
|
let icons: readonly string[] = $state.frozen([]);
|
|
|
|
|
|
|
|
async function get(url: string): Promise<any> {
|
2024-01-02 02:39:22 +01:00
|
|
|
let res = await fetch(url);
|
2024-01-02 02:10:18 +01:00
|
|
|
if (res.ok) {
|
2024-01-02 02:39:22 +01:00
|
|
|
let data = await res.json();
|
|
|
|
return data;
|
|
|
|
} else {
|
|
|
|
return Promise.reject();
|
2024-01-02 02:10:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$effect(() => {
|
2024-01-02 02:39:22 +01:00
|
|
|
get('/data/services').then((data: Service[]) => {
|
|
|
|
services = data;
|
|
|
|
});
|
|
|
|
});
|
2024-01-02 02:10:18 +01:00
|
|
|
|
|
|
|
$effect(() => {
|
2024-01-02 02:39:22 +01:00
|
|
|
get('/assets/icons').then((data: string[]) => {
|
|
|
|
icons = data;
|
|
|
|
});
|
|
|
|
});
|
2024-01-01 07:07:55 +01:00
|
|
|
</script>
|
|
|
|
|
2024-01-01 19:36:42 +01:00
|
|
|
<svelte:head>
|
2024-01-01 20:00:35 +01:00
|
|
|
<title>Services</title>
|
|
|
|
<meta name="description" content="Overview of Services running on neshweb.net" />
|
2024-01-01 19:36:42 +01:00
|
|
|
</svelte:head>
|
|
|
|
|
2024-01-01 20:00:35 +01:00
|
|
|
<div class="flex h-full flex-row flex-wrap justify-center gap-10 overflow-auto p-8">
|
|
|
|
{#each services as service}
|
2024-01-02 02:11:23 +01:00
|
|
|
<ServiceCard {service} {icons} />
|
2024-01-01 20:00:35 +01:00
|
|
|
{/each}
|
|
|
|
</div>
|