diff --git a/frontend/src/components/modals/CreateChannel.svelte b/frontend/src/components/modals/CreateChannel.svelte new file mode 100644 index 0000000..f5cab7e --- /dev/null +++ b/frontend/src/components/modals/CreateChannel.svelte @@ -0,0 +1,42 @@ + + + + + diff --git a/frontend/src/components/pages/main/Main.svelte b/frontend/src/components/pages/main/Main.svelte index c46e3b5..ddf1be5 100644 --- a/frontend/src/components/pages/main/Main.svelte +++ b/frontend/src/components/pages/main/Main.svelte @@ -1,7 +1,9 @@ @@ -23,6 +25,7 @@ {/if}
+ {#if $selectedChannel.id === -1}
diff --git a/frontend/src/components/pages/main/OverlayProvider.svelte b/frontend/src/components/pages/main/OverlayProvider.svelte new file mode 100644 index 0000000..e1e1990 --- /dev/null +++ b/frontend/src/components/pages/main/OverlayProvider.svelte @@ -0,0 +1,8 @@ + + +{#if $overlayStore.createChannel} + +{/if} diff --git a/frontend/src/components/pages/main/Sidebar.svelte b/frontend/src/components/pages/main/Sidebar.svelte index ab4aae1..7d52dbf 100644 --- a/frontend/src/components/pages/main/Sidebar.svelte +++ b/frontend/src/components/pages/main/Sidebar.svelte @@ -1,6 +1,6 @@ @@ -15,6 +15,12 @@ { channel.name } {/each} +
diff --git a/frontend/src/gateway.js b/frontend/src/gateway.js index bdeb730..4213e6d 100644 --- a/frontend/src/gateway.js +++ b/frontend/src/gateway.js @@ -23,7 +23,7 @@ export const GatewayEventType = { Close: -4 } -const log = logging.logger("Gateway"); +const log = logging.logger("Gateway", true); export default { ws: null, @@ -38,8 +38,10 @@ export default { init() { const token = getAuthToken(); if (!token) { + log("no auth token, skipping connection"); return false; } + log(`connecting to gateway - gatewayBase: ${getItem("gatewayBase")}`); this.ws = new WebSocket(getItem("gatewayBase")); this.ws.onopen = () => { if (this.reconnectTimeout) { diff --git a/frontend/src/storage.js b/frontend/src/storage.js index c28c99c..08aba50 100644 --- a/frontend/src/storage.js +++ b/frontend/src/storage.js @@ -1,6 +1,7 @@ const defaults = { apiBase: `${window.location.origin}/api/v1`, - gatewayBase: `${location.protocol === "https:" ? "wss" : "ws"}://${location.host}/gateway` + gatewayBase: `${location.protocol === "https:" ? "wss" : "ws"}://${location.host}/gateway`, + token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwODQzMjY1LCJleHAiOjE2NTEwMTYwNjV9.ssu-MlMkwKQOcP5nmJ98KbqudcGW5XBYPc_d6et4oxo" }; const dummyProvider = { diff --git a/frontend/src/stores.js b/frontend/src/stores.js index 496a3c4..8f6e8d2 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -219,8 +219,27 @@ class MessagesStoreProvider { } } +class OverlayStore extends Store { + constructor() { + super({ + createChannel: false + }); + } + + open(name) { + this.value[name] = true; + this.updated(); + } + + close(name) { + this.value[name] = false; + this.updated(); + } +} + export const channels = new ChannelsStore(); export const gatewayStatus = new GatewayStatusStore(); export const messagesStoreProvider = new MessagesStoreProvider(); export const userInfoStore = new UserInfoStore(); +export const overlayStore = new OverlayStore(); export const selectedChannel = writable({ id: -1, name: "none", creator_id: -1 });