X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/bae676cf6c9130ec6ef9708b86343024d11034b2..eda5e30d786d5d1224a552e962b6b711efab7369:/src/views-components/main-content-bar/main-content-bar.tsx diff --git a/src/views-components/main-content-bar/main-content-bar.tsx b/src/views-components/main-content-bar/main-content-bar.tsx index 7506974f..41442bba 100644 --- a/src/views-components/main-content-bar/main-content-bar.tsx +++ b/src/views-components/main-content-bar/main-content-bar.tsx @@ -8,21 +8,36 @@ import { DetailsIcon } from "~/components/icon/icon"; import { Breadcrumbs } from "~/views-components/breadcrumbs/breadcrumbs"; import { detailsPanelActions } from "~/store/details-panel/details-panel-action"; import { connect } from 'react-redux'; +import { RootState } from '~/store/store'; +import { matchWorkflowRoute } from '~/routes/routes'; interface MainContentBarProps { onDetailsPanelToggle: () => void; + buttonVisible: boolean; } -export const MainContentBar = connect(undefined, { - onDetailsPanelToggle: detailsPanelActions.TOGGLE_DETAILS_PANEL -})((props: MainContentBarProps) => - - - - - - - - - - ); +const isButtonVisible = ({ router }: RootState) => { + const pathname = router.location ? router.location.pathname : ''; + const match = !matchWorkflowRoute(pathname); + return !!match; +}; + +export const MainContentBar = connect((state: RootState) => ({ + buttonVisible: isButtonVisible(state) +}), { + onDetailsPanelToggle: detailsPanelActions.TOGGLE_DETAILS_PANEL + })((props: MainContentBarProps) => + + + + + + + {props.buttonVisible ? + + + + : null} + + + );