frontend: add svelte frontend

This commit is contained in:
2025-07-20 23:51:54 -06:00
parent a01ec82833
commit 7a2b0fd4d6
40 changed files with 17358 additions and 349 deletions
+50
View File
@@ -0,0 +1,50 @@
<script lang="ts">
import Cover from './Cover.svelte';
import { fetchApps } from './apps';
interface App {
title: string;
id: number;
hdr_supported: boolean;
}
interface AppsResponse {
apps: Record<string, App[]>;
}
let appsPromise: Promise<AppsResponse>;
//async function fetchApps() {
// console.log('apps');
// const response = await fetch('/api/apps');
// console.log(response);
// const data = (await response.json()) as AppsResponse;
// console.log(data);
// return data;
//}
appsPromise = fetchApps();
</script>
{#await appsPromise}
<p>Loading...</p>
{:then resp}
<div class="apps-container">
{#each Object.entries(resp.apps) as [server_name, apps]}
{#each apps as app}
<Cover {app} {server_name}></Cover>
{/each}
{/each}
</div>
{:catch error}
<p>Error: {error.message}</p>
{/await}
<style>
.apps-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
padding: 20px 0;
}
</style>