From 7dfc125f66e2b31c87bf530cb1bd3eb6d1a0621b Mon Sep 17 00:00:00 2001 From: Seven Date: Sun, 21 Dec 2025 04:41:44 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B5=85=E8=89=B2=E4=B8=BB=E9=A2=98=E6=94=AF=E6=8C=81=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/useTheme.ts | 11 ++++++++--- src/store/user.ts | 2 +- src/theme/variables.css | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/composables/useTheme.ts b/src/composables/useTheme.ts index 39fc55a..d1b620b 100644 --- a/src/composables/useTheme.ts +++ b/src/composables/useTheme.ts @@ -1,5 +1,3 @@ -import { usePreferredDark } from "@vueuse/core"; - export type ThemeMode = "light" | "dark" | "auto"; const STORAGE_KEY = "app-theme-mode"; @@ -16,7 +14,14 @@ export function useTheme() { }); watch(isDark, (dark) => { - document.documentElement.classList.toggle("ion-palette-dark", dark); + if (dark) { + document.documentElement.classList.toggle("ion-palette-dark", dark); + document.documentElement.classList.remove("ion-palette-light"); + } + else { + document.documentElement.classList.remove("ion-palette-dark"); + document.documentElement.classList.add("ion-palette-light"); + } }, { immediate: true }); return { diff --git a/src/store/user.ts b/src/store/user.ts index f3cab33..b691497 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -14,7 +14,7 @@ export const useUserStore = defineStore("user", () => { userProfile: null, }); - const isAuthenticated = computed(() => token.value !== null); + const isAuthenticated = computed(() => !!token.value); async function updateProfile() { const { data } = await safeClient(client.api.user.profile.get(), { silent: true }); diff --git a/src/theme/variables.css b/src/theme/variables.css index 1573e0f..e2abc3d 100644 --- a/src/theme/variables.css +++ b/src/theme/variables.css @@ -1,6 +1,6 @@ /* For information on how to create your own theme, please refer to: http://ionicframework.com/docs/theming/ */ -html:root { +html.ion-palette-light { --ion-color-primary: #0d0d0d; --ion-color-primary-rgb: 13, 13, 13; --ion-color-primary-contrast: #ffffff;