diff --git a/frontend/public/global.css b/frontend/public/global.css index 6be0050..013a60a 100644 --- a/frontend/public/global.css +++ b/frontend/public/global.css @@ -115,6 +115,10 @@ body { transform: translate(-50%, -50%); } +.modal-backdrop-opaque { + background-color: var(--background-color-1); +} + .modal { display: flex; flex-direction: column; diff --git a/frontend/src/auth.js b/frontend/src/auth.js new file mode 100644 index 0000000..2396204 --- /dev/null +++ b/frontend/src/auth.js @@ -0,0 +1,22 @@ +import gateway, { GatewayEventType } from "./gateway"; +import { setAuthToken } from "./storage"; +import { overlayStore } from "./stores"; + +function useAuthHandlers() { + gateway.subscribe(GatewayEventType.Ready, () => { + overlayStore.close("login"); + overlayStore.close("createAccount"); + }); + + gateway.subscribe(GatewayEventType.BadAuth, () => { + overlayStore.open("login", {}); + }); +} + +export function authWithToken(token, shouldUpdate=false) { + if (shouldUpdate) + setAuthToken(token); + gateway.init(token); +} + +useAuthHandlers(); diff --git a/frontend/src/components/overlays/CreateAccount.svelte b/frontend/src/components/overlays/CreateAccount.svelte new file mode 100644 index 0000000..872cd2b --- /dev/null +++ b/frontend/src/components/overlays/CreateAccount.svelte @@ -0,0 +1,77 @@ + + + + +