@@ -81,7 +81,7 @@ const AssignmentDetailPage = () => {
8181
8282 } catch ( err :any ) {
8383 setError ( err )
84- const message = Array . isArray ( err ) ? err . map ( ( e ) => `${ e . param } ${ e . msg } ` ) . join ( ', ' ) : err . message
84+ const message = "Submission past due date" // Array.isArray(err) ? err.map((e) => `${e.param} ${e.msg}`).join(', ') : err.message
8585 setAlert ( { autoDelete : false , type : 'error' , message} )
8686 } finally {
8787 setLoading ( false )
@@ -146,6 +146,14 @@ const AssignmentDetailPage = () => {
146146 await fetchData ( )
147147 }
148148 }
149+ const isSubmissionDisabled = ( ) => {
150+ if ( assignment ?. dueDate ) {
151+ const dueDate = new Date ( assignment . dueDate ) ;
152+ const now = new Date ( ) ;
153+ return now > dueDate ;
154+ }
155+ return false ;
156+ } ;
149157
150158
151159 return (
@@ -172,7 +180,7 @@ const AssignmentDetailPage = () => {
172180 < hr className = { styles . line } />
173181 { role . isInstructor ( ) && < button className = { styles . buttons } onClick = { ( ) => {
174182 history . push ( `/course/${ courseId } /assignment/${ assignmentId } /createProblem` )
175- } } > Add Problem </ button > }
183+ } } > Add Assignment Question </ button > }
176184 < hr className = { styles . line } />
177185 { role . isInstructor ( ) && < button className = { styles . buttons } onClick = { ( ) => {
178186 history . push ( `/course/${ courseId } /assignment/${ assignmentId } /update` )
@@ -223,11 +231,16 @@ const AssignmentDetailPage = () => {
223231 </ div >
224232 ) }
225233
226- { ! ( assignment ?. disableHandins ) && ( < input type = "file" className = { styles . fileInput } onChange = { handleFileChange } /> ) }
234+ { ! ( assignment ?. disableHandins ) && ( < input type = "file"
235+ className = { styles . fileInput }
236+ onChange = { handleFileChange } /> ) }
227237
228- { assignmentProblems && assignmentProblems . length > 0 ? (
238+
239+
240+ { ! ( isSubmissionDisabled ( ) ) && assignmentProblems && assignmentProblems . length > 0 ? (
229241 < div className = { styles . submit_container } >
230- < button className = { styles . buttons } onClick = { handleSubmit } > Submit</ button >
242+ < button className = { styles . buttons } onClick = { handleSubmit }
243+ > Submit</ button >
231244 </ div >
232245 ) : null }
233246 </ div >
0 commit comments