Skip to content

Commit

Permalink
collapsed panels fixed (#6728)
Browse files Browse the repository at this point in the history
* collapsed panels fixed

* Updated snapshots (#6829)

Co-authored-by: JulianWielga <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: JulianWielga <[email protected]>
  • Loading branch information
3 people authored Sep 10, 2024
1 parent f6e5bc4 commit 7e18b88
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 7e18b88

Please sign in to comment.