From bf3299043768f5fcf0b80ee07b3452b6ddda2723 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Fri, 9 Aug 2024 06:30:38 +0000 Subject: [PATCH] student dashboard --- src/components/Card.tsx | 55 +++ src/components/index.tsx | 8 +- src/images/RR_logo.svg | 336 ++++++++++++++++++ src/images/RR_logo_green.svg | 1 + src/pages/studentDashboard/Games.tsx | 36 ++ .../studentDashboard/RapidRouterProgress.tsx | 54 +++ .../studentDashboard/StudentDashboard.tsx | 56 +++ src/router/routes/student.tsx | 18 +- 8 files changed, 556 insertions(+), 8 deletions(-) create mode 100644 src/components/Card.tsx create mode 100644 src/images/RR_logo.svg create mode 100644 src/images/RR_logo_green.svg create mode 100644 src/pages/studentDashboard/Games.tsx create mode 100644 src/pages/studentDashboard/RapidRouterProgress.tsx create mode 100644 src/pages/studentDashboard/StudentDashboard.tsx diff --git a/src/components/Card.tsx b/src/components/Card.tsx new file mode 100644 index 0000000..25d7821 --- /dev/null +++ b/src/components/Card.tsx @@ -0,0 +1,55 @@ +import { type AnchorHTMLAttributes, type FC } from "react" +import { + Button, + type ButtonProps, + CardActions, + CardContent, + CardMedia, + type CardMediaProps, + Card as MuiCard, + type CardProps as MuiCardProps, + Typography, +} from "@mui/material" + +export interface CardProps extends MuiCardProps { + title: string + description: string + mediaProps: { + image: NonNullable + title: NonNullable + } + buttonProps: ButtonProps & AnchorHTMLAttributes +} + +const Card: FC = ({ + title, + description, + mediaProps, + buttonProps, + style, + ...otherCardProps +}) => { + return ( + + + + {title} + {description} + + + + + ) +} + +export default RapidRouterProgress diff --git a/src/pages/studentDashboard/StudentDashboard.tsx b/src/pages/studentDashboard/StudentDashboard.tsx new file mode 100644 index 0000000..662c82d --- /dev/null +++ b/src/pages/studentDashboard/StudentDashboard.tsx @@ -0,0 +1,56 @@ +import * as page from "codeforlife/components/page" +import { type SessionMetadata, useQueryManager } from "codeforlife/hooks" +import { type FC } from "react" +import { Link } from "codeforlife/components/router" + +import Games from "./Games" +import RapidRouterProgress from "./RapidRouterProgress" +import { paths } from "../../router" +import { useRetrieveUserQuery } from "../../api/user" + +export interface StudentDashboardProps { + userType: "student" | "indy" +} + +const BaseDashboard: FC = ({ user_id, user_type }) => { + const isStudent = user_type === "student" + + return useQueryManager(useRetrieveUserQuery, user_id, user => { + return ( + <> + + + {isStudent ? ( + <>You are logged in to class: {user.student!.klass} + ) : ( + <> + You are logged in as an independent student. If you want to join a + school, you need to  + + request to join one + + . + + )} + + + + + + + + + ) + }) +} + +const StudentDashboard: FC = ({ userType }) => ( + {BaseDashboard} +) + +export default StudentDashboard diff --git a/src/router/routes/student.tsx b/src/router/routes/student.tsx index cfb6fd2..bb7d4c8 100644 --- a/src/router/routes/student.tsx +++ b/src/router/routes/student.tsx @@ -1,16 +1,20 @@ -// import { Route } from 'react-router-dom'; +import { Route } from "react-router-dom" // import Student from '../../pages/student/Student'; -// import StudentDashboard from '../../pages/studentDashboard/StudentDashboard'; -// import paths from '../paths'; +import StudentDashboard from "../../pages/studentDashboard/StudentDashboard" +import paths from "../paths" const student = ( <> {/* } /> */} - {/* } - /> */} + } + /> + } + /> )