summaryrefslogtreecommitdiff
path: root/ui/lib/state
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-05-13 23:51:55 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-05-13 23:51:55 -0400
commitc8bfcf0da05de75dc5c1da9c37cb9302e7268df1 (patch)
treece51c12bec92b08382e75440362422a6bc0d6c61 /ui/lib/state
parentad4ac3e10d2a3e5569c1b36f87d6a5f78a9cf863 (diff)
Track created-at times for each channel.
Diffstat (limited to 'ui/lib/state')
-rw-r--r--ui/lib/state/remote/channels.svelte.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/ui/lib/state/remote/channels.svelte.js b/ui/lib/state/remote/channels.svelte.js
index 64edb09..b6da31b 100644
--- a/ui/lib/state/remote/channels.svelte.js
+++ b/ui/lib/state/remote/channels.svelte.js
@@ -1,10 +1,27 @@
+import { DateTime } from 'luxon';
import { SvelteMap } from 'svelte/reactivity';
+class Channel {
+ static boot({ at, id, name }) {
+ return new Channel({
+ at: DateTime.fromISO(at),
+ id,
+ name
+ });
+ }
+
+ constructor({ at, id, name }) {
+ this.at = at;
+ this.id = id;
+ this.name = name;
+ }
+}
+
export class Channels {
all = $state();
static boot(channels) {
- const all = new SvelteMap(channels.map((channel) => [channel.id, channel]));
+ const all = new SvelteMap(channels.map((channel) => [channel.id, Channel.boot(channel)]));
return new Channels({ all });
}
@@ -12,8 +29,8 @@ export class Channels {
this.all = all;
}
- add({ id, name }) {
- this.all.set(id, { id, name });
+ add({ at, id, name }) {
+ this.all.set(id, Channel.boot({ at, id, name }));
}
remove(id) {