From edb2128cbf694153e43a02153483b7ebae84f850 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 18 Jul 2020 22:15:53 +0000 Subject: [PATCH] Display Protospace as meeting instructor --- webclient/src/Classes.js | 6 +++--- webclient/src/Courses.js | 4 ++-- webclient/src/utils.js | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/webclient/src/Classes.js b/webclient/src/Classes.js index d4a037d..b839b58 100644 --- a/webclient/src/Classes.js +++ b/webclient/src/Classes.js @@ -3,7 +3,7 @@ import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-r import './light.css'; import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; import moment from 'moment-timezone'; -import { isAdmin, isInstructor, BasicTable, requester } from './utils.js'; +import { isAdmin, isInstructor, getInstructor, BasicTable, requester } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; import { InstructorClassDetail, InstructorClassAttendance } from './InstructorClasses.js'; import { PayPalPayNow } from './PayPal.js'; @@ -35,7 +35,7 @@ function ClassTable(props) { {x.is_cancelled ? 'Cancelled' : moment.utc(x.datetime).tz('America/Edmonton').format('LT')} - {x.instructor_name} + {getInstructor(x)} {x.cost === '0.00' ? 'Free' : '$'+x.cost} {x.student_count} {!!x.max_students && '/ '+x.max_students} @@ -171,7 +171,7 @@ export function ClassDetail(props) { Instructor: - {clazz.instructor_name} + {getInstructor(clazz)} Cost: diff --git a/webclient/src/Courses.js b/webclient/src/Courses.js index f298383..27c05fb 100644 --- a/webclient/src/Courses.js +++ b/webclient/src/Courses.js @@ -3,7 +3,7 @@ import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-r import './light.css'; import { Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; import moment from 'moment-timezone'; -import { isInstructor, requester } from './utils.js'; +import { isInstructor, getInstructor, requester } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; import { InstructorCourseList, InstructorCourseDetail } from './InstructorCourses.js'; import { InstructorClassList } from './InstructorClasses.js'; @@ -126,7 +126,7 @@ export function CourseDetail(props) { {x.is_cancelled ? 'Cancelled' : moment.utc(x.datetime).tz('America/Edmonton').format('LT')} - {x.instructor_name} + {getInstructor(x)} {x.cost === '0.00' ? 'Free' : '$'+x.cost} ) diff --git a/webclient/src/utils.js b/webclient/src/utils.js index ec56859..6140508 100644 --- a/webclient/src/utils.js +++ b/webclient/src/utils.js @@ -8,6 +8,14 @@ export const staticUrl = window.location.protocol + '//static.' + window.locatio export const isAdmin = (user) => user.is_staff || user.member.is_director || user.member.is_staff; export const isInstructor = (user) => isAdmin(user) || user.member.is_instructor; +export const getInstructor = (x) => { + if (x.course === 413 || x.course === 317 || x.course === 273) { + return 'Protospace'; + } else { + return x.instructor_name; + } +}; + export const statusColor = { 'Prepaid': 'green', 'Current': 'green',