From 1d8b828d1bbe0e0daa64f6fc2689799c7169afa0 Mon Sep 17 00:00:00 2001
From: Kit La Touche <kit@transneptune.net>
Date: Thu, 19 Sep 2024 23:26:39 -0400
Subject: Add basic browser client

Using Svelte.

No tests, no linting, yet.

This is just starting to get familiar with things.

You'll still have to run the dev server and the dev client builder each
in their own terminals.

Enjoy!
---
 hi-ui/src/lib/ChannelList.svelte | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 hi-ui/src/lib/ChannelList.svelte

(limited to 'hi-ui/src/lib/ChannelList.svelte')

diff --git a/hi-ui/src/lib/ChannelList.svelte b/hi-ui/src/lib/ChannelList.svelte
new file mode 100644
index 0000000..9f88e24
--- /dev/null
+++ b/hi-ui/src/lib/ChannelList.svelte
@@ -0,0 +1,34 @@
+<script>
+	import { onMount } from 'svelte';
+
+    import { listChannels } from '../apiServer';
+    import { channelsList } from '../store';
+    import Channel from './Channel.svelte';
+
+    let channels;
+    let loading = true;
+
+    channelsList.subscribe((value) => {
+        channels = value;
+    });
+
+	onMount(async () => {
+        let channels = await listChannels();
+        channelsList.update(() => channels.data);
+        loading = false;
+    });
+</script>
+
+<ul class="select-none">
+    {#if loading}
+        <li><em>loading channels&hellip;</em></li>
+    {:else}
+        {#each channels as channel}
+            <Channel {...channel} />
+        {/each}
+    {/if}
+</ul>
+
+<style>
+</style>
+
-- 
cgit v1.2.3

