Add light theme

This commit is contained in:
Thomas Nordquist
2019-04-03 06:09:34 +02:00
parent acbaced1ec
commit 6853066a19
18 changed files with 166 additions and 93 deletions

View File

@@ -68,6 +68,7 @@ export const settingsReducer = createReducer(initialState, {
export interface SetTheme {
type: ActionTypes.SETTINGS_SET_THEME_LIGHT | ActionTypes.SETTINGS_SET_THEME_DARK
theme: 'light'
}
export interface DidLoadSettings {

View File

@@ -10,8 +10,7 @@ export enum ActionTypes {
showUpdateNotification = 'SHOW_UPDATE_NOTIFICATION',
showUpdateDetails = 'SHOW_UPDATE_DETAILS',
showError = 'SHOW_ERROR',
setDarkTheme = 'GLOBAL_SET_DARK_THEME',
setLightTheme = 'GLOBAL_SET_LIGHT_THEME',
didLaunch = 'DID_LAUNCH',
}
export interface CustomAction extends Action {
@@ -34,10 +33,12 @@ export interface GlobalState {
showUpdateNotification?: boolean
showUpdateDetails: boolean
error?: string
launching: boolean
}
const initialGlobalState: GlobalState = {
showUpdateDetails: false,
launching: true,
}
const globalState: Reducer<GlobalState | undefined, CustomAction> = (state = initialGlobalState, action) => {
@@ -45,7 +46,7 @@ const globalState: Reducer<GlobalState | undefined, CustomAction> = (state = ini
throw Error('No initial state')
}
trackEvent(action.type)
console.log(action.type)
switch (action.type) {
case ActionTypes.showUpdateNotification:
return {
@@ -59,6 +60,12 @@ const globalState: Reducer<GlobalState | undefined, CustomAction> = (state = ini
error: action.error,
}
case ActionTypes.didLaunch:
return {
...state,
launching: false,
}
case ActionTypes.showUpdateDetails:
if (action.showUpdateDetails === undefined) {
return state