-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReducer.js
More file actions
109 lines (104 loc) · 3.14 KB
/
Reducer.js
File metadata and controls
109 lines (104 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
export const themeHueLight = {
primary: '#FAFAFA',
primary_dark: '#E9ECEF',
primary_veryDark: '#F2F2F2',
borderColor: '#D9D9D9',
secondary: '#00D426',
localNotification: '#E9ECEF',
localNotificationBorder: '#D1D1D1'
}
export const themeHueDark = {
primary: '#111B21',
primary_dark: '#1A3848',
primary_veryDark: '#0A1014',
borderColor: '#0A1014',
secondary: '#00D426',
localNotification: '#1A3848',
localNotificationBorder: '#617986'
}
export let initialState = {
theme: 'LIGHT',
themeHue: themeHueLight,
permissionState: false,
fontFamily : 'Lobster-Regular',
loadingStateImages: true,
loadingStateVideos: true,
loadingStateVideosReel: true,
validFilePath: '',
autoSave: false,
themeModeCustom: true,
deviceColorScheme: undefined,
contentSavedTrig: false
}
export const actionTypes = {
setMutipleStates: 'SETMULTIPLESTATES',
setTheme: "SETTHEME",
setPermissionState: 'SETPERMISSIONSTATE',
setLoadingStateImages: "SETLOADING_IMAGES",
setLoadingStateVideos: "SETLOADING_VIDEOS",
setValidFilePath: 'SETVALIDFILEPATH',
setAutoSave: 'SETAUTOSAVE',
setThemeModeCustom : 'SETTHEMEMODECUSTOM',
setDeviceColorScheme: 'SETDEVICECOLORSCHEME',
setLoadingStateVideosReels: 'SETLOADINGSTATEVIDEOSREELS',
setContentSavedTrig: 'SETCONTENTSAVED'
}
const reducer = (state, action) => {
switch (action.type) {
case actionTypes.setMutipleStates:
return {
...state,
...action.multipleStates
}
// ....
case actionTypes.setTheme:
return {
...state,
theme: action.theme,
themeHue: action.theme === 'LIGHT' ? themeHueLight : themeHueDark
}
case actionTypes.setPermissionState:
return {
...state,
permissionState: action.permissionState
}
case actionTypes.setLoadingStateImages:
return {
...state,
loadingStateImages: action.loadingStateImages
}
case actionTypes.setLoadingStateVideos:
return {
...state,
loadingStateVideos: action.loadingStateVideos
}
case actionTypes.setValidFilePath:
return {
...state,
validFilePath: action.validFilePath
}
case actionTypes.setAutoSave:
return {
...state,
autoSave : action.autoSave
}
case actionTypes.setThemeModeCustom:
return {
...state,
themeModeCustom : action.themeModeCustom
}
case actionTypes.setLoadingStateVideosReels:
return {
...state,
loadingStateVideosReel : action.loadingStateVideosReel
}
case actionTypes.setContentSavedTrig:
return {
...state,
contentSavedTrig : action.contentSavedTrig
}
default:
return state;
}
};
export default reducer;