@@ -58,7 +58,8 @@ import {
58
58
siteSpecific ,
59
59
useDeviceSize ,
60
60
useGameboards ,
61
- TODAY
61
+ TODAY ,
62
+ UTC_MIDNIGHT_IN_SIX_DAYS
62
63
} from "../../services" ;
63
64
import { IsaacSpinner , Loading } from "../handlers/IsaacSpinner" ;
64
65
import { GameboardDTO , RegisteredUserDTO , UserGroupDTO } from "../../../IsaacApiTypes" ;
@@ -74,9 +75,10 @@ interface AssignGroupProps {
74
75
groups : UserGroupDTO [ ] ;
75
76
board : GameboardDTO | undefined ;
76
77
}
78
+
77
79
const AssignGroup = ( { groups, board} : AssignGroupProps ) => {
78
80
const [ selectedGroups , setSelectedGroups ] = useState < Item < number > [ ] > ( [ ] ) ;
79
- const [ dueDate , setDueDate ] = useState < Date > ( ) ;
81
+ const [ dueDate , setDueDate ] = useState < Date | undefined > ( UTC_MIDNIGHT_IN_SIX_DAYS ) ;
80
82
const [ scheduledStartDate , setScheduledStartDate ] = useState < Date > ( ) ;
81
83
const [ assignmentNotes , setAssignmentNotes ] = useState < string > ( ) ;
82
84
const user = useAppSelector ( selectors . user . loggedInOrNull ) ;
@@ -88,7 +90,7 @@ const AssignGroup = ({groups, board}: AssignGroupProps) => {
88
90
dispatch ( assignGameboard ( { boardId : board ?. id as string , groups : selectedGroups , dueDate, scheduledStartDate, notes : assignmentNotes , userId : user ?. id } ) ) . then ( success => {
89
91
if ( success ) {
90
92
setSelectedGroups ( [ ] ) ;
91
- setDueDate ( undefined ) ;
93
+ setDueDate ( UTC_MIDNIGHT_IN_SIX_DAYS ) ;
92
94
setScheduledStartDate ( undefined ) ;
93
95
setAssignmentNotes ( '' ) ;
94
96
}
@@ -111,7 +113,7 @@ const AssignGroup = ({groups, board}: AssignGroupProps) => {
111
113
}
112
114
113
115
return < Container className = "py-2" >
114
- < Label className = "w-100 pb-2" > Group(s):
116
+ < Label data-testid = "modal-groups-selector" className = "w-100 pb-2" > Group(s):
115
117
< StyledSelect inputId = "groups-to-assign" isMulti isClearable placeholder = "None"
116
118
value = { selectedGroups }
117
119
closeMenuOnSelect = { false }
@@ -127,12 +129,9 @@ const AssignGroup = ({groups, board}: AssignGroupProps) => {
127
129
< Label className = "w-100 pb-2" > Due date reminder
128
130
< DateInput value = { dueDate } placeholder = "Select your due date..." yearRange = { yearRange }
129
131
onChange = { ( e : ChangeEvent < HTMLInputElement > ) => setDueDate ( e . target . valueAsDate as Date ) } /> { /* DANGER here with force-casting Date|null to Date */ }
132
+ { ! dueDate && < small className = { "pt-2 text-danger" } > Since { siteSpecific ( "Jan" , "January" ) } 2025, due dates are required for assignments.</ small > }
130
133
{ dueDateInvalid && < small className = { "pt-2 text-danger" } > Due date must be on or after start date and in the future.</ small > }
131
- { dueDateInvalid && startDateInvalid && < br /> }
132
134
</ Label >
133
- < Alert color = { siteSpecific ( "warning" , "info" ) } className = "py-1 px-2" >
134
- Since { siteSpecific ( "Jan" , "January" ) } 2025, due dates are required for assignments.
135
- </ Alert >
136
135
{ isEventLeaderOrStaff ( user ) && < Label className = "w-100 pb-2" > Notes (optional):
137
136
< Input type = "textarea"
138
137
spellCheck = { true }
@@ -180,10 +179,8 @@ const SetAssignmentsModal = (props: SetAssignmentsModalProps) => {
180
179
}
181
180
}
182
181
183
- const description = siteSpecific (
184
- "Manage assignment of groups to the selected gameboard" ,
185
- "Select a group to which to assign the quiz"
186
- ) ;
182
+ const description = "Scheduled assignments appear to students on the morning of the day chosen, otherwise assignments appear immediately. " +
183
+ "Assignments are due by the end of the day indicated." ;
187
184
188
185
return < Modal isOpen = { isOpen } data-testid = { "set-assignment-modal" } toggle = { toggle } >
189
186
< ModalHeader data-testid = { "modal-header" } role = { "heading" } className = { "text-break d-flex justify-content-between" } close = {
@@ -212,7 +209,7 @@ const SetAssignmentsModal = (props: SetAssignmentsModalProps) => {
212
209
< div className = "py-2" >
213
210
< Label > Pending { siteSpecific ( "assignments" , "quiz assignments" ) } : < span className = "icon-help mx-1" id = { `pending-assignments-help-${ board ?. id } ` } /> </ Label >
214
211
< UncontrolledTooltip placement = "left" autohide = { false } target = { `pending-assignments-help-${ board ?. id } ` } >
215
- { siteSpecific ( "Assignments " , "Quizzes " ) } that are scheduled to begin at a future date. Once the start date passes , students
212
+ These { siteSpecific ( "assignments " , "quizzes " ) } are scheduled to begin at a future date. On the morning of the scheduled date , students
216
213
will be able to see the { siteSpecific ( "assignment" , "quiz" ) } , and will receive a notification email.
217
214
</ UncontrolledTooltip >
218
215
{ scheduledAssignees . length > 0
0 commit comments