diff --git a/bun.lockb b/bun.lockb index 87fc19c..7e5b254 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/default.d.ts b/default.d.ts index f666223..6f315f7 100644 --- a/default.d.ts +++ b/default.d.ts @@ -1,5 +1,5 @@ -import type { LoadingBarProviderInst, MessageProviderInst } from 'naive-ui' +import type { LoadingBarProviderInst, MessageProviderInst, ModalProviderInst } from 'naive-ui' import type { useRoute } from 'vue-router' declare module 'vue3-aplayer' { @@ -20,6 +20,7 @@ declare global { $message: MessageProviderInst $loadingBar: LoadingBarProviderInst $route: ReturnType + $modal: ModalProviderInst $mitt: Emitter } } diff --git a/index.html b/index.html index fa148af..6b2ab9a 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,7 @@ - + diff --git a/package.json b/package.json index ddea64d..ebd26a1 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ "@microsoft/signalr": "^8.0.7", "@microsoft/signalr-protocol-msgpack": "^8.0.7", "@mixer/postmessage-rpc": "^1.1.4", + "@tauri-apps/api": "^2.4.0", + "@tauri-apps/plugin-http": "^2.4.2", "@typescript-eslint/eslint-plugin": "^8.27.0", "@vicons/fluent": "^0.13.0", "@vitejs/plugin-basic-ssl": "^2.0.0", diff --git a/src/App.vue b/src/App.vue index 710cba0..52d4304 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,6 +9,7 @@ import { NLayoutContent, NLoadingBarProvider, NMessageProvider, + NModalProvider, NNotificationProvider, NSpin, zhCN, @@ -16,11 +17,13 @@ import { import { computed } from 'vue' import { useRoute } from 'vue-router' import TempComponent from './components/TempComponent.vue' -import { theme } from './Utils' +import { isDarkMode, theme } from './Utils' import OBSLayout from './views/OBSLayout.vue' import OpenLiveLayout from './views/OpenLiveLayout.vue' +import { ThemeType } from './api/api-models'; -const route = useRoute() + const route = useRoute() + const themeType = useStorage('Settings.Theme', ThemeType.Auto) const layout = computed(() => { if (route.path.startsWith('/user') || route.name == 'user' || route.path.startsWith('/@')) { @@ -44,6 +47,16 @@ const layout = computed(() => { return '' } }) +watchEffect(() => { + if (isDarkMode.value) { + document.documentElement.classList.add('dark'); + console.log('Added dark class to HTML'); // For debugging + } else { + document.documentElement.classList.remove('dark'); + console.log('Removed dark class from HTML'); // For debugging + } + // If you dynamically apply Naive UI theme to body or provider, do it here too +}); const themeOverrides = { common: { @@ -52,34 +65,51 @@ const themeOverrides = { 'Inter ,"Noto Sans SC",-apple-system,blinkmacsystemfont,"Segoe UI",roboto,"Helvetica Neue",arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"!important', }, // ... -} + } + +onMounted(() => { + if (isDarkMode.value) { + document.documentElement.classList.add('dark'); + console.log('Added dark class to HTML'); // For debugging + } +})