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 "@mui/material";
7 import { CustomStyleRulesCallback } from 'common/custom-theme';
8 import { WithStyles } from '@mui/styles';
9 import withStyles from '@mui/styles/withStyles';
10 import { Link } from "react-router-dom";
11 import { User } from "models/user";
12 import { SearchBar } from "views-components/search-bar/search-bar";
13 import { Routes } from 'routes/routes';
14 import { NotificationsMenu } from "views-components/main-app-bar/notifications-menu";
15 import { AccountMenu } from "views-components/main-app-bar/account-menu";
16 import { HelpMenu } from 'views-components/main-app-bar/help-menu';
17 import { ReactNode } from "react";
18 import { AdminMenu } from "views-components/main-app-bar/admin-menu";
19 import { pluginConfig } from 'plugins';
20 import { sanitizeHTML } from "common/html-sanitize";
22 type CssRules = 'toolbar' | 'link';
24 const styles: CustomStyleRulesCallback<CssRules> = () => ({
26 textDecoration: 'none',
34 interface MainAppBarDataProps {
40 sidePanelIsCollapsed: boolean;
43 export type MainAppBarProps = MainAppBarDataProps & WithStyles<CssRules>;
45 export const MainAppBar = withStyles(styles)(
46 (props: MainAppBarProps) => {
48 <AppBar position="absolute">
49 <Toolbar className={props.classes.toolbar}>
50 <Grid container justifyContent="space-between">
51 {pluginConfig.appBarLeft || <Grid container item xs={3} direction="column" justifyContent="center">
52 <Typography variant='h6' color="inherit" noWrap>
53 <Link to={Routes.ROOT} className={props.classes.link}>
54 <span dangerouslySetInnerHTML={{ __html: sanitizeHTML(props.siteBanner) }} /> ({props.uuidPrefix})
57 <Typography variant="caption" color="inherit">
59 {props.buildInfo}</Typography>
66 {pluginConfig.appBarMiddle || (props.user && props.user.isActive && <SearchBar />)}
73 justifyContent="flex-end"
78 {pluginConfig.appBarRight ||
80 {props.user.isAdmin && <AdminMenu />}
84 pluginConfig.appBarRight || <HelpMenu />