Skip to content

Commit

Permalink
collapsed panels fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianWielga committed Sep 6, 2024
1 parent 65a178a commit 61eb6a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 3 additions & 3 deletions designer/client/src/reducers/panel.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Reducer } from "../actions/reduxTypes";
import { PanelSide } from "../actions/nk";
import { Reducer } from "../actions/reduxTypes";

export type Panels = Record<PanelSide, boolean>;

const defaultState: Panels = {
export const defaultState: Panels = {
LEFT: true,
RIGHT: true,
};
Expand All @@ -13,7 +13,7 @@ export const panels: Reducer<Panels> = (state = defaultState, action) => {
case "TOGGLE_PANEL":
return {
...state,
[action.side]: !state[action.side],
[action.side]: state[action.side] == false,
};

case "RESET_TOOLBARS":
Expand Down
7 changes: 2 additions & 5 deletions designer/client/src/reducers/selectors/panel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { createSelector } from "reselect";
import { defaultState } from "../panel";
import { getToolbars } from "./toolbars";
import { Panels } from "../panel";

export const panelsState = createSelector(getToolbars, (t) => t.panels || ({} as Panels));

export const isLeftPanelOpened = createSelector(panelsState, (panels) => panels?.LEFT);
export const isRightPanelOpened = createSelector(panelsState, (panels) => panels?.RIGHT);
export const panelsState = createSelector(getToolbars, (t) => ({ ...defaultState, ...t.panels }));

0 comments on commit 61eb6a4

Please sign in to comment.