From 215b0c5cb2ff0ef0b2c7b5549704e23d651a4df9 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 10 Oct 2024 21:51:10 -0400 Subject: Hoist the UI one step up further --- ui/src/lib/store/channels.js | 71 -------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 ui/src/lib/store/channels.js (limited to 'ui/src/lib/store/channels.js') diff --git a/ui/src/lib/store/channels.js b/ui/src/lib/store/channels.js deleted file mode 100644 index bb6c86c..0000000 --- a/ui/src/lib/store/channels.js +++ /dev/null @@ -1,71 +0,0 @@ -export class Channels { - constructor() { - this.channels = []; - } - - setChannels(channels) { - this.channels = [...channels]; - this.sort(); - return this; - } - - addChannel(id, name) { - this.channels = [...this.channels, { id, name }]; - this.sort(); - return this; - } - - deleteChannel(id) { - const channelIndex = this.channels.map((e) => e.id).indexOf(id); - if (channelIndex !== -1) { - this.channels.splice(channelIndex, 1); - } - return this; - } - - sort() { - this.channels.sort((a, b) => { - if (a.name < b.name) { - return -1; - } else if (a.name > b.name) { - return 1; - } - return 0; - }); - } -} - -export class ActiveChannel { - constructor() { - this.channel = null; - } - - isSet() { - return this.channel !== null; - } - - get() { - return this.channel; - } - - is(id) { - return this.channel === id; - } - - set(id) { - this.channel = id; - return this; - } - - deleteChannel(id) { - if (this.is(id)) { - return this.clear(); - } - return this; - } - - clear() { - this.channel = null; - return this; - } -} -- cgit v1.2.3