Migrate to Turborepo (#1251)

This commit is contained in:
Evan Song
2024-07-04 21:46:29 -07:00
committed by GitHub
parent 6fa1acc461
commit 0f2ddb452c
811 changed files with 5623 additions and 7832 deletions

View File

@@ -0,0 +1,27 @@
export default defineNuxtPlugin(async (nuxtApp) => {
await useAuth()
await useUser()
const themeStore = useTheme()
const cosmetics = useCosmetics()
nuxtApp.hook('app:mounted', () => {
if (process.client && themeStore.value.preference === 'system') {
const colorSchemeQueryList = window.matchMedia('(prefers-color-scheme: light)')
const setColorScheme = (e) => {
if (themeStore.value.preference === 'system') {
if (e.matches) {
updateTheme('light')
} else {
updateTheme(cosmetics.value.preferredDarkTheme ?? 'dark')
}
}
}
setColorScheme(colorSchemeQueryList)
colorSchemeQueryList.addEventListener('change', setColorScheme)
}
})
nuxtApp.provide('colorMode', themeStore.value)
})