2023-01-06 17:39:37 +00:00
|
|
|
import type { FeatureFlags } from './featureFlags'
|
2023-01-10 14:45:17 +00:00
|
|
|
import type { WellnessSettings } from './wellness'
|
2023-01-06 17:39:37 +00:00
|
|
|
import type { ColorMode, FontSize } from '~/types'
|
|
|
|
import { STORAGE_KEY_SETTINGS } from '~/constants'
|
|
|
|
|
|
|
|
export interface UserSettings {
|
|
|
|
featureFlags: Partial<FeatureFlags>
|
2023-01-10 14:45:17 +00:00
|
|
|
wellnessSettings: Partial<WellnessSettings>
|
2023-01-06 17:39:37 +00:00
|
|
|
colorMode?: ColorMode
|
|
|
|
fontSize?: FontSize
|
|
|
|
lang?: string
|
|
|
|
zenMode?: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getDefaultUserSettings(): UserSettings {
|
|
|
|
return {
|
|
|
|
featureFlags: {},
|
2023-01-10 14:45:17 +00:00
|
|
|
wellnessSettings: {},
|
2023-01-06 17:39:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const userSettings = process.server
|
|
|
|
? computed(getDefaultUserSettings)
|
|
|
|
: useUserLocalStorage(STORAGE_KEY_SETTINGS, getDefaultUserSettings)
|