From 74c229e38ba8b498d940d9a360cb5062e9446bf3 Mon Sep 17 00:00:00 2001 From: Mikita Date: Fri, 24 Oct 2025 19:37:35 +0200 Subject: [PATCH] wip --- app.vue | 47 ++++++- components/ActionBar.vue | 10 ++ components/Auth.vue | 41 ++++++ components/Connection.vue | 3 +- components/LeftSidebar.vue | 42 ++++-- components/TheFooter.vue | 85 ++++-------- components/cmd/CommandMenu.vue | 90 +++--------- components/modals/LoginModal.vue | 68 +++++++++ components/modals/ModalsManager.vue | 16 ++- components/modals/SettingsModal.vue | 194 ++++++++++++++++++++++++++ components/modals/SignupModal.vue | 201 +++++++++++++++++++++++++++ components/shared/AdvBanner.vue | 29 ++-- package.json | 3 +- pages/auth/callback.vue | 19 +++ pnpm-lock.yaml | 7 + services/auth.js | 20 +++ services/config.js | 12 ++ services/constants/settings.js | 18 +++ store/auth.store.js | 205 ++++++++++++++++++++++++++++ 19 files changed, 956 insertions(+), 154 deletions(-) create mode 100644 components/Auth.vue create mode 100644 components/modals/LoginModal.vue create mode 100644 components/modals/SettingsModal.vue create mode 100644 components/modals/SignupModal.vue create mode 100644 pages/auth/callback.vue create mode 100644 services/auth.js create mode 100644 services/constants/settings.js create mode 100644 store/auth.store.js diff --git a/app.vue b/app.vue index 70e5174e..32ff0cd4 100644 --- a/app.vue +++ b/app.vue @@ -3,6 +3,8 @@ import Socket from "@/services/api/socket" import amp from "@/services/amp" import { watchForUpdate } from "@/services/version" +import { DEFAULT_SETTINGS } from "@/services/constants/settings.js" +import { isPrefersDarkScheme } from "@/services/utils" /** Components */ import ModalsManager from "@/components/modals/ModalsManager.vue" @@ -21,6 +23,7 @@ import { useSettingsStore } from "@/store/settings.store" import { useEnumStore } from "@/store/enums.store" import { useLegalStore } from "@/store/legal.store" import { useNotificationsStore } from "@/store/notifications.store" + const nodeStore = useNodeStore() const appStore = useAppStore() const bookmarksStore = useBookmarksStore() @@ -43,7 +46,47 @@ appStore.initConstants() let watchInterval = null +const settings = useCookie("localSettings", { + default: () => { + return DEFAULT_SETTINGS + }, +}) + +switch (settings.value.appearance.general.theme) { + case "dark": + case "dimmed": + case "light": + appStore.theme = settings.value.appearance.general.theme + + break + + case "system": + appStore.theme = "system" + + break +} + +watch(() => settings.value.appearance.general.theme, () => { + let root = document.querySelector("html") + + if (appStore.theme === "system") { + window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (event) => { + root.setAttribute("theme", isPrefersDarkScheme() ? "dark" : "light") + }) + } else { + root.setAttribute("theme", settings.value.appearance.general.theme) + } +}, { deep: true }) + onMounted(async () => { + let root = document.querySelector("html") + + if (appStore.theme === "system") { + root.setAttribute("theme", isPrefersDarkScheme() ? "dark" : "light") + } else { + root.setAttribute("theme", appStore.theme) + } + /** * Watch for package.json->version and notify users about the new version */ @@ -92,7 +135,7 @@ onMounted(async () => { settingsStore.init() appStore.initGlobalUpdates() - + const runtimeConfig = useRuntimeConfig() amp.init(runtimeConfig.public.AMP) @@ -132,7 +175,7 @@ onMounted(async () => { }) } - window.onbeforeunload = function () { + window.onbeforeunload = function() { Socket.close() } }) diff --git a/components/ActionBar.vue b/components/ActionBar.vue index e1c78678..7550453c 100644 --- a/components/ActionBar.vue +++ b/components/ActionBar.vue @@ -12,7 +12,13 @@ import { isMobile } from "@/services/utils" /** Store */ import { useAppStore } from "@/store/app.store" +import { useAuthStore } from "@/store/auth.store.js" +import { useModalsStore } from "@/store/modals.store.js" + const appStore = useAppStore() +const authStore = useAuthStore() +const modalsStore = useModalsStore() + diff --git a/components/Auth.vue b/components/Auth.vue new file mode 100644 index 00000000..aac94205 --- /dev/null +++ b/components/Auth.vue @@ -0,0 +1,41 @@ + + + +> \ No newline at end of file diff --git a/components/Connection.vue b/components/Connection.vue index 062c580a..3d014a64 100644 --- a/components/Connection.vue +++ b/components/Connection.vue @@ -12,6 +12,7 @@ import { arabica, mainnet, mammoth, mocha } from "@/services/chains" import { useAppStore } from "@/store/app.store" import { useModalsStore } from "@/store/modals.store" import { useNotificationsStore } from "@/store/notifications.store" + const appStore = useAppStore() const modalsStore = useModalsStore() const notificationsStore = useNotificationsStore() @@ -84,7 +85,7 @@ const handleDisconnect = () => {