@@ -50,22 +50,22 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
50
50
setFormData ( prevState => ( { ...prevState , [ key ] : value } ) )
51
51
}
52
52
53
- const handleCategoryChange = ( value : Option < String > ) => {
53
+ const handleCategoryChange = ( value : Option < String > ) => {
54
54
setFormData ( prevState => ( { ...prevState , categoryName : value . label } ) )
55
55
setCurrentCategory ( value )
56
- } ;
56
+ } ;
57
57
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 }
60
60
setFormData ( prevState => ( { ...prevState , categoryName : value } ) )
61
61
setCurrentCategory ( newOption )
62
- } ;
62
+ } ;
63
63
64
64
const handleStartDateChange = ( e : React . ChangeEvent < HTMLInputElement > ) => { setStartDate ( e . target . value ) }
65
65
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
+
69
69
// automatically set end date
70
70
if ( ! endDate ) {
71
71
setEndDate ( e . target . value )
@@ -119,16 +119,16 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
119
119
} )
120
120
}
121
121
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 ] )
123
123
124
124
125
125
useEffect ( ( ) => {
126
126
const categories = [ ...new Set ( assignments . map ( a => a . categoryName ) ) ] ;
127
127
const options = categories . map ( ( category ) => ( {
128
128
value : category ,
129
129
label : category
130
- } ) ) ;
131
-
130
+ } ) ) ;
131
+
132
132
setAllCategoryOptions ( options ) ;
133
133
} , [ assignments ] )
134
134
@@ -137,37 +137,39 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
137
137
< div className = "input-group" >
138
138
< label htmlFor = "categoryName" className = "input-label" > Assignment Category:</ label >
139
139
< 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 } />
150
152
</ div >
151
153
< div className = "input-group" >
152
154
< label htmlFor = "name" className = "input-label" > Assignment Name:</ label >
153
155
< input type = "text" id = "name" onChange = { handleChange } className = { formStyles . input }
154
- placeholder = 'e.g. PA3' />
156
+ placeholder = 'e.g. PA3' />
155
157
</ div >
156
158
< div className = "input-group" >
157
159
< label htmlFor = "description" className = "input-label" > Description: < span > (optional)</ span > </ label >
158
160
< textarea rows = { 4 } id = "description" onChange = { handleChange } className = { formStyles . input }
159
- placeholder = 'Provide an optional assignment description' />
161
+ placeholder = 'Provide an optional assignment description' />
160
162
</ div >
161
163
< div className = 'input-subgroup-2col' >
162
164
< div className = "input-group" >
163
165
< 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" />
166
168
</ div >
167
169
< div className = "input-group" >
168
170
< label htmlFor = "maxFileSize" className = "input-label" > Maximum File Size (KB):</ label >
169
171
< 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" />
171
173
</ div >
172
174
</ div >
173
175
< div className = { formStyles . datepickerContainer } >
@@ -187,6 +189,11 @@ const AddAssignmentModal = ({ open, onClose }: Props) => {
187
189
< input type = 'date' id = "end_date" value = { endDate } onChange = { handleEndDateChange } />
188
190
</ div >
189
191
</ 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 >
190
197
< label htmlFor = "disableHandins" > Disable Submissions?< input type = "checkbox" id = "disableHandins" /> </ label >
191
198
</ Modal >
192
199
)
0 commit comments