1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Added font size settings

This commit is contained in:
Zhiyuan Zheng
2021-03-10 10:22:53 +01:00
parent 7d797bb401
commit 5281de63a6
20 changed files with 362 additions and 71 deletions

View File

@ -18,6 +18,7 @@ export const changeAnalytics = createAsyncThunk(
)
export type SettingsState = {
fontsize: -1 | 0 | 1 | 2 | 3
language: keyof availableLanguages
theme: 'light' | 'dark' | 'auto'
browser: 'internal' | 'external'
@ -25,6 +26,7 @@ export type SettingsState = {
}
export const settingsInitialState = {
fontsize: 0,
notification: {
enabled: false
},
@ -46,6 +48,12 @@ const settingsSlice = createSlice({
name: 'settings',
initialState: settingsInitialState as SettingsState,
reducers: {
changeFontsize: (
state,
action: PayloadAction<SettingsState['fontsize']>
) => {
state.fontsize = action.payload
},
changeLanguage: (
state,
action: PayloadAction<NonNullable<SettingsState['language']>>
@ -72,6 +80,8 @@ const settingsSlice = createSlice({
}
})
export const getSettingsFontsize = (state: RootState) =>
state.settings.fontsize || 0
export const getSettingsLanguage = (state: RootState) => state.settings.language
export const getSettingsTheme = (state: RootState) => state.settings.theme
export const getSettingsBrowser = (state: RootState) => state.settings.browser
@ -79,6 +89,7 @@ export const getSettingsAnalytics = (state: RootState) =>
state.settings.analytics
export const {
changeFontsize,
changeLanguage,
changeTheme,
changeBrowser