add closeall action
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2020-06-26 08:22:31 +02:00
parent 31c1570ffb
commit 69f8184dfe
2 changed files with 14 additions and 3 deletions

View File

@ -20,6 +20,7 @@ export const CLOSEMODAL = '[AppCommon] CloseModal';
export const LOGIN = '[AppCommon] Login';
export const LOGOUT = '[AppCommon] Logout';
export const ESCAPE = '[AppCommon] Escape';
export const CLOSEALL = '[AppCommon] CloseAll';
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
export const LOADITEMTYPESSUCCESS = '[AppCommon] LoadItemTypesSuccess';
@ -99,6 +100,12 @@ export class CloseModal implements Action {
constructor() { }
}
export class CloseAll implements Action {
readonly type = CLOSEALL;
constructor() { }
}
export class StartRouteLoading implements Action {
readonly type = STARTROUTELOADING;
@ -279,6 +286,7 @@ export type Actions = OpenModal
| ToggleMenu
| SetMenuVisible
| InitUserPackagesSuccess
| ToggleAccountMenu;
| ToggleAccountMenu
| CloseAll;

View File

@ -85,7 +85,7 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
});
}
case appCommonActions.TOGGLEMENU: {
return tassign(state, { menuVisible: !state.menuVisible });
return tassign(state, { menuVisible: !state.menuVisible,accountMenuVisible:!state.menuVisible?false:state.accountMenuVisible });
}
case appCommonActions.TOGGLEACCOUNTMENU: {
return tassign(state, { accountMenuVisible: !state.accountMenuVisible });
@ -95,7 +95,7 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
}
case appCommonActions.SETMENUVISIBLE: {
let a = action as appCommonActions.SetMenuVisible;
return tassign(state, { menuVisible: a.visible });
return tassign(state, { menuVisible: a.visible,accountMenuVisible:a.visible?false:state.accountMenuVisible });
}
case appCommonActions.INITUSERPACKAGESSUCCESS:{
let a = action as appCommonActions.InitUserPackagesSuccess;
@ -109,6 +109,9 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
case appCommonActions.LOGOUT:{
return tassign(state,{user:null,initialized:false});
}
case appCommonActions.CLOSEALL: {
return tassign(state,{accountMenuVisible:false,menuVisible:false });
}
default: {
return state;
}