From 75cd82c07ae6a9b4c7cbc98224aaa64785138865 Mon Sep 17 00:00:00 2001 From: Julian Wielga Date: Mon, 2 Sep 2024 20:55:23 +0200 Subject: [PATCH] collapsed panels fixed --- designer/client/src/reducers/panel.ts | 6 +++--- designer/client/src/reducers/selectors/panel.ts | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/designer/client/src/reducers/panel.ts b/designer/client/src/reducers/panel.ts index dc6423d3e53..3c7ac911258 100644 --- a/designer/client/src/reducers/panel.ts +++ b/designer/client/src/reducers/panel.ts @@ -1,9 +1,9 @@ -import { Reducer } from "../actions/reduxTypes"; import { PanelSide } from "../actions/nk"; +import { Reducer } from "../actions/reduxTypes"; export type Panels = Record; -const defaultState: Panels = { +export const defaultState: Panels = { LEFT: true, RIGHT: true, }; @@ -13,7 +13,7 @@ export const panels: Reducer = (state = defaultState, action) => { case "TOGGLE_PANEL": return { ...state, - [action.side]: !state[action.side], + [action.side]: state[action.side] == false, }; case "RESET_TOOLBARS": diff --git a/designer/client/src/reducers/selectors/panel.ts b/designer/client/src/reducers/selectors/panel.ts index 9c4a3e12303..538bca6f16d 100644 --- a/designer/client/src/reducers/selectors/panel.ts +++ b/designer/client/src/reducers/selectors/panel.ts @@ -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 }));