1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { Toolbar, IconButton, Tooltip, Grid } from "@material-ui/core";
7 import { DetailsIcon } from "~/components/icon/icon";
8 import { Breadcrumbs } from "~/views-components/breadcrumbs/breadcrumbs";
9 import { detailsPanelActions } from "~/store/details-panel/details-panel-action";
10 import { connect } from 'react-redux';
11 import { RootState } from '~/store/store';
12 import { matchWorkflowRoute } from '~/routes/routes';
13 import { matchVirtualMachineRoute } from '~/routes/routes';
15 interface MainContentBarProps {
16 onDetailsPanelToggle: () => void;
17 buttonVisible: boolean;
20 const isWorkflowPath = ({ router }: RootState) => {
21 const pathname = router.location ? router.location.pathname : '';
22 const match = matchWorkflowRoute(pathname);
26 const isVirtualMachinePath = ({ router }: RootState) => {
27 const pathname = router.location ? router.location.pathname : '';
28 const match = matchVirtualMachineRoute(pathname);
32 export const MainContentBar = connect((state: RootState) => ({
33 buttonVisible: !isWorkflowPath(state) && !isVirtualMachinePath(state)
35 onDetailsPanelToggle: detailsPanelActions.TOGGLE_DETAILS_PANEL
36 })((props: MainContentBarProps) =>
39 <Grid container item xs alignItems="center">
43 {props.buttonVisible && <Tooltip title="Additional Info">
44 <IconButton color="inherit" onClick={props.onDetailsPanelToggle}>