151 lines
5.0 KiB
JavaScript
151 lines
5.0 KiB
JavaScript
import * as React from 'react';
|
|
import AppBar from '@mui/material/AppBar';
|
|
import Box from '@mui/material/Box';
|
|
import Toolbar from '@mui/material/Toolbar';
|
|
import IconButton from '@mui/material/IconButton';
|
|
import Typography from '@mui/material/Typography';
|
|
import Menu from '@mui/material/Menu';
|
|
import MenuIcon from '@mui/icons-material/Menu';
|
|
import Container from '@mui/material/Container';
|
|
import Button from '@mui/material/Button';
|
|
import Tooltip from '@mui/material/Tooltip';
|
|
import MenuItem from '@mui/material/MenuItem';
|
|
import AccountCircle from '@mui/icons-material/AccountCircle';
|
|
import ForumIcon from '@mui/icons-material/Forum';
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
|
const pages = ['Dashboard'];
|
|
|
|
export default function Navbar() {
|
|
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
|
|
|
const handleOpenNavMenu = (event) => {
|
|
setAnchorElNav(event.currentTarget);
|
|
};
|
|
const handleOpenUserMenu = (event) => {
|
|
setAnchorElUser(event.currentTarget);
|
|
};
|
|
|
|
const handleCloseNavMenu = () => {
|
|
setAnchorElNav(null);
|
|
};
|
|
|
|
const handleCloseUserMenu = () => {
|
|
setAnchorElUser(null);
|
|
};
|
|
|
|
const navigate = useNavigate();
|
|
|
|
return (
|
|
<AppBar position="static" sx={{ background: '#00226D' }}>
|
|
<Container maxWidth="xl">
|
|
<Toolbar disableGutters>
|
|
<Typography
|
|
variant="h6"
|
|
noWrap
|
|
component="div"
|
|
sx={{ mr: 2, display: { xs: 'none', md: 'flex' }, fontSize: '150%', borderRight: '0.05em solid black', borderColor: 'white', paddingRight: '1.5em' }}
|
|
>
|
|
Sports Matcher
|
|
</Typography>
|
|
|
|
<Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}>
|
|
<IconButton
|
|
size="large"
|
|
aria-label="account of current user"
|
|
aria-controls="menu-appbar"
|
|
aria-haspopup="true"
|
|
onClick={handleOpenNavMenu}
|
|
color="inherit"
|
|
>
|
|
<MenuIcon />
|
|
</IconButton>
|
|
<Menu
|
|
id="menu-appbar"
|
|
anchorEl={anchorElNav}
|
|
anchorOrigin={{
|
|
vertical: 'bottom',
|
|
horizontal: 'left',
|
|
}}
|
|
keepMounted
|
|
transformOrigin={{
|
|
vertical: 'top',
|
|
horizontal: 'left',
|
|
}}
|
|
open={Boolean(anchorElNav)}
|
|
onClose={handleCloseNavMenu}
|
|
sx={{
|
|
display: { xs: 'block', md: 'none' },
|
|
}}
|
|
>
|
|
{pages.map((page) => (
|
|
<MenuItem key={page} onClick={handleCloseNavMenu}>
|
|
<Typography textAlign="center">{page}</Typography>
|
|
</MenuItem>
|
|
))}
|
|
</Menu>
|
|
</Box>
|
|
<Typography
|
|
variant="h6"
|
|
noWrap
|
|
component="div"
|
|
sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}
|
|
>
|
|
Sports Matcher
|
|
</Typography>
|
|
<Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' }, marginLeft: '2%' }}>
|
|
<Button
|
|
onClick={() => { navigate("/dashboard") }}
|
|
sx={{ my: 2, color: 'white', display: 'block', textTransform: 'none', fontSize: '100%' }}
|
|
>
|
|
Dashboard
|
|
</Button>
|
|
</Box>
|
|
|
|
<Box sx={{ flexGrow: 0, marginRight: '1%' }}>
|
|
<Tooltip title="Chats">
|
|
<IconButton onClick={() => { navigate('/chat-window') }} sx={{ p: 0 }}>
|
|
<ForumIcon sx={{ color: 'white' }}></ForumIcon>
|
|
</IconButton>
|
|
</Tooltip>
|
|
</Box>
|
|
<Box sx={{ flexGrow: 0 }}>
|
|
<Tooltip title="Settings">
|
|
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
|
|
<AccountCircle sx={{ color: 'white' }}></AccountCircle>
|
|
</IconButton>
|
|
</Tooltip>
|
|
<Menu
|
|
sx={{ mt: '30px' }}
|
|
id="menu-appbar"
|
|
anchorEl={anchorElUser}
|
|
anchorOrigin={{
|
|
vertical: 'top',
|
|
horizontal: 'right',
|
|
}}
|
|
keepMounted
|
|
transformOrigin={{
|
|
vertical: 'top',
|
|
horizontal: 'right',
|
|
}}
|
|
open={Boolean(anchorElUser)}
|
|
onClose={handleCloseUserMenu}
|
|
>
|
|
<MenuItem onClick={handleCloseUserMenu}>
|
|
<Typography textAlign="center">Profile</Typography>
|
|
</MenuItem>
|
|
<MenuItem onClick={handleCloseUserMenu}>
|
|
<Typography textAlign="center">Account</Typography>
|
|
</MenuItem>
|
|
<MenuItem onClick={() => navigate('/sign-in')}>
|
|
<Typography textAlign="center">Sign Out</Typography>
|
|
</MenuItem>
|
|
</Menu>
|
|
</Box>
|
|
</Toolbar>
|
|
</Container>
|
|
</AppBar>
|
|
);
|
|
};
|