mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Updated theme check.
This commit is contained in:
parent
c69a703c7f
commit
902d4c83ba
2 changed files with 11 additions and 9 deletions
|
|
@ -9,9 +9,17 @@ import {
|
|||
} from 'lib/constants';
|
||||
import { getItem } from 'next-basics';
|
||||
|
||||
function getDefaultTheme() {
|
||||
return typeof window !== 'undefined'
|
||||
? window?.matchMedia('(prefers-color-scheme: dark)')?.matches
|
||||
? 'dark'
|
||||
: 'light'
|
||||
: 'light';
|
||||
}
|
||||
|
||||
const initialState = {
|
||||
locale: getItem(LOCALE_CONFIG) || DEFAULT_LOCALE,
|
||||
theme: getItem(THEME_CONFIG) || DEFAULT_THEME,
|
||||
theme: getItem(THEME_CONFIG) || getDefaultTheme() || DEFAULT_THEME,
|
||||
dateRange: getItem(DATE_RANGE_CONFIG) || DEFAULT_DATE_RANGE,
|
||||
shareToken: null,
|
||||
user: null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue