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 { connect } from 'react-redux';
10 import { RootState } from '~/store/store';
11 import { matchWorkflowRoute, matchRepositoriesRoute } from '~/routes/routes';
12 import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
14 interface MainContentBarProps {
15 onDetailsPanelToggle: () => void;
16 buttonVisible: boolean;
19 const isWorkflowPath = ({ router }: RootState) => {
20 const pathname = router.location ? router.location.pathname : '';
21 const match = matchWorkflowRoute(pathname);
25 const isRepositoriesPath = ({ router }: RootState) => {
26 const pathname = router.location ? router.location.pathname : '';
27 const match = matchRepositoriesRoute(pathname);
31 export const MainContentBar = connect((state: RootState) => ({
32 buttonVisible: !isWorkflowPath(state) && !isRepositoriesPath(state)
34 onDetailsPanelToggle: toggleDetailsPanel
35 })((props: MainContentBarProps) =>
38 <Grid container item xs alignItems="center">
42 {props.buttonVisible && <Tooltip title="Additional Info">
43 <IconButton color="inherit" onClick={props.onDetailsPanelToggle}>