Updated timezone hook, fixed chart rendering, added icons.

This commit is contained in:
Mike Cao 2024-03-29 16:04:39 -07:00
parent 5a2330ba2a
commit 291562f6c2
14 changed files with 94 additions and 65 deletions

View file

@ -6,8 +6,10 @@ import {
DEFAULT_THEME,
LOCALE_CONFIG,
THEME_CONFIG,
TIMEZONE_CONFIG,
} from 'lib/constants';
import { getItem } from 'next-basics';
import { getTimezone } from 'lib/date';
function getDefaultTheme() {
return typeof window !== 'undefined'
@ -20,6 +22,7 @@ function getDefaultTheme() {
const initialState = {
locale: getItem(LOCALE_CONFIG) || DEFAULT_LOCALE,
theme: getItem(THEME_CONFIG) || getDefaultTheme() || DEFAULT_THEME,
timezone: getItem(TIMEZONE_CONFIG) || getTimezone(),
dateRange: getItem(DATE_RANGE_CONFIG) || DEFAULT_DATE_RANGE,
shareToken: null,
user: null,
@ -32,6 +35,10 @@ export function setTheme(theme: string) {
store.setState({ theme });
}
export function setTimezone(timezone: string) {
store.setState({ timezone });
}
export function setLocale(locale: string) {
store.setState({ locale });
}