fix: rework setup to improve SSR compatibility

This commit is contained in:
Anthony Fu 2022-12-28 02:06:54 +01:00
parent fd7d30a38a
commit d8d163dbd0
22 changed files with 137 additions and 73 deletions

View file

@ -206,6 +206,7 @@ export const provideGlobalCommands = () => {
const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> }
const users = useUsers()
const masto = useMasto()
const colorMode = useColorModeRef()
useCommand({
scope: 'Actions',
@ -225,10 +226,10 @@ export const provideGlobalCommands = () => {
scope: 'Preferences',
name: () => t('command.toggle_dark_mode'),
icon: () => isDark.value ? 'i-ri:sun-line' : 'i-ri:moon-line',
icon: () => colorMode.value === 'light' ? 'i-ri:sun-line' : 'i-ri:moon-line',
onActivate() {
toggleDark()
colorMode.value = colorMode.value === 'light' ? 'dark' : 'light'
},
})