mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
WIP
This commit is contained in:
17
client/src/store/dashboard/dashboard.actions.js
Normal file
17
client/src/store/dashboard/dashboard.actions.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import t from 'store/types';
|
||||
|
||||
export function openDialog(name, payload) {
|
||||
return {
|
||||
type: t.OPEN_DIALOG,
|
||||
name: name,
|
||||
payload: payload,
|
||||
};
|
||||
};
|
||||
|
||||
export function closeDialog(name, payload) {
|
||||
return {
|
||||
type: t.CLOSE_DIALOG,
|
||||
name: name,
|
||||
payload: payload,
|
||||
}
|
||||
}
|
||||
55
client/src/store/dashboard/dashboard.reducer.js
Normal file
55
client/src/store/dashboard/dashboard.reducer.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import t from 'store/types';
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = {
|
||||
pageTitle: '',
|
||||
pageSubtitle: 'Hello World',
|
||||
preferencesPageTitle: '',
|
||||
dialogs: {},
|
||||
topbarEditViewId: 1,
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.CHANGE_DASHBOARD_PAGE_TITLE]: (state, action) => {
|
||||
state.pageTitle = action.pageTitle;
|
||||
},
|
||||
|
||||
[t.ALTER_DASHBOARD_PAGE_SUBTITLE]: (state, action) => {
|
||||
state.pageSubtitle = action.pageSubtitle;
|
||||
},
|
||||
|
||||
[t.CHANGE_PREFERENCES_PAGE_TITLE]: (state, action) => {
|
||||
state.preferencesPageTitle = action.pageTitle;
|
||||
},
|
||||
|
||||
[t.OPEN_DIALOG]: (state, action) => {
|
||||
state.dialogs[action.name] = {
|
||||
isOpen: true,
|
||||
payload: action.payload || {},
|
||||
};
|
||||
},
|
||||
|
||||
[t.CLOSE_DIALOG]: (state, action) => {
|
||||
state.dialogs[action.name] = {
|
||||
...state.dialogs[action.name],
|
||||
isOpen: false,
|
||||
};
|
||||
},
|
||||
|
||||
[t.CLOSE_ALL_DIALOGS]: (state, action) => {
|
||||
|
||||
},
|
||||
|
||||
[t.SET_TOPBAR_EDIT_VIEW]: (state, action) => {
|
||||
state.topbarEditViewId = action.id;
|
||||
}
|
||||
});
|
||||
|
||||
export const getDialogPayload = (state, dialogName) => {
|
||||
return typeof state.dashboard.dialogs[dialogName] !== 'undefined'
|
||||
? state.dashboard.dialogs[dialogName].payload : {};
|
||||
};
|
||||
|
||||
export const getDialogActiveStatus = (state, dialogName) => {
|
||||
return true;
|
||||
};
|
||||
12
client/src/store/dashboard/dashboard.types.js
Normal file
12
client/src/store/dashboard/dashboard.types.js
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
OPEN_DIALOG: 'OPEN_DIALOG',
|
||||
CLOSE_DIALOG: 'CLOSE_DIALOG',
|
||||
CLOSE_ALL_DIALOGS: 'CLOSE_ALL_DIALOGS',
|
||||
CHANGE_DASHBOARD_PAGE_TITLE: 'CHANGE_DASHBOARD_PAGE_TITLE',
|
||||
CHANGE_PREFERENCES_PAGE_TITLE: 'CHANGE_PREFERENCES_PAGE_TITLE',
|
||||
ALTER_DASHBOARD_PAGE_SUBTITLE: 'ALTER_DASHBOARD_PAGE_SUBTITLE',
|
||||
SET_TOPBAR_EDIT_VIEW: 'SET_TOPBAR_EDIT_VIEW',
|
||||
};
|
||||
Reference in New Issue
Block a user