diff --git a/frontend/public/global.css b/frontend/public/global.css
index b7474c4..68c8c8f 100644
--- a/frontend/public/global.css
+++ b/frontend/public/global.css
@@ -59,6 +59,15 @@
--radius-xxl: calc(5.25 * var(--sradius-unit));
}
+.theme-light {
+ --foreground-color-1: hsl(180, 11%, 7%);
+ --foreground-color-2: hsl(180, 11%, 12%);
+ --foreground-color-3: hsl(180, 11%, 17%);
+ --background-color-1: rgb(253, 254, 255);
+ --background-color-2: rgb(218, 219, 220);
+ --background-color-3: rgb(153, 154, 155);
+}
+
html, body {
width: 100%;
height: 100%;
@@ -210,6 +219,18 @@ body {
background-color: var(--purple-2);
}
+.button-red {
+ background-color: var(--red-2);
+}
+
+.button-red:hover {
+ background-color: var(--red-1);
+}
+
+.button-red:disabled {
+ background-color: var(--red-2);
+}
+
.icon-button {
display: flex;
justify-content: center;
diff --git a/frontend/src/auth.js b/frontend/src/auth.js
index 2396204..0dfe85f 100644
--- a/frontend/src/auth.js
+++ b/frontend/src/auth.js
@@ -19,4 +19,10 @@ export function authWithToken(token, shouldUpdate=false) {
gateway.init(token);
}
+export function logOut() {
+ setAuthToken(null);
+ gateway.close();
+ gateway.dispatch(GatewayEventType.BadAuth, -1);
+}
+
useAuthHandlers();
diff --git a/frontend/src/components/Sidebar.svelte b/frontend/src/components/Sidebar.svelte
index f282425..3f7c63c 100644
--- a/frontend/src/components/Sidebar.svelte
+++ b/frontend/src/components/Sidebar.svelte
@@ -1,5 +1,5 @@
{#if $overlayStore.createChannel}
@@ -26,3 +27,6 @@
{#if $overlayStore.editMessage}
{/if}
+{#if $overlayStore.settings}
+
+{/if}
diff --git a/frontend/src/components/overlays/Settings.svelte b/frontend/src/components/overlays/Settings.svelte
new file mode 100644
index 0000000..f44905d
--- /dev/null
+++ b/frontend/src/components/overlays/Settings.svelte
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
Account
+
+
+
+
+
+
{ $userInfoStore ? $userInfoStore.username : "" }
+
+
+
+
+
+
diff --git a/frontend/src/gateway.js b/frontend/src/gateway.js
index bf845dc..54e20ec 100644
--- a/frontend/src/gateway.js
+++ b/frontend/src/gateway.js
@@ -47,6 +47,7 @@ export default {
reconnectDelay: 400,
reconnectTimeout: null,
handlers: new Map(),
+ disableReconnect: false,
init(token) {
if (!token) {
log("no auth token, skipping connection");
@@ -59,6 +60,7 @@ export default {
if (this.reconnectTimeout) {
clearTimeout(this.reconnectTimeout);
}
+ this.disableReconnect = false;
this.open = true;
this.dispatch(GatewayEventType.Open, null);
log("open");
@@ -109,6 +111,9 @@ export default {
this.dispatch(GatewayEventType.BadAuth, 1);
if (this.reconnectTimeout)
clearTimeout(this.reconnectTimeout);
+ } else if (this.disableReconnect) {
+ if (this.reconnectTimeout)
+ clearTimeout(this.reconnectTimeout);
} else {
if (this.reconnectDelay < 60000) {
this.reconnectDelay *= 2;
@@ -155,5 +160,10 @@ export default {
if (eventHandlers.size < 1) {
this.handlers.delete(event);
}
+ },
+ close() {
+ this.disableReconnect = true;
+ if (this.ws)
+ this.ws.close();
}
};
diff --git a/frontend/src/stores.js b/frontend/src/stores.js
index 096815e..057e9aa 100644
--- a/frontend/src/stores.js
+++ b/frontend/src/stores.js
@@ -193,6 +193,9 @@ class MessageStore extends Store {
}
async doInitialLoad() {
+ if (this.channelId === -1)
+ return;
+
await this.loadOlderMessages();
this.didDoInitialLoad = true;
}
@@ -244,7 +247,8 @@ class OverlayStore extends Store {
editChannel: null,
toast: null,
login: null,
- createAccount: null
+ createAccount: null,
+ settings: null
});
}