- Data table sticky header.

- Mini sidebar toggle.
- Refactor withDashboard and withDashboardActions.
This commit is contained in:
Ahmed Bouhuolia
2020-05-31 15:57:02 +02:00
parent c1659d191f
commit 2a466ce2da
49 changed files with 1045 additions and 669 deletions

View File

@@ -3,10 +3,12 @@ import thunkMiddleware from 'redux-thunk';
import monitorReducerEnhancer from 'store/enhancers/monitorReducer';
import loggerMiddleware from 'middleware/logger'
import rootReducer from 'store/reducers';
import { loadState, saveState } from 'store/localStorage';
import persistState from 'redux-localstorage'
const persistPaths = ['dashboard', 'authentication'];
const createStore = (initialState = {
...loadState(),
// ...loadState(),
}) => {
/**
|--------------------------------------------------
@@ -25,6 +27,7 @@ const createStore = (initialState = {
*/
const enhancers = [
monitorReducerEnhancer,
persistState(persistPaths, { key: 'bigcapital' }),
];
let composeEnhancers = compose;
@@ -45,12 +48,6 @@ const createStore = (initialState = {
composeEnhancers(applyMiddleware(...middleware), ...enhancers)
);
store.asyncReducers = {};
store.subscribe(() => {
saveState({
authentication: store.getState().authentication,
});
});
return store;
};
export default createStore();

View File

@@ -5,6 +5,7 @@ const initialState = {
pageTitle: '',
pageSubtitle: 'Hello World',
preferencesPageTitle: '',
sidebarExpended: true,
dialogs: {},
topbarEditViewId: null,
requestsLoading: 0,
@@ -52,6 +53,10 @@ export default createReducer(initialState, {
[t.SET_DASHBOARD_REQUEST_COMPLETED]: (state, action) => {
const requestsLoading = state.requestsLoading - 1;
state.requestsLoading = Math.max(requestsLoading, 0);
},
[t.SIDEBAR_EXPEND_TOGGLE]: (state) => {
state.sidebarExpended = !state.sidebarExpended;
}
});

View File

@@ -11,4 +11,5 @@ export default {
SET_TOPBAR_EDIT_VIEW: 'SET_TOPBAR_EDIT_VIEW',
SET_DASHBOARD_REQUEST_LOADING: 'SET_DASHBOARD_REQUEST_LOADING',
SET_DASHBOARD_REQUEST_COMPLETED: 'SET_DASHBOARD_REQUEST_COMPLETED',
SIDEBAR_EXPEND_TOGGLE: 'SIDEBAR_EXPEND_TOGGLE',
};

View File

@@ -36,5 +36,4 @@ export default {
...search,
...register,
...exchangeRate,
};