github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/public/src/components/Dashboard.tsx (about) 1 import React from "react" 2 import { Redirect } from "react-router" 3 import { hasEnrollment } from "../Helpers" 4 import { useAppState } from "../overmind" 5 import Alerts from "./alerts/Alerts" 6 import Courses from "./Courses" 7 import SubmissionsTable from "./dashboard/SubmissionsTable" 8 9 10 /* Dashboard for a signed in user. */ 11 const Dashboard = (): JSX.Element => { 12 const state = useAppState() 13 14 // Users that are not enrolled in any courses are redirected to the course list. 15 if (!hasEnrollment(state.enrollments)) { 16 return <Redirect to={"/courses"} /> 17 } 18 19 return ( 20 <div className='box'> 21 <Alerts /> 22 <div> 23 <h1>Welcome, {state.self.Name}!</h1> 24 </div> 25 <SubmissionsTable /> 26 <Courses home /> 27 </div> 28 ) 29 } 30 31 export default Dashboard