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 { CustomStyleRulesCallback } from 'common/custom-theme';
8 import { WithStyles, withStyles } from '@material-ui/core/styles';
9 import { Link } from "react-router-dom";
10 import { User } from "models/user";
11 import { SearchBar } from "views-components/search-bar/search-bar";
12 import { Routes } from 'routes/routes';
13 import { NotificationsMenu } from "views-components/main-app-bar/notifications-menu";
14 import { AccountMenu } from "views-components/main-app-bar/account-menu";
15 import { HelpMenu } from 'views-components/main-app-bar/help-menu';
16 import { ReactNode } from "react";
17 import { AdminMenu } from "views-components/main-app-bar/admin-menu";
18 import { pluginConfig } from 'plugins';
19 import { sanitizeHTML } from "common/html-sanitize";
21 type CssRules = 'toolbar' | 'link';
23 const styles: CustomStyleRulesCallback<CssRules> = () => ({
25 textDecoration: 'none',
33 interface MainAppBarDataProps {
39 sidePanelIsCollapsed: boolean;
42 export type MainAppBarProps = MainAppBarDataProps & WithStyles<CssRules>;
44 export const MainAppBar = withStyles(styles)(
45 (props: MainAppBarProps) => {
46 return <AppBar position="absolute">
47 <Toolbar className={props.classes.toolbar}>
48 <Grid container justify="space-between">
49 {pluginConfig.appBarLeft || <Grid container item xs={3} direction="column" justify="center">
50 <Typography variant='h6' color="inherit" noWrap>
51 <Link to={Routes.ROOT} className={props.classes.link}>
52 <span dangerouslySetInnerHTML={{ __html: sanitizeHTML(props.siteBanner) }} /> ({props.uuidPrefix})
55 <Typography variant="caption" color="inherit">
57 {props.buildInfo}</Typography>
64 {pluginConfig.appBarMiddle || (props.user && props.user.isActive && <SearchBar />)}
76 {pluginConfig.appBarRight ||
78 {props.user.isAdmin && <AdminMenu />}
82 pluginConfig.appBarRight || <HelpMenu />