From 87b71c00b91925947c6ee89a5647d0a1e949b0e9 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 21 Feb 2020 01:06:19 +0000 Subject: [PATCH] Hide class list behind edit class button --- webclient/src/InstructorClasses.js | 80 ++++++++++++++++-------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/webclient/src/InstructorClasses.js b/webclient/src/InstructorClasses.js index 03ca6a1..0b7febe 100644 --- a/webclient/src/InstructorClasses.js +++ b/webclient/src/InstructorClasses.js @@ -62,7 +62,8 @@ function AttendanceRow(props) { } export function InstructorClassAttendance(props) { - const { clazz, token, refreshClass } = props; + const { clazz, token, refreshClass, user } = props; + const [open, setOpen] = useState(false); const [input, setInput] = useState({}); const [error, setError] = useState(false); const [loading, setLoading] = useState(false); @@ -90,45 +91,52 @@ export function InstructorClassAttendance(props) {
Instructor Panel
-
Student Emails
+ {open || clazz.instructor === user.id ? +
+
Student Emails
+ {clazz.students.length ? + clazz.students + .filter(x => x.attendance_status !== 'Withdrawn') + .map(x => x.student_email) + .join('; ') + : +

No students yet.

+ } - {clazz.students.length ? - clazz.students - .filter(x => x.attendance_status !== 'Withdrawn') - .map(x => x.student_email) - .join('; ') +
Mark Attendance
+ + {clazz.students.length ? + clazz.students.map(x => + + ) + : +

No students yet.

+ } + +
Add Student
+ +
+ + + + + + Submit + +
+
: -

No students yet.

+ } - -
Mark Attendance
- - {clazz.students.length ? - clazz.students.map(x => - - ) - : -

No students yet.

- } - -
Add Student
- -
- - - - - - Submit - -
); };