From 9b38cb1a62ede4900fde4ba47a7b065db329e994 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 1 Jul 2025 15:40:11 -0400 Subject: Rename "channel" to "conversation" throughout the client. Existing client state, stored in local storage, is migrated to new keys (that mention "conversation" instead of "channel" where appropriate) the first time the client loads. --- ui/lib/state/remote/channels.svelte.js | 29 ----------------------------- ui/lib/state/remote/conversations.svelte.js | 29 +++++++++++++++++++++++++++++ ui/lib/state/remote/state.svelte.js | 8 ++++---- 3 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 ui/lib/state/remote/channels.svelte.js create mode 100644 ui/lib/state/remote/conversations.svelte.js (limited to 'ui/lib/state/remote') diff --git a/ui/lib/state/remote/channels.svelte.js b/ui/lib/state/remote/channels.svelte.js deleted file mode 100644 index 1e40075..0000000 --- a/ui/lib/state/remote/channels.svelte.js +++ /dev/null @@ -1,29 +0,0 @@ -import { DateTime } from 'luxon'; - -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([]); - - add({ at, id, name }) { - this.all.push(Channel.boot({ at, id, name })); - } - - remove(id) { - this.all = this.all.filter((channel) => channel.id !== id); - } -} diff --git a/ui/lib/state/remote/conversations.svelte.js b/ui/lib/state/remote/conversations.svelte.js new file mode 100644 index 0000000..79868f4 --- /dev/null +++ b/ui/lib/state/remote/conversations.svelte.js @@ -0,0 +1,29 @@ +import { DateTime } from 'luxon'; + +class Conversation { + static boot({ at, id, name }) { + return new Conversation({ + at: DateTime.fromISO(at), + id, + name, + }); + } + + constructor({ at, id, name }) { + this.at = at; + this.id = id; + this.name = name; + } +} + +export class Conversations { + all = $state([]); + + add({ at, id, name }) { + this.all.push(Conversation.boot({ at, id, name })); + } + + remove(id) { + this.all = this.all.filter((conversation) => conversation.id !== id); + } +} diff --git a/ui/lib/state/remote/state.svelte.js b/ui/lib/state/remote/state.svelte.js index ffc88c6..3d65e4a 100644 --- a/ui/lib/state/remote/state.svelte.js +++ b/ui/lib/state/remote/state.svelte.js @@ -1,11 +1,11 @@ import { User, Users } from './users.svelte.js'; -import { Channels } from './channels.svelte.js'; +import { Conversations } from './conversations.svelte.js'; import { Messages } from './messages.svelte.js'; export class State { currentUser = $state(); users = $state(new Users()); - channels = $state(new Channels()); + conversations = $state(new Conversations()); messages = $state(new Messages()); static boot({ currentUser, heartbeat, resumePoint, events }) { @@ -50,12 +50,12 @@ export class State { onConversationCreated(event) { const { id, name } = event; - this.channels.add({ id, name }); + this.conversations.add({ id, name }); } onConversationDeleted(event) { const { id } = event; - this.channels.remove(id); + this.conversations.remove(id); } onUserEvent(event) { -- cgit v1.2.3