Skip to content

Commit e1bdbb0

Browse files
authored
Merge pull request #72 from usingbrain/nobrain
feat: total students on class view
2 parents f604134 + 95cf43e commit e1bdbb0

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

client/src/Components/ClassView/ClassView.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Course from '../../Types/course';
66
import { ReactComponent as CloseBtn } from '../../Assets/window-close-regular.svg';
77
import ClassDashboard from './ClassDashboard';
88
import Overview from '../Calendar/Overview';
9+
import User from '../../Types/user';
910

1011
const headerStyle =
1112
'bg-black text-white flex flex-row justify-between items-center content-center p-8 h-20 mb-4 text-3xl';
@@ -20,6 +21,10 @@ const ClassView: React.FC = () => {
2021
(state: { selectedCourse: Course | null }) => state.selectedCourse
2122
);
2223
const history = useSelector((state: { history: boolean }) => state.history);
24+
const students = useSelector(
25+
(state: { currentList: User[] }) => state.currentList
26+
);
27+
2328
const courseId = course?.id;
2429

2530
const link = history
@@ -28,23 +33,24 @@ const ClassView: React.FC = () => {
2833

2934
if (course && courseId) {
3035
return (
31-
<section className='h-screen flex flex-col justify-start w-3/4'>
36+
<section className="h-screen flex flex-col justify-start w-3/4">
3237
<div className={headerStyle}>
33-
<h1 className='font-bold'>{course.name?.toUpperCase()}</h1>
34-
<Link to='/homepage'>
38+
<h1 className="font-bold">{course.name?.toUpperCase()}</h1>
39+
<Link to="/homepage">
3540
<button onClick={() => dispatch(setSelected(null))}>
36-
<CloseBtn className='w-10 h-10' />
41+
<CloseBtn className="w-10 h-10" />
3742
</button>
3843
</Link>
3944
</div>
40-
<article className='flex flex-col px-10'>
41-
<div className='flex flex-row justify-around w-full'>
45+
<article className="flex flex-col px-10">
46+
<div className="flex flex-row justify-around w-full">
4247
<div className={listHeader}>
43-
Students {history && `assigned to this course:`}
48+
Students{' '}
49+
{history && `assigned to this course: ${students.length}`}
4450
</div>
4551
<Link to={link} className={attendanceStyle}>
4652
<h3
47-
className='text-lg'
53+
className="text-lg"
4854
onClick={() => dispatch(setHistory(history))}
4955
>
5056
{history ? 'Back to dashboard' : 'Attendance history'}

0 commit comments

Comments
 (0)