PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / 1.4.1
Starter Sites & Templates by Neve v1.4.1
1.4.1 1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / assets / src / store / reducer.js
templates-patterns-collection / assets / src / store Last commit date
actions.js 3 years ago reducer.js 2 years ago selectors.js 3 years ago
reducer.js
135 lines
1 /* global tiobDash */
2 const { onboarding, themeAction, licenseTIOB } = tiobDash;
3
4 const firstEditor =
5 'undefined' !== typeof onboarding.sites &&
6 'undefined' !== typeof onboarding.sites.sites
7 ? Object.keys( onboarding.sites.sites )[ 0 ]
8 : 'gutenberg';
9 const selectedEditor =
10 localStorage.getItem( 'neve-onboarding-editor' ) || firstEditor;
11
12 const initialLicense = licenseTIOB || {
13 key: 'free',
14 valid: 'invalid',
15 expiration: '',
16 tier: 0,
17 };
18
19 const initialState = {
20 sites: onboarding.sites || {},
21 editor: selectedEditor,
22 category: 'all',
23 previewStatus: false,
24 importModalStatus: false,
25 installModalStatus: false,
26 currentSite: null,
27 importing: false,
28 isOnboarding: onboarding.onboarding || false,
29 migrationData: null,
30 themeAction,
31 currentTab: tiobDash.hideStarterSites ? ( tiobDash.hideMyLibrary ? 'settings' : 'library' ) : 'starterSites',
32 fetching: false,
33 singleTemplateImport: null,
34 templateModal: null,
35 searchQuery: '',
36 license: initialLicense,
37 };
38 export default ( state = initialState, action ) => {
39 switch ( action.type ) {
40 case 'REFRESH_SITES':
41 const { sites } = action.payload;
42 return {
43 ...state,
44 sites,
45 };
46 case 'SET_CURRENT_EDITOR':
47 const { editor } = action.payload;
48 localStorage.setItem( 'neve-onboarding-editor', editor );
49 return {
50 ...state,
51 editor,
52 };
53 case 'SET_CURRENT_CATEGORY':
54 const { category } = action.payload;
55 return {
56 ...state,
57 category,
58 };
59 case 'SET_FOCUSED_SITE':
60 const { siteData } = action.payload;
61 return {
62 ...state,
63 currentSite: siteData,
64 };
65 case 'SET_PREVIEW_STATUS':
66 const { previewStatus } = action.payload;
67 return {
68 ...state,
69 previewStatus,
70 };
71 case 'SET_IMPORT_MODAL_STATUS':
72 const { importModalStatus } = action.payload;
73 return {
74 ...state,
75 importModalStatus,
76 };
77 case 'SET_INSTALL_MODAL_STATUS':
78 const { installModalStatus } = action.payload;
79 return {
80 ...state,
81 installModalStatus,
82 };
83 case 'SET_ONBOARDING':
84 const { status } = action.payload;
85 return {
86 ...state,
87 isOnboarding: status,
88 };
89 case 'SET_THEME_ACTIONS':
90 const { themeActions } = action.payload;
91 return {
92 ...state,
93 themeAction: themeActions,
94 };
95 case 'SET_CURRENT_TAB':
96 const { currentTab } = action.payload;
97 return {
98 ...state,
99 singleTemplateImport: null,
100 currentTab,
101 };
102 case 'SET_FETCHING':
103 const { fetching } = action.payload;
104 return {
105 ...state,
106 fetching,
107 };
108 case 'SET_SINGLE_TEMPLATE_IMPORT':
109 const { slug } = action.payload;
110 return {
111 ...state,
112 singleTemplateImport: slug,
113 };
114 case 'SET_TEMPLATE_MODAL':
115 const { data } = action.payload;
116 return {
117 ...state,
118 templateModal: data,
119 };
120 case 'SET_SEARCH_QUERY':
121 const { query } = action.payload;
122 return {
123 ...state,
124 searchQuery: query,
125 };
126 case 'SET_LICENSE':
127 const { license } = action.payload;
128 return {
129 ...state,
130 license,
131 };
132 }
133 return state;
134 };
135