From 05cafa96eea1840c14bed54f5a726e2c79d48a98 Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Sun, 18 Dec 2022 20:06:10 -0500 Subject: [PATCH] strengthened type checking in various new components Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- src/store/side-panel/side-panel-reducer.tsx | 6 ++- src/views/main-panel/main-panel-root.tsx | 56 +++++++++++---------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/store/side-panel/side-panel-reducer.tsx b/src/store/side-panel/side-panel-reducer.tsx index c37d7e51..a6ed03b6 100644 --- a/src/store/side-panel/side-panel-reducer.tsx +++ b/src/store/side-panel/side-panel-reducer.tsx @@ -4,11 +4,15 @@ import { sidePanelActions } from "./side-panel-action" +interface SidePanelState { + collapsedState: boolean +} + const sidePanelInitialState = { collapsedState: false } -export const sidePanelReducer = (state = sidePanelInitialState, action)=>{ +export const sidePanelReducer = (state: SidePanelState = sidePanelInitialState, action)=>{ if(action.type === sidePanelActions.TOGGLE_COLLAPSE) return {...state, collapsedState: action.payload} return state } \ No newline at end of file diff --git a/src/views/main-panel/main-panel-root.tsx b/src/views/main-panel/main-panel-root.tsx index ea3ad41c..543e9c63 100644 --- a/src/views/main-panel/main-panel-root.tsx +++ b/src/views/main-panel/main-panel-root.tsx @@ -35,34 +35,38 @@ export interface MainPanelRootDataProps { sidePanelIsCollapsed: boolean; } -type MainPanelRootProps = MainPanelRootDataProps & WithStyles; +interface MainPanelRootDispatchProps { + toggleSidePanel: () => void +} + +type MainPanelRootProps = MainPanelRootDataProps & MainPanelRootDispatchProps & WithStyles; export const MainPanelRoot = withStyles(styles)( - (props: MainPanelRootProps | any) =>{ - const{ classes, loading, working, user, buildInfo, uuidPrefix, - isNotLinking, isLinkingPath, siteBanner, sessionIdleTimeout, sidePanelIsCollapsed } = props - return loading + ({ classes, loading, working, user, buildInfo, uuidPrefix, + isNotLinking, isLinkingPath, siteBanner, sessionIdleTimeout, + sidePanelIsCollapsed, toggleSidePanel }: MainPanelRootProps) =>{ + return loading ? : <> - {isNotLinking && - {working - ? - : null} - } - - {user - ? (user.isActive || (!user.isActive && isLinkingPath) - ? - : ) - : } - - -} + {isNotLinking && + {working + ? + : null} + } + + {user + ? (user.isActive || (!user.isActive && isLinkingPath) + ? + : ) + : } + + + } ); -- 2.30.2