Feature(map): Add top level collapse
This commit is contained in:
@@ -42,6 +42,29 @@ export const updateFilter = createAction(
|
||||
e => e.target.value
|
||||
);
|
||||
|
||||
function createMapKey(map, key) {
|
||||
map[key] = true;
|
||||
return map;
|
||||
}
|
||||
export const initMap = createAction(
|
||||
types.initMap,
|
||||
(
|
||||
{ superBlock: superBlockMap },
|
||||
superBlocks
|
||||
) => {
|
||||
if (!superBlocks || !superBlockMap) {
|
||||
return {};
|
||||
}
|
||||
const blocks = superBlocks
|
||||
.map(superBlock => superBlockMap[superBlock].blocks)
|
||||
.reduce((blocks, block) => blocks.concat(block));
|
||||
return superBlocks
|
||||
.concat(blocks)
|
||||
.reduce(createMapKey, {});
|
||||
}
|
||||
);
|
||||
export const toggleThisPanel = createAction(types.toggleThisPanel);
|
||||
|
||||
export const clearFilter = createAction(types.clearFilter);
|
||||
|
||||
// files
|
||||
|
Reference in New Issue
Block a user