summaryrefslogtreecommitdiff
path: root/ui/lib/store
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-11-03 21:43:00 -0500
committerKit La Touche <kit@transneptune.net>2024-11-03 21:43:00 -0500
commitf38881f3253b3a128154ffd95655859e3dc629dc (patch)
treee0b1eea57aa8b431aa83e2efc4577c12d3cc2b29 /ui/lib/store
parent032bd28ee996e076bc8341704f74f062a2672645 (diff)
Run spaces-style prettier formatting
Diffstat (limited to 'ui/lib/store')
-rw-r--r--ui/lib/store/channels.js60
-rw-r--r--ui/lib/store/logins.js34
-rw-r--r--ui/lib/store/messages.js64
3 files changed, 79 insertions, 79 deletions
diff --git a/ui/lib/store/channels.js b/ui/lib/store/channels.js
index b57ca7e..37dc673 100644
--- a/ui/lib/store/channels.js
+++ b/ui/lib/store/channels.js
@@ -1,36 +1,36 @@
export class Channels {
- constructor() {
- this.channels = [];
- }
+ constructor() {
+ this.channels = [];
+ }
- setChannels(channels) {
- this.channels = [...channels];
- this.sort();
- return this;
- }
+ setChannels(channels) {
+ this.channels = [...channels];
+ this.sort();
+ return this;
+ }
- addChannel(id, name) {
- this.channels = [...this.channels, { id, name }];
- 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;
- }
+ 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;
- });
- }
+ sort() {
+ this.channels.sort((a, b) => {
+ if (a.name < b.name) {
+ return -1;
+ } else if (a.name > b.name) {
+ return 1;
+ }
+ return 0;
+ });
+ }
}
diff --git a/ui/lib/store/logins.js b/ui/lib/store/logins.js
index 5b45206..d449b3a 100644
--- a/ui/lib/store/logins.js
+++ b/ui/lib/store/logins.js
@@ -1,22 +1,22 @@
export class Logins {
- constructor() {
- this.logins = {};
- }
+ constructor() {
+ this.logins = {};
+ }
- addLogin(id, name) {
- this.logins[id] = name;
- return this;
- }
+ addLogin(id, name) {
+ this.logins[id] = name;
+ return this;
+ }
- setLogins(logins) {
- this.logins = {};
- for (let { id, name } of logins) {
- this.addLogin(id, name);
- }
- return this;
- }
+ setLogins(logins) {
+ this.logins = {};
+ for (let { id, name } of logins) {
+ this.addLogin(id, name);
+ }
+ return this;
+ }
- get(id) {
- return this.logins[id];
- }
+ get(id) {
+ return this.logins[id];
+ }
}
diff --git a/ui/lib/store/messages.js b/ui/lib/store/messages.js
index 884b296..62c567a 100644
--- a/ui/lib/store/messages.js
+++ b/ui/lib/store/messages.js
@@ -1,40 +1,40 @@
export class Messages {
- constructor() {
- this.channels = {};
- }
+ constructor() {
+ this.channels = {};
+ }
- inChannel(channel) {
- return (this.channels[channel] = this.channels[channel] || []);
- }
+ inChannel(channel) {
+ return (this.channels[channel] = this.channels[channel] || []);
+ }
- addMessage(channel, id, at, sender, body) {
- this.updateChannel(channel, (messages) => [...messages, { id, at, sender, body }]);
- return this;
- }
+ addMessage(channel, id, at, sender, body) {
+ this.updateChannel(channel, (messages) => [...messages, { id, at, sender, body }]);
+ return this;
+ }
- setMessages(messages) {
- this.channels = {};
- for (let { channel, id, at, sender, body } of messages) {
- this.inChannel(channel).push({ id, at, sender, body });
- }
- return this;
- }
+ setMessages(messages) {
+ this.channels = {};
+ for (let { channel, id, at, sender, body } of messages) {
+ this.inChannel(channel).push({ id, at, sender, body });
+ }
+ return this;
+ }
- deleteMessage(message) {
- for (let channel in this.channels) {
- this.updateChannel(channel, (messages) => messages.filter((msg) => msg.id != message));
- }
- return this;
- }
+ deleteMessage(message) {
+ for (let channel in this.channels) {
+ this.updateChannel(channel, (messages) => messages.filter((msg) => msg.id != message));
+ }
+ return this;
+ }
- deleteChannel(id) {
- delete this.channels[id];
- return this;
- }
+ deleteChannel(id) {
+ delete this.channels[id];
+ return this;
+ }
- updateChannel(channel, callback) {
- let messages = callback(this.inChannel(channel));
- messages.sort((a, b) => a.at - b.at);
- this.channels[channel] = messages;
- }
+ updateChannel(channel, callback) {
+ let messages = callback(this.inChannel(channel));
+ messages.sort((a, b) => a.at - b.at);
+ this.channels[channel] = messages;
+ }
}