From 01d995c731c296292cd3f1f9a4702eb96a0bf628 Mon Sep 17 00:00:00 2001
From: Kit La Touche <kit@transneptune.net>
Date: Mon, 30 Sep 2024 23:14:36 -0400
Subject: Absorb and display events

At least message-type ones, and at least without styling or memory-limit
concerns.
---
 hi-ui/src/lib/ActiveChannel.svelte | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

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

diff --git a/hi-ui/src/lib/ActiveChannel.svelte b/hi-ui/src/lib/ActiveChannel.svelte
index 42aa53f..680a785 100644
--- a/hi-ui/src/lib/ActiveChannel.svelte
+++ b/hi-ui/src/lib/ActiveChannel.svelte
@@ -1,15 +1,27 @@
 <script>
-    import { activeChannel } from '../store';
+    import { activeChannel, events } from '../store';
 
-    let channelName;
+    let channel;
+    let allMessages = [];
+    $: messages = allMessages.filter(
+        (ev) => ev.type === 'message' && channel !== null && ev.channel.id === channel.id
+    );
 
     activeChannel.subscribe((value) => {
-        channelName = value ? value.name : 'none';
+        channel = value;
+    });
+
+    events.subscribe((value) => {
+        allMessages = value;
     });
 </script>
 
 <div>
-    Active channel: {channelName}
+    {#each messages as message}
+        <div>
+            <pre><tt>{message.at} @{message.sender.name}: {message.message.body}</tt></pre>
+        </div>
+    {/each}
 </div>
 
 <style>
-- 
cgit v1.2.3

