mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
20
src/containers/Dashboard/withDashboard.js
Normal file
20
src/containers/Dashboard/withDashboard.js
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
export default (mapState) => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
const mapped = {
|
||||
pageTitle: state.dashboard.pageTitle,
|
||||
pageSubtitle: state.dashboard.pageSubtitle,
|
||||
pageHint: state.dashboard.pageHint,
|
||||
editViewId: state.dashboard.topbarEditViewId,
|
||||
sidebarExpended: state.dashboard.sidebarExpended,
|
||||
preferencesPageTitle: state.dashboard.preferencesPageTitle,
|
||||
dashboardBackLink: state.dashboard.backLink,
|
||||
appIsLoading: state.dashboard.appIsLoading,
|
||||
appIntlIsLoading: state.dashboard.appIntlIsLoading
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
return connect(mapStateToProps);
|
||||
}
|
||||
64
src/containers/Dashboard/withDashboardActions.js
Normal file
64
src/containers/Dashboard/withDashboardActions.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
import {
|
||||
toggleExpendSidebar,
|
||||
appIsLoading,
|
||||
appIntlIsLoading
|
||||
} from 'store/dashboard/dashboard.actions';
|
||||
|
||||
const mapActionsToProps = (dispatch) => ({
|
||||
changePageTitle: (pageTitle) =>
|
||||
dispatch({
|
||||
type: t.CHANGE_DASHBOARD_PAGE_TITLE,
|
||||
pageTitle,
|
||||
}),
|
||||
|
||||
changePageSubtitle: (pageSubtitle) =>
|
||||
dispatch({
|
||||
type: t.ALTER_DASHBOARD_PAGE_SUBTITLE,
|
||||
pageSubtitle,
|
||||
}),
|
||||
|
||||
changePageHint: (pageHint) =>
|
||||
dispatch({
|
||||
type: t.CHANGE_DASHBOARD_PAGE_HINT,
|
||||
payload: { pageHint },
|
||||
}),
|
||||
|
||||
setTopbarEditView: (id) =>
|
||||
dispatch({
|
||||
type: t.SET_TOPBAR_EDIT_VIEW,
|
||||
id,
|
||||
}),
|
||||
|
||||
setDashboardRequestLoading: () =>
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||
}),
|
||||
|
||||
setDashboardRequestCompleted: () =>
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
}),
|
||||
|
||||
/**
|
||||
* Toggles the sidebar expend.
|
||||
*/
|
||||
toggleSidebarExpand: (toggle) => dispatch(toggleExpendSidebar(toggle)),
|
||||
|
||||
changePreferencesPageTitle: (pageTitle) =>
|
||||
dispatch({
|
||||
type: 'CHANGE_PREFERENCES_PAGE_TITLE',
|
||||
pageTitle,
|
||||
}),
|
||||
|
||||
setDashboardBackLink: (backLink) =>
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_BACK_LINK,
|
||||
payload: { backLink },
|
||||
}),
|
||||
setAppIsLoading: (isLoading) => dispatch(appIsLoading(isLoading)),
|
||||
setAppIntlIsLoading: (isLoading) => dispatch(appIntlIsLoading(isLoading)),
|
||||
});
|
||||
|
||||
export default connect(null, mapActionsToProps);
|
||||
Reference in New Issue
Block a user