X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c90e813adcec89899d9db95843295a84fb058c3e..35694e6fc2214c366f09ddd75c9910d91cd3ed20:/src/views-components/main-app-bar/main-app-bar.tsx

diff --git a/src/views-components/main-app-bar/main-app-bar.tsx b/src/views-components/main-app-bar/main-app-bar.tsx
index c0525a5668..04e0fb804a 100644
--- a/src/views-components/main-app-bar/main-app-bar.tsx
+++ b/src/views-components/main-app-bar/main-app-bar.tsx
@@ -3,14 +3,24 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { AppBar, Toolbar, Typography, Grid, IconButton, Badge, StyleRulesCallback, withStyles, WithStyles, Button, MenuItem } from "@material-ui/core";
-import NotificationsIcon from "@material-ui/icons/Notifications";
-import PersonIcon from "@material-ui/icons/Person";
-import HelpIcon from "@material-ui/icons/Help";
-import SearchBar from "../../components/search-bar/search-bar";
-import Breadcrumbs, { Breadcrumb } from "../../components/breadcrumbs/breadcrumbs";
-import DropdownMenu from "../../components/dropdown-menu/dropdown-menu";
-import { User, getUserFullname } from "../../models/user";
+import { AppBar, Toolbar, Typography, Grid, IconButton, Badge, Button, MenuItem, Tooltip } from "@material-ui/core";
+import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { Link } from "react-router-dom";
+import { User, getUserFullname } from "~/models/user";
+import { SearchBar } from "~/components/search-bar/search-bar";
+import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu";
+import { DetailsIcon, NotificationIcon, UserPanelIcon, HelpIcon } from "~/components/icon/icon";
+import { Routes } from '~/routes/routes';
+
+type CssRules = 'link';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    link: {
+        textDecoration: 'none',
+        color: 'inherit'
+    }
+});
 
 export interface MainAppBarMenuItem {
     label: string;
@@ -25,74 +35,80 @@ export interface MainAppBarMenuItems {
 interface MainAppBarDataProps {
     searchText: string;
     searchDebounce?: number;
-    breadcrumbs: Breadcrumb[];
+    breadcrumbs: React.ComponentType<any>;
     user?: User;
     menuItems: MainAppBarMenuItems;
+    buildInfo: string;
 }
 
 export interface MainAppBarActionProps {
     onSearch: (searchText: string) => void;
-    onBreadcrumbClick: (breadcrumb: Breadcrumb) => void;
     onMenuItemClick: (menuItem: MainAppBarMenuItem) => void;
+    onDetailsPanelToggle: () => void;
 }
 
-type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles<CssRules>;
+export type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles<CssRules>;
 
-export const MainAppBar: React.SFC<MainAppBarProps> = (props) => {
-    return <AppBar className={props.classes.appBar} position="static">
-        <Toolbar className={props.classes.toolbar}>
-            <Grid
-                container
-                justify="space-between"
-            >
-                <Grid item xs={3}>
-                    <Typography variant="headline" color="inherit" noWrap>
-                        Arvados
-                    </Typography>
-                    <Typography variant="body1" color="inherit" noWrap >
-                        Workbench 2
-                    </Typography>
+export const MainAppBar = withStyles(styles)(
+    (props: MainAppBarProps) => {
+        return <AppBar position="static">
+            <Toolbar>
+                <Grid container justify="space-between">
+                    <Grid item xs={3}>
+                        <Typography variant="headline" color="inherit" noWrap>
+                            <Link to={Routes.ROOT} className={props.classes.link}>
+                                Arvados 2
+                            </Link>
+                        </Typography>
+                        <Typography variant="body1" color="inherit" noWrap >
+                            {props.buildInfo}
+                        </Typography>
+                    </Grid>
+                    <Grid item xs={6} container alignItems="center">
+                        {
+                            props.user && <SearchBar
+                                value={props.searchText}
+                                onSearch={props.onSearch}
+                                debounce={props.searchDebounce}
+                            />
+                        }
+                    </Grid>
+                    <Grid item xs={3} container alignItems="center" justify="flex-end">
+                        {
+                            props.user ? renderMenuForUser(props) : renderMenuForAnonymous(props)
+                        }
+                    </Grid>
                 </Grid>
-                <Grid item xs={6} container alignItems="center">
-                    {
-                        props.user && <SearchBar
-                            value={props.searchText}
-                            onSearch={props.onSearch}
-                            debounce={props.searchDebounce}
-                        />
-                    }
-                </Grid>
-                <Grid item xs={3} container alignItems="center" justify="flex-end">
-                    {
-                        props.user ? renderMenuForUser(props) : renderMenuForAnonymous(props)
-                    }
-                </Grid>
-            </Grid>
-        </Toolbar>
-        {
-            props.user && <Toolbar className={props.classes.toolbar}>
-                <Breadcrumbs items={props.breadcrumbs} onClick={props.onBreadcrumbClick} />
             </Toolbar>
-        }
-    </AppBar>;
-};
-
+            <Toolbar >
+                {props.user && <props.breadcrumbs />}
+                {props.user && <IconButton color="inherit" onClick={props.onDetailsPanelToggle}>
+                    <Tooltip title="Additional Info">
+                        <DetailsIcon />
+                    </Tooltip>
+                </IconButton>}
+            </Toolbar>
+        </AppBar>;
+    }
+);
 
 const renderMenuForUser = ({ user, menuItems, onMenuItemClick }: MainAppBarProps) => {
     return (
         <>
             <IconButton color="inherit">
-                <Badge badgeContent={3} color="primary">
-                    <NotificationsIcon />
-                </Badge>
+                <Tooltip title="Notification">
+                    <Badge badgeContent={3} color="primary">
+                        <NotificationIcon />
+                    </Badge>
+                </Tooltip>
             </IconButton>
-            <DropdownMenu icon={PersonIcon} id="account-menu">
+            <DropdownMenu icon={<UserPanelIcon />} id="account-menu" title="Account Management">
                 <MenuItem>
                     {getUserFullname(user)}
                 </MenuItem>
                 {renderMenuItems(menuItems.accountMenu, onMenuItemClick)}
             </DropdownMenu>
-            <DropdownMenu icon={HelpIcon} id="help-menu">
+            <DropdownMenu icon={<HelpIcon />} id="help-menu" title="Help">
                 {renderMenuItems(menuItems.helpMenu, onMenuItemClick)}
             </DropdownMenu>
         </>
@@ -114,16 +130,3 @@ const renderMenuItems = (menuItems: MainAppBarMenuItem[], onMenuItemClick: (menu
         </MenuItem>
     ));
 };
-
-type CssRules = "appBar" | "toolbar";
-
-const styles: StyleRulesCallback<CssRules> = theme => ({
-    appBar: {
-        backgroundColor: "#692498"
-    },
-    toolbar: {
-        minHeight: '48px'
-    }
-});
-
-export default withStyles(styles)(MainAppBar);
