From 0d87f3426ed56416b84aeaba7f9739e6d0b2a71b Mon Sep 17 00:00:00 2001
From: Thomas
Date: Mon, 15 Apr 2024 14:46:30 -0400
Subject: [PATCH] Added new default side nav component, updated Side Nav to
display categories, updated Header for MVP Demo.
---
.../components/ReadySetCyber/RSCDashboard.tsx | 13 +-
.../ReadySetCyber/RSCDefaultSideNav.tsx | 24 ++
.../components/ReadySetCyber/RSCDetail.tsx | 2 +-
.../components/ReadySetCyber/RSCHeader.tsx | 349 +++++++++++++++++-
.../components/ReadySetCyber/RSCSideNav.tsx | 17 +-
5 files changed, 380 insertions(+), 25 deletions(-)
create mode 100644 frontend/src/components/ReadySetCyber/RSCDefaultSideNav.tsx
diff --git a/frontend/src/components/ReadySetCyber/RSCDashboard.tsx b/frontend/src/components/ReadySetCyber/RSCDashboard.tsx
index d2310dfa..6f6d4cfa 100644
--- a/frontend/src/components/ReadySetCyber/RSCDashboard.tsx
+++ b/frontend/src/components/ReadySetCyber/RSCDashboard.tsx
@@ -4,6 +4,7 @@ import Grid from '@mui/material/Grid';
import Stack from '@mui/material/Stack';
import Divider from '@mui/material/Divider';
import { RSCSideNav } from './RSCSideNav';
+import { RSCDefaultSideNav } from './RSCDefaultSideNav';
import { RSCResult } from './RSCResult';
import { useAuthContext } from 'context';
@@ -38,7 +39,7 @@ export const RSCDashboard: React.FC = () => {
-
+
@@ -57,18 +58,18 @@ export const RSCDashboard: React.FC = () => {
platform, for free vulnerability scanning services to kickstart
or enhance your cybersecurity measures.
- {results.map((result) => (
-
+
+ {results.map((result) => (
-
-
- ))}
+ ))}
+
diff --git a/frontend/src/components/ReadySetCyber/RSCDefaultSideNav.tsx b/frontend/src/components/ReadySetCyber/RSCDefaultSideNav.tsx
new file mode 100644
index 00000000..64ea6e37
--- /dev/null
+++ b/frontend/src/components/ReadySetCyber/RSCDefaultSideNav.tsx
@@ -0,0 +1,24 @@
+import React from 'react';
+import { useParams } from 'react-router-dom';
+import Box from '@mui/material/Box';
+import List from '@mui/material/List';
+import ListItem from '@mui/material/ListItem';
+import Divider from '@mui/material/Divider';
+
+export const RSCDefaultSideNav: React.FC = () => {
+ const { id } = useParams<{ id: string }>();
+
+ return (
+
+
+
+ Welcome User
+
+ Take Questionnaire Again
+
+ Logout
+
+
+
+ );
+};
diff --git a/frontend/src/components/ReadySetCyber/RSCDetail.tsx b/frontend/src/components/ReadySetCyber/RSCDetail.tsx
index a4d37131..8538765c 100644
--- a/frontend/src/components/ReadySetCyber/RSCDetail.tsx
+++ b/frontend/src/components/ReadySetCyber/RSCDetail.tsx
@@ -46,7 +46,7 @@ export const RSCDetail: React.FC = () => {
-
+
diff --git a/frontend/src/components/ReadySetCyber/RSCHeader.tsx b/frontend/src/components/ReadySetCyber/RSCHeader.tsx
index f3896b28..b06a200c 100644
--- a/frontend/src/components/ReadySetCyber/RSCHeader.tsx
+++ b/frontend/src/components/ReadySetCyber/RSCHeader.tsx
@@ -1,21 +1,348 @@
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 handleClick = () => {
+ const handleNavHome = () => {
history.push('/readysetcyber');
};
+ const { logout, user } = useAuthContext();
+
+ const [anchorEl, setAnchorEl] = React.useState(null);
+ const [anchorElNav, setAnchorElNav] = React.useState(
+ null
+ );
+
+ const handleOpenNavMenu = (event: React.MouseEvent) => {
+ setAnchorElNav(event.currentTarget);
+ };
+
+ const handleMenu = (event: React.MouseEvent) => {
+ setAnchorEl(event.currentTarget);
+ };
+
+ const handleCloseNavMenu = () => {
+ setAnchorElNav(null);
+ };
+
+ const handleClose = () => {
+ setAnchorEl(null);
+ };
+
return (
-
-
-
- Ready Set Cyber
-
-
-
+
+
+
+
+
+
+
+
+
+
+ Dashboard
+
+
+
+
+
+
+
+
+ {user && (
+ <>
+
+
+
+
+ >
+ )}
+ {user && (
+
+
+
+
+
+
+
+
+ )}
+
+
+
+
);
};
+
+// import React from 'react';
+// import { AppBar, Box, Container, Tooltip, IconButton, Menu, MenuItem } from '@mui/material';
+// import { Toolbar } from '@mui/material';
+// import { Typography } from '@mui/material';
+// import { useHistory } from 'react-router-dom';
+// import { useAuthContext } from 'context';
+// import RSCLogo from '../../assets/ReadySetCyberLogo.png';
+
+// export const RSCHeader: React.FC = () => {
+// const history = useHistory();
+// const handleNavHome = () => {
+// history.push('/readysetcyber');
+// };
+
+// const { user, logout } = useAuthContext();
+// return (
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+// Dashboard
+//
+//
+//
+//
+//
+//
+//
+//
+// {user && (
+// <>
+//
+//
+//
+//
+// >
+// )}
+// {user && (
+//
+//
+//
+//
+//
+//
+//
+//
+// )}
+//
+//
+//
+//
+// );
+// };
diff --git a/frontend/src/components/ReadySetCyber/RSCSideNav.tsx b/frontend/src/components/ReadySetCyber/RSCSideNav.tsx
index e9a38c6f..821fee12 100644
--- a/frontend/src/components/ReadySetCyber/RSCSideNav.tsx
+++ b/frontend/src/components/ReadySetCyber/RSCSideNav.tsx
@@ -5,13 +5,16 @@ import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import Divider from '@mui/material/Divider';
import { RSCNavItem } from './RSCNavItem';
-import { dummyResults } from './dummyData';
-export const RSCSideNav: React.FC = () => {
- const { id } = useParams<{ id: string }>();
+interface Props {
+ categories: Category[];
+}
- const categories =
- dummyResults.find((result) => result.id === parseInt(id))?.categories || [];
+export interface Category {
+ name: string;
+}
+export const RSCSideNav: React.FC = ({ categories }) => {
+ const { id } = useParams<{ id: string }>();
return (
@@ -19,8 +22,8 @@ export const RSCSideNav: React.FC = () => {
Welcome User
- {categories.map((category) => (
-
+ {categories.map((category, index) => (
+
))}
Take Questionnaire Again