1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { AppBar, Toolbar, Typography, Grid } from "@material-ui/core";
7 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
8 import { Link } from "react-router-dom";
9 import { User } from "models/user";
10 import { SearchBar } from "views-components/search-bar/search-bar";
11 import { Routes } from 'routes/routes';
12 import { NotificationsMenu } from "views-components/main-app-bar/notifications-menu";
13 import { AccountMenu } from "views-components/main-app-bar/account-menu";
14 import { HelpMenu } from 'views-components/main-app-bar/help-menu';
15 import { ReactNode } from "react";
16 import { AdminMenu } from "views-components/main-app-bar/admin-menu";
17 import { pluginConfig } from 'plugins';
19 type CssRules = 'toolbar' | 'link';
21 const styles: StyleRulesCallback<CssRules> = () => ({
23 textDecoration: 'none',
31 interface MainAppBarDataProps {
39 export type MainAppBarProps = MainAppBarDataProps & WithStyles<CssRules>;
41 export const MainAppBar = withStyles(styles)(
42 (props: MainAppBarProps) => {
43 return <AppBar position="absolute">
44 <Toolbar className={props.classes.toolbar}>
45 <Grid container justify="space-between">
46 {pluginConfig.appBarLeft || <Grid container item xs={3} direction="column" justify="center">
47 <Typography variant='h6' color="inherit" noWrap>
48 <Link to={Routes.ROOT} className={props.classes.link}>
49 <span dangerouslySetInnerHTML={{ __html: props.siteBanner }} /> ({props.uuidPrefix})
52 <Typography variant="caption" color="inherit">{props.buildInfo}</Typography>
59 {pluginConfig.appBarMiddle || (props.user && props.user.isActive && <SearchBar />)}
71 {pluginConfig.appBarRight ||
73 {props.user.isAdmin && <AdminMenu />}
77 pluginConfig.appBarRight || <HelpMenu />