diff --git a/client/src/components/home/shared/CooldownViolationOverlay.tsx b/client/src/components/home/shared/CooldownViolationOverlay.tsx
index fcc37c5..0eae8a3 100644
--- a/client/src/components/home/shared/CooldownViolationOverlay.tsx
+++ b/client/src/components/home/shared/CooldownViolationOverlay.tsx
@@ -12,41 +12,59 @@ export default function CooldownViolationOverlay(props) {
const {queueData} = useContext(QueueDataContext);
function callAddQuestionAPIOverrideCooldown() {
- HomeService.addQuestion(
- JSON.stringify({
- andrewID: andrewID,
- question: question,
- location: location,
- topic: topic,
- overrideCooldown: true,
- }),
- ).then((res) => {
- if (res.status === 200) {
- setOpen(false);
- }
- });
+ if (queueData.allowCDOverride) {
+ HomeService.addQuestion(
+ JSON.stringify({
+ andrewID: andrewID,
+ question: question,
+ location: location,
+ topic: topic,
+ overrideCooldown: true,
+ }),
+ ).then((res) => {
+ if (res.status === 200) {
+ setOpen(false);
+ }
+ });
+ } else return;
}
- return (
-
+ );
+ }
}
+
diff --git a/client/src/components/home/student/YourEntry.tsx b/client/src/components/home/student/YourEntry.tsx
index 0a54f86..32b5639 100644
--- a/client/src/components/home/student/YourEntry.tsx
+++ b/client/src/components/home/student/YourEntry.tsx
@@ -23,6 +23,8 @@ export default function YourEntry(props) {
const {queueData} = useContext(QueueDataContext);
const {studentData} = useContext(StudentDataContext);
+ const cooldownMsg = queueData.allowCDOverride ? 'You have been frozen in line. This means you will not advance in the queue until a TA approves your entry.' : 'You have been frozen in line. You will not advance in the queue! Please wait for your cooldown to end before joining the queue again.';
+
return (
@@ -41,8 +43,7 @@ export default function YourEntry(props) {
- You have been frozen in line. This means you will not advance in the queue
- until a TA approves your entry.
+ {cooldownMsg}
diff --git a/client/src/components/home/ta/EntryTails.tsx b/client/src/components/home/ta/EntryTails.tsx
index d201e89..5350245 100644
--- a/client/src/components/home/ta/EntryTails.tsx
+++ b/client/src/components/home/ta/EntryTails.tsx
@@ -10,10 +10,13 @@ import StudentStatus from './TailOptions/StudentStatus';
import LeapStudentActions from './TailOptions/LeapStudentActions';
import {StudentStatusValues} from '../../../services/StudentStatus';
+import PersistentOptions from './TailOptions/PersistentOptions';
export default function EntryTails(props) {
const {student, index, isHelping, helpIdx} = props;
+ const showApproval = props.showCooldownApproval;
+
const status = student.status;
const themeHook = useTheme();
@@ -30,8 +33,13 @@ export default function EntryTails(props) {
case StudentStatusValues.WAITING: return (ActionsHelp(props));
case StudentStatusValues.FIXING_QUESTION: return (ActionsHelp(props));
case StudentStatusValues.FROZEN: return (ActionsFreeze(props));
- case StudentStatusValues.COOLDOWN_VIOLATION: return (LeapStudentActions(props));
case StudentStatusValues.RECEIVED_MESSAGE: return (ActionsHelp(props));
+ case StudentStatusValues.COOLDOWN_VIOLATION:
+ if (showApproval) {
+ return (LeapStudentActions(props));
+ } else {
+ return (ActionsHelp({...props, color: 'secondary'}));
+ }
default: return;
}
};
diff --git a/client/src/components/home/ta/StudentEntry.tsx b/client/src/components/home/ta/StudentEntry.tsx
index a15cf2b..b038a6b 100644
--- a/client/src/components/home/ta/StudentEntry.tsx
+++ b/client/src/components/home/ta/StudentEntry.tsx
@@ -1,4 +1,4 @@
-import React, {useState, useEffect, useRef} from 'react';
+import React, {useState, useEffect, useRef, useContext} from 'react';
import {
Stack, TableCell, Typography,
} from '@mui/material';
@@ -7,16 +7,21 @@ import PauseIcon from '@mui/icons-material/Pause';
import EntryTails from './EntryTails';
import ItemRow from '../../common/table/ItemRow';
+import {QueueDataContext} from '../../../contexts/QueueDataContext';
+
import HomeService from '../../../services/HomeService';
import {StudentStatusValues} from '../../../services/StudentStatus';
+import {Settings} from '@mui/icons-material';
+import {debug} from 'util';
export default function StudentEntry(props) {
+ const {queueData} = useContext(QueueDataContext);
const {student, index, handleClickHelp, removeStudent, handleClickUnfreeze} = props;
const [confirmRemove, setConfirmRemove] = useState(false);
const removeRef = useRef();
- const [showCooldownApproval, setShowCooldownApproval] = useState(student['status'] === StudentStatusValues.COOLDOWN_VIOLATION);
+ const [showCooldownApproval, setShowCooldownApproval] = useState(queueData.allowCDOverride && student['status'] === StudentStatusValues.COOLDOWN_VIOLATION);
useEffect(() => {
const closeExpanded = (e) => {
@@ -32,6 +37,11 @@ export default function StudentEntry(props) {
};
}, []);
+ // Update showCooldownApproval when allowCDOverride changes
+ useEffect(() => {
+ setShowCooldownApproval(queueData.allowCDOverride && student['status'] === StudentStatusValues.COOLDOWN_VIOLATION);
+ }, [queueData.allowCDOverride, student['status']]);
+
function handleRemoveButton() {
if (confirmRemove) {
setConfirmRemove(false);
diff --git a/client/src/components/home/ta/TailOptions/ActionsHelp.tsx b/client/src/components/home/ta/TailOptions/ActionsHelp.tsx
index bef9a1c..fdc65e0 100644
--- a/client/src/components/home/ta/TailOptions/ActionsHelp.tsx
+++ b/client/src/components/home/ta/TailOptions/ActionsHelp.tsx
@@ -12,12 +12,14 @@ export default function ActionsHelp(props) {
student, index, isHelping, handleClickHelp,
} = props;
+ const buttonColor = props.color == null ? 'info' : props.color;
+
return (
-