X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ff74ff70ced6e15e0c70735bbd54ca7acadb6185..4d73bcbaa792da5854f4d266dd7be32fc99e3289:/src/views-components/main-content-bar/main-content-bar.tsx?ds=sidebyside 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 ae86fe52..b38f85b5 100644 --- a/src/views-components/main-content-bar/main-content-bar.tsx +++ b/src/views-components/main-content-bar/main-content-bar.tsx @@ -8,25 +8,43 @@ 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'; +import { matchVirtualMachineRoute } from '~/routes/routes'; interface MainContentBarProps { onDetailsPanelToggle: () => void; + buttonVisible: boolean; } -export const MainContentBar = connect(undefined, { - onDetailsPanelToggle: detailsPanelActions.TOGGLE_DETAILS_PANEL -})((props: MainContentBarProps) => - - - - - - - - - - - +const isWorkflowPath = ({ router }: RootState) => { + const pathname = router.location ? router.location.pathname : ''; + const match = matchWorkflowRoute(pathname); + return !!match; +}; + +const isVirtualMachinePath = ({ router }: RootState) => { + const pathname = router.location ? router.location.pathname : ''; + const match = matchVirtualMachineRoute(pathname); + return !!match; +}; + +export const MainContentBar = connect((state: RootState) => ({ + buttonVisible: !isWorkflowPath(state) && !isVirtualMachinePath(state) +}), { + onDetailsPanelToggle: detailsPanelActions.TOGGLE_DETAILS_PANEL + })((props: MainContentBarProps) => + + + + + + + {props.buttonVisible && + + + + } + - - ); + );