Skip to content

Commit

Permalink
Revert back to Matt's branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Saki committed Apr 15, 2024
1 parent 94c0384 commit e684d29
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 188 deletions.
Binary file not shown.
13 changes: 6 additions & 7 deletions frontend/src/components/ReadySetCyber/RSCDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const RSCDashboard: React.FC = () => {
<Grid item xs={4}>
<RSCSideNav />
</Grid>
<Grid item xs={12} sm={8}>
<Grid item xs={8}>
<Box sx={{ flexGrow: 1, padding: 2, backgroundColor: 'white' }}>
<Stack>
<h2>Assessment Results</h2>
Expand All @@ -57,19 +57,18 @@ export const RSCDashboard: React.FC = () => {
platform, for free vulnerability scanning services to kickstart
or enhance your cybersecurity measures.
</p>
<Stack spacing={2}>
{results.map((result) => (
{results.map((result) => (
<Stack key={result.id} spacing={2}>
<RSCResult
key={result.id}
id={result.id}
type={result.type}
createdAt={result.createdAt}
updatedAt={result.updatedAt}
rscID={result.rscID}
/>
))}
</Stack>
<Divider />
<Divider />
</Stack>
))}
</Stack>
</Box>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ReadySetCyber/RSCDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const RSCDetail: React.FC = () => {
<Grid item xs={4}>
<RSCSideNav />
</Grid>
<Grid item xs={12} sm={8}>
<Grid item xs={8}>
<Box sx={{ flexGrow: 1, padding: 2, backgroundColor: 'white' }}>
<Stack spacing={2}>
<Stack
Expand Down
190 changes: 11 additions & 179 deletions frontend/src/components/ReadySetCyber/RSCHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,189 +1,21 @@
import React from 'react';
import { AppBar } from '@mui/material';
import { Toolbar } from '@mui/material';
import { Typography } from '@mui/material';
import { useHistory } from 'react-router-dom';
import { useAuthContext } from 'context';
import {
AppBar,
Toolbar,
Container,
Box,
Typography,
IconButton,
Menu,
MenuItem,
Tooltip
} from '@mui/material';
import AccountCircle from '@mui/icons-material/AccountCircle';
import MenuIcon from '@mui/icons-material/Menu';
import RSCLogo from 'components/ReadySetCyber/assets/ReadySetCyberLogo.png';

export const RSCHeader: React.FC = () => {
const history = useHistory();
const handleNavHome = () => {
const handleClick = () => {
history.push('/readysetcyber');
};
const { logout, user } = useAuthContext();

const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const [anchorElNav, setAnchorElNav] = React.useState<null | HTMLElement>(
null
);

const handleOpenNavMenu = (event: React.MouseEvent<HTMLElement>) => {
setAnchorElNav(event.currentTarget);
};

const handleMenu = (event: React.MouseEvent<HTMLElement>) => {
setAnchorEl(event.currentTarget);
};

const handleCloseNavMenu = () => {
setAnchorElNav(null);
};

const handleClose = () => {
setAnchorEl(null);
};

return (
<Box sx={{ flexGrow: 1 }}>
<AppBar position="static" sx={{ bgcolor: 'white' }}>
<Container maxWidth="xl">
<Toolbar disableGutters>
<Tooltip title="Go to Ready Set Cyber" arrow>
<IconButton
onClick={handleNavHome}
sx={{ display: { xs: 'none', md: 'flex' }, mr: 1 }}
style={{ backgroundColor: 'white', outline: 'none' }}
disableFocusRipple
>
<img
src={RSCLogo}
alt="Ready Set Cyber Logo"
style={{
width: '4em',
height: '2em'
}}
/>
</IconButton>
</Tooltip>
<Typography
variant="h6"
component="div"
sx={{
flexGrow: 1,
color: '#07648D',
display: { xs: 'none', md: 'flex' },
mr: 2
}}
>
Dashboard
</Typography>
<Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}>
<Tooltip title="Go to Ready Set Cyber" arrow>
<IconButton
onClick={handleNavHome}
sx={{ display: { xs: 'flex', md: 'none' }, mr: 0 }}
style={{ backgroundColor: 'white', outline: 'none' }}
>
<img
src={RSCLogo}
alt="Ready Set Cyber Logo"
style={{
width: '4em',
height: '2em'
}}
/>
</IconButton>
</Tooltip>
</Box>
{user && (
<>
<IconButton
size="large"
aria-label="nav menu"
aria-controls="menu-navbar"
aria-haspopup="true"
color="primary"
onClick={handleOpenNavMenu}
style={{ outline: 'none' }}
sx={{ display: { xs: 'block', md: 'none' } }}
>
<MenuIcon />
</IconButton>
<Menu
id="menu-appbar"
anchorEl={anchorElNav}
anchorOrigin={{
vertical: 'top',
horizontal: 'right'
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'right'
}}
open={Boolean(anchorElNav)}
onClose={handleCloseNavMenu}
sx={{ display: { xs: 'block', md: 'none' } }}
>
<MenuItem style={{ outline: 'none' }}>
{' '}
Welcome, user
</MenuItem>
<MenuItem style={{ outline: 'none' }} onClick={handleNavHome}>
Dashboard
</MenuItem>
<MenuItem style={{ outline: 'none' }}>
{' '}
Take Questionnaire Again{' '}
</MenuItem>
<MenuItem style={{ outline: 'none' }} onClick={logout}>
Logout
</MenuItem>
</Menu>
</>
)}
{user && (
<Box sx={{ flexGrow: 0, display: { xs: 'none', md: 'flex' } }}>
<Tooltip title="Open Menu" arrow>
<IconButton
sx={{ p: 0 }}
size="large"
aria-label="account of current user"
aria-controls="menu-appbar"
aria-haspopup="true"
color="primary"
onClick={handleMenu}
style={{ outline: 'none' }}
>
<AccountCircle />
</IconButton>
</Tooltip>
<Menu
sx={{ marginTop: '40px' }}
id="menu-appbar"
anchorEl={anchorEl}
anchorOrigin={{
vertical: 'top',
horizontal: 'right'
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'right'
}}
open={Boolean(anchorEl)}
onClose={handleClose}
>
<MenuItem style={{ outline: 'none' }} onClick={logout}>
Logout
</MenuItem>
</Menu>
</Box>
)}
</Toolbar>
</Container>
</AppBar>
</Box>
<AppBar position="static">
<Toolbar>
<Typography variant="h6" onClick={handleClick}>
Ready Set Cyber
</Typography>
</Toolbar>
</AppBar>
);
};
1 change: 0 additions & 1 deletion frontend/src/components/ReadySetCyber/RSCQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Stack from '@mui/material/Stack';
import Button from '@mui/material/Button';
import Grid from '@mui/material/Grid';

interface Props {
categories: Category[];
Expand Down

0 comments on commit e684d29

Please sign in to comment.