diff --git a/webclient/src/Classes.js b/webclient/src/Classes.js index 052d1d1..ac25e8c 100644 --- a/webclient/src/Classes.js +++ b/webclient/src/Classes.js @@ -7,6 +7,49 @@ import moment from 'moment'; import { requester } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; +function ClassTable(props) { + const { classes } = props; + + const getInstructor = (session) => + session.instructor ? session.instructor.first_name : session.old_instructor; + + return ( + + + + ID + Name + Date + Instructor + Cost + Students + + + + + {classes.length ? + classes.map((x, i) => + + {x.id} + {x.course.name} + + + {moment.utc(x.datetime).format('ll')} + + + {getInstructor(x)} + {x.cost === '0.00' ? 'Free' : '$'+x.cost} + {x.student_count} + + ) + : +

None

+ } +
+
+ ); +}; + export function Classes(props) { const [classes, setClasses] = useState(false); const { token } = props; @@ -22,47 +65,22 @@ export function Classes(props) { }); }, []); - const getInstructor = (session) => - session.instructor ? session.instructor.first_name : session.old_instructor; + const now = new Date().toISOString(); return ( -
Most Recent Classes
+
Class List
+
Upcoming
{classes ? - - - - ID - Name - Date - Instructor - Cost - Students - - - - - {classes.length ? - classes.map((x, i) => - - {x.id} - {x.course.name} - - - {moment.utc(x.datetime).format('LL')} - - - {getInstructor(x)} - {x.cost === '0.00' ? 'Free' : '$'+x.cost} - {x.student_count} - - ) - : -

None

- } -
-
+ x.datetime > now)} /> + : +

Loading...

+ } + +
Recent
+ {classes ? + x.datetime < now)} /> :

Loading...

} @@ -96,7 +114,7 @@ export function ClassDetail(props) { {!error ? clazz ?
-
Class Detail
+
Class Details
@@ -111,7 +129,7 @@ export function ClassDetail(props) { Date: - {moment.utc(clazz.datetime).format('LL')} + {moment.utc(clazz.datetime).format('ll')} diff --git a/webclient/src/Courses.js b/webclient/src/Courses.js index 23deaee..ec5802a 100644 --- a/webclient/src/Courses.js +++ b/webclient/src/Courses.js @@ -108,7 +108,7 @@ export function CourseDetail(props) { - {moment.utc(x.datetime).format('LL')} + {moment.utc(x.datetime).format('ll')} {moment.utc(x.datetime).format('LT')}