More refactoring, add thematic maps button

This commit is contained in:
Willem Dantuma
2020-04-22 08:11:50 +02:00
parent ef81b04f4e
commit 69751540d3
4 changed files with 34 additions and 16 deletions

View File

@@ -57,7 +57,8 @@ export interface State {
styles:IStyles,
showLayerSwitcher:boolean,
setStateCount:number,
inSearch:boolean
inSearch:boolean,
replaceUrl:boolean
}
export const initialState: State = {
@@ -94,7 +95,8 @@ export const initialState: State = {
styles: {},
showLayerSwitcher: false,
setStateCount: 0,
inSearch:false
inSearch:false,
replaceUrl:true
}
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
@@ -111,7 +113,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
case mapActions.SETQUERYSTATE: {
let a = action as mapActions.SetQueryState;
return tassign(state, { queryState: tassign(a.queryState ),setStateCount: state.setStateCount+1});
return tassign(state, { queryState: tassign(a.queryState ),setStateCount: state.setStateCount+1,replaceUrl:a.replaceUrl});
}
case mapActions.SETSTATE: {
let a = action as mapActions.SetState;
@@ -457,6 +459,10 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
let a = action as mapActions.ShowLayerSwitcher;
return tassign(state,{showLayerSwitcher:a.show});
}
case mapActions.SETREPLACEURL: {
let a= action as mapActions.SetReplaceUrl;
return tassign(state,{replaceUrl:a.replaceUrl});
}
default: {
return state;
}
@@ -487,7 +493,7 @@ export const getStyles = (state:State) => state.styles;
export const getShowLayerSwitcher = (state:State) => state.showLayerSwitcher;
export const getSetStateCount = (state:State) => state.setStateCount;
export const getInSearch = (state:State) => state.inSearch;
export const getState = (state:State) => {return {mapState:state.mapState,queryState:state.queryState,setStateCount:state.setStateCount};}
export const getState = (state:State) => {return {mapState:state.mapState,queryState:state.queryState,setStateCount:state.setStateCount,replaceUrl:state.replaceUrl};}
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
export const selectGetMapState= createSelector(selectMapState, getMapState);