@@ -50,22 +50,22 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
5050 setFormData ( prevState => ( { ...prevState , [ key ] : value } ) )
5151 }
5252
53- const handleCategoryChange = ( value : Option < String > ) => {
53+ const handleCategoryChange = ( value : Option < String > ) => {
5454 setFormData ( prevState => ( { ...prevState , categoryName : value . label } ) )
5555 setCurrentCategory ( value )
56- } ;
56+ } ;
5757
58- const handleCategoryCreate = ( value : string ) => {
59- const newOption : Option = { value : value , label : value }
58+ const handleCategoryCreate = ( value : string ) => {
59+ const newOption : Option = { value : value , label : value }
6060 setFormData ( prevState => ( { ...prevState , categoryName : value } ) )
6161 setCurrentCategory ( newOption )
62- } ;
62+ } ;
6363
6464 const handleStartDateChange = ( e : React . ChangeEvent < HTMLInputElement > ) => { setStartDate ( e . target . value ) }
6565 const handleEndDateChange = ( e : React . ChangeEvent < HTMLInputElement > ) => { setEndDate ( e . target . value ) }
66- const handleDueDateChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
67- setDueDate ( e . target . value )
68-
66+ const handleDueDateChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
67+ setDueDate ( e . target . value )
68+
6969 // automatically set end date
7070 if ( ! endDate ) {
7171 setEndDate ( e . target . value )
@@ -119,16 +119,16 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
119119 } )
120120 }
121121
122- useEffect ( ( ) => { RequestService . get ( `/api/course/${ courseId } /assignments` ) . then ( ( res ) => { setAssignments ( res ) } ) } , [ formData ] )
122+ useEffect ( ( ) => { RequestService . get ( `/api/course/${ courseId } /assignments` ) . then ( ( res ) => { setAssignments ( res ) } ) } , [ formData ] )
123123
124124
125125 useEffect ( ( ) => {
126126 const categories = [ ...new Set ( assignments . map ( a => a . categoryName ) ) ] ;
127127 const options = categories . map ( ( category ) => ( {
128128 value : category ,
129129 label : category
130- } ) ) ;
131-
130+ } ) ) ;
131+
132132 setAllCategoryOptions ( options ) ;
133133 } , [ assignments ] )
134134
@@ -137,37 +137,39 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
137137 < div className = "input-group" >
138138 < label htmlFor = "categoryName" className = "input-label" > Assignment Category:</ label >
139139 < TextDropdown
140- onChange = { handleCategoryChange }
141- onCreate = { handleCategoryCreate }
142- options = { categoryOptions }
143- custom = { { control : ( ) => ( { border :'none' , padding :'3px 0' , backgroundColor : 'var(--input-field-background)' } ) ,
144- placeholder : ( ) => ( { color : 'var(--input-field-label)' } ) ,
145- input : ( ) => ( { fontSize : '14px' , backgroundColor : 'var(--input-field-background)' } ) ,
146- option : ( _ , state ) => ( { backgroundColor : state . isFocused ? 'var(--list-item-background-hover)' : 'var(--input-field-background)' , } ) ,
147- menu : ( ) => ( { backgroundColor : 'var(--input-field-background)' , overflow :'hidden' } ) ,
148- singleValue : ( ) => ( { fontSize : '14px' } ) } }
149- value = { currentCategory ?? undefined } />
140+ onChange = { handleCategoryChange }
141+ onCreate = { handleCategoryCreate }
142+ options = { categoryOptions }
143+ custom = { {
144+ control : ( ) => ( { border : 'none' , padding : '3px 0' , backgroundColor : 'var(--input-field-background)' } ) ,
145+ placeholder : ( ) => ( { color : 'var(--input-field-label)' } ) ,
146+ input : ( ) => ( { fontSize : '14px' , backgroundColor : 'var(--input-field-background)' } ) ,
147+ option : ( _ , state ) => ( { backgroundColor : state . isFocused ? 'var(--list-item-background-hover)' : 'var(--input-field-background)' , } ) ,
148+ menu : ( ) => ( { backgroundColor : 'var(--input-field-background)' , overflow : 'hidden' } ) ,
149+ singleValue : ( ) => ( { fontSize : '14px' } )
150+ } }
151+ value = { currentCategory ?? undefined } />
150152 </ div >
151153 < div className = "input-group" >
152154 < label htmlFor = "name" className = "input-label" > Assignment Name:</ label >
153155 < input type = "text" id = "name" onChange = { handleChange } className = { formStyles . input }
154- placeholder = 'e.g. PA3' />
156+ placeholder = 'e.g. PA3' />
155157 </ div >
156158 < div className = "input-group" >
157159 < label htmlFor = "description" className = "input-label" > Description: < span > (optional)</ span > </ label >
158160 < textarea rows = { 4 } id = "description" onChange = { handleChange } className = { formStyles . input }
159- placeholder = 'Provide an optional assignment description' />
161+ placeholder = 'Provide an optional assignment description' />
160162 </ div >
161163 < div className = 'input-subgroup-2col' >
162164 < div className = "input-group" >
163165 < label htmlFor = "maxSubmissions" className = "input-label" > Maximum Submissions:</ label >
164- < input type = "number" id = "maxSubmissions" onChange = { handleChange } className = { formStyles . input }
165- placeholder = 'e.g. 1' value = { formData . maxSubmissions } min = "0" />
166+ < input type = "number" id = "maxSubmissions" onChange = { handleChange } className = { formStyles . input }
167+ placeholder = 'e.g. 1' value = { formData . maxSubmissions } min = "0" />
166168 </ div >
167169 < div className = "input-group" >
168170 < label htmlFor = "maxFileSize" className = "input-label" > Maximum File Size (KB):</ label >
169171 < input type = "number" id = "maxFileSize" onChange = { handleChange } className = { formStyles . input }
170- placeholder = 'e.g. 100' value = { formData . maxFileSize } min = "0" />
172+ placeholder = 'e.g. 100' value = { formData . maxFileSize } min = "0" />
171173 </ div >
172174 </ div >
173175 < div className = { formStyles . datepickerContainer } >
@@ -187,6 +189,11 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
187189 < input type = 'date' id = "end_date" value = { endDate } onChange = { handleEndDateChange } />
188190 </ div >
189191 </ div >
192+ < div className = "input-subgroup-2col" style = { { justifyContent : 'flex-start' } } >
193+ < span > Select submission for final score:</ span >
194+ < label htmlFor = "subRecent" > < input type = "radio" id = "subRecent" name = "submissionChoice" defaultChecked /> Most Recent</ label >
195+ < label htmlFor = "subHighest" > < input type = "radio" id = "subHighest" name = "submissionChoice" /> Highest Score</ label >
196+ </ div >
190197 < label htmlFor = "disableHandins" > Disable Submissions?< input type = "checkbox" id = "disableHandins" /> </ label >
191198 </ Modal >
192199 )
0 commit comments