From d9f990f7e1340d280ff9fd8d9d4d43c8bd6ac8d3 Mon Sep 17 00:00:00 2001 From: Rose Wang <51464298+rosewang01@users.noreply.github.com> Date: Tue, 25 Feb 2025 03:14:46 -0500 Subject: [PATCH] tabs --- .../src/AdminDashboard/AdminDashboardPage.tsx | 94 +++++++++++-------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/client/src/AdminDashboard/AdminDashboardPage.tsx b/client/src/AdminDashboard/AdminDashboardPage.tsx index 0d3e56eb..e737a16b 100644 --- a/client/src/AdminDashboard/AdminDashboardPage.tsx +++ b/client/src/AdminDashboard/AdminDashboardPage.tsx @@ -1,5 +1,7 @@ import React from 'react'; import { Typography, AppBar, Box } from '@mui/material'; +import Tabs from '@mui/material/Tabs'; +import Tab from '@mui/material/Tab'; import ScreenGrid from '../components/ScreenGrid'; import QuestionTable from './Tables/QuestionTable'; import ResourceTable from './Tables/ResourceTable'; @@ -14,6 +16,8 @@ import UserTable from './Tables/UserTable'; * Admin to delete users from admin and promote users to admin. */ function AdminDashboardPage() { + const [value, setValue] = React.useState('questions'); + // determine if user is an admin const self = useAppSelector(selectUser); @@ -45,49 +49,63 @@ function AdminDashboardPage() { }} > Welcome to the Admin Dashboard -
- - Questions - -
- + + setValue(newValue)}> + + + + {self.admin && } + + + {value === 'questions' && ( +
+ + Questions + +
+ +
-
-
- - Resources - -
- + )} + {value === 'resources' && ( +
+ + Resources + +
+ +
-
-
- - Definitions - -
- + )} + {value === 'definitions' && ( +
+ + Definitions + +
+ +
-
- {self.admin && ( + )} + {value === 'users' && self.admin && (