From ad02c8d11cd3dcc8341b43d71a3babdb2111193d Mon Sep 17 00:00:00 2001 From: yessicaq Date: Tue, 12 Nov 2024 15:11:54 -0500 Subject: [PATCH] removing the submit button from assignments that are past the due date --- .../assignments/assignmentDetailPage.tsx | 23 +++++++++++++++---- .../pages/courses/courseDetailPage.tsx | 4 ++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/devU-client/src/components/pages/assignments/assignmentDetailPage.tsx b/devU-client/src/components/pages/assignments/assignmentDetailPage.tsx index 0851117..2655a2c 100644 --- a/devU-client/src/components/pages/assignments/assignmentDetailPage.tsx +++ b/devU-client/src/components/pages/assignments/assignmentDetailPage.tsx @@ -81,7 +81,7 @@ const AssignmentDetailPage = () => { } catch (err:any) { setError(err) - const message = Array.isArray(err) ? err.map((e) => `${e.param} ${e.msg}`).join(', ') : err.message + const message = "Submission past due date"//Array.isArray(err) ? err.map((e) => `${e.param} ${e.msg}`).join(', ') : err.message setAlert({autoDelete: false, type: 'error', message}) } finally { setLoading(false) @@ -146,6 +146,14 @@ const AssignmentDetailPage = () => { await fetchData() } } + const isSubmissionDisabled = () => { + if (assignment?.dueDate) { + const dueDate = new Date(assignment.dueDate); + const now = new Date(); + return now > dueDate; + } + return false; + }; return( @@ -172,7 +180,7 @@ const AssignmentDetailPage = () => {
{role.isInstructor() && } + }}>Add Assignment Question}
{role.isInstructor() && + ) : null} diff --git a/devU-client/src/components/pages/courses/courseDetailPage.tsx b/devU-client/src/components/pages/courses/courseDetailPage.tsx index 7610f9d..9d88a37 100644 --- a/devU-client/src/components/pages/courses/courseDetailPage.tsx +++ b/devU-client/src/components/pages/courses/courseDetailPage.tsx @@ -99,8 +99,8 @@ const CourseDetailPage = () => {
-

CSE{courseInfo.number}: {courseInfo.name} ({courseInfo.semester})

-

Instructor:

+

{courseInfo.number}: {courseInfo.name} ({courseInfo.semester})

+

Section: