From 4c9e3211675a127332ed223d4ffbe1f53a39510b Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sat, 3 Sep 2022 17:30:39 +0300 Subject: [PATCH] greatly overhaul overlay system --- frontend/src/auth.js | 8 +- frontend/src/components/ChannelTopBar.svelte | 4 +- frontend/src/components/Message.svelte | 4 +- frontend/src/components/MessageInput.svelte | 4 +- frontend/src/components/Sidebar.svelte | 8 +- .../components/overlays/CreateAccount.svelte | 14 ++-- .../components/overlays/CreateChannel.svelte | 6 +- .../components/overlays/EditChannel.svelte | 10 +-- .../components/overlays/EditMessage.svelte | 11 +-- frontend/src/components/overlays/Login.svelte | 14 ++-- .../overlays/OverlayProvider.svelte | 39 ++++------ .../src/components/overlays/Prompt.svelte | 12 +-- .../src/components/overlays/Settings.svelte | 17 ++--- frontend/src/components/overlays/Toast.svelte | 3 +- frontend/src/request.js | 4 +- frontend/src/stores.js | 76 +++++++++++++------ 16 files changed, 117 insertions(+), 117 deletions(-) diff --git a/frontend/src/auth.js b/frontend/src/auth.js index 1ca4db4..9e53d79 100644 --- a/frontend/src/auth.js +++ b/frontend/src/auth.js @@ -1,15 +1,15 @@ import gateway, { GatewayEventType } from "./gateway"; import { removeItem, setItem } from "./storage"; -import { overlayStore } from "./stores"; +import { overlayStore, OverlayType } from "./stores"; export function useAuthHandlers() { gateway.subscribe(GatewayEventType.Ready, () => { - overlayStore.close("login"); - overlayStore.close("createAccount"); + overlayStore.popType(OverlayType.Login); + overlayStore.popType(OverlayType.CreateAccount); }); gateway.subscribe(GatewayEventType.BadAuth, () => { - overlayStore.open("login", {}); + overlayStore.push(OverlayType.Login, {}); }); } diff --git a/frontend/src/components/ChannelTopBar.svelte b/frontend/src/components/ChannelTopBar.svelte index e395730..1a29308 100644 --- a/frontend/src/components/ChannelTopBar.svelte +++ b/frontend/src/components/ChannelTopBar.svelte @@ -1,7 +1,7 @@ @@ -24,7 +24,7 @@ {/if} - { channel.name } + { channel.name }