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';
18 import { sanitizeHTML } from "common/html-sanitize";
20 type CssRules = 'toolbar' | 'link';
22 const styles: StyleRulesCallback<CssRules> = () => ({
24 textDecoration: 'none',
32 interface MainAppBarDataProps {
38 sidePanelIsCollapsed: boolean;
41 export type MainAppBarProps = MainAppBarDataProps & WithStyles<CssRules>;
43 export const MainAppBar = withStyles(styles)(
44 (props: MainAppBarProps) => {
45 return <AppBar position="absolute">
46 <Toolbar className={props.classes.toolbar}>
47 <Grid container justify="space-between">
48 {pluginConfig.appBarLeft || <Grid container item xs={3} direction="column" justify="center">
49 <Typography variant='h6' color="inherit" noWrap>
50 <Link to={Routes.ROOT} className={props.classes.link}>
51 <span dangerouslySetInnerHTML={{ __html: sanitizeHTML(props.siteBanner) }} /> ({props.uuidPrefix})
54 <Typography variant="caption" color="inherit">
56 {props.buildInfo}</Typography>
63 {pluginConfig.appBarMiddle || (props.user && props.user.isActive && <SearchBar />)}
75 {pluginConfig.appBarRight ||
77 {props.user.isAdmin && <AdminMenu />}
81 pluginConfig.appBarRight || <HelpMenu />