diff --git a/devU-client/src/components/misc/globalToolbar.scss b/devU-client/src/components/misc/globalToolbar.scss index 88232e0..0ddc42d 100644 --- a/devU-client/src/components/misc/globalToolbar.scss +++ b/devU-client/src/components/misc/globalToolbar.scss @@ -46,10 +46,15 @@ $font-size: 16px; } .bar { - height: 60px; + + height: 80px; background-color: $primary; font-size: 40px; - color: #FFF; + color: #D9D9D9; + font-weight: 550; + + + @extend .flex; justify-content: space-between; } diff --git a/devU-client/src/components/misc/navbar.scss b/devU-client/src/components/misc/navbar.scss index 0c8cf19..9ee712c 100644 --- a/devU-client/src/components/misc/navbar.scss +++ b/devU-client/src/components/misc/navbar.scss @@ -3,14 +3,17 @@ .breadcrumbContainer { display: flex; align-items: center; + margin-left: 3.5rem; + margin-top:10px; + } .link { text-decoration: none; color: $text-color; /* Breadcrumb link color */ - } + .link:hover { text-decoration: underline; } diff --git a/devU-client/src/components/pages/homePage/homePage.scss b/devU-client/src/components/pages/homePage/homePage.scss index 2583909..665af41 100644 --- a/devU-client/src/components/pages/homePage/homePage.scss +++ b/devU-client/src/components/pages/homePage/homePage.scss @@ -1,6 +1,37 @@ @import 'variables'; + +.courses_title { + text-align: left; + margin-left: 20px; + font-size: 30px; + font-weight: 550; + margin-bottom: 30px; +} + +.courses_heading{ + align-items:left; + margin-left: 20px; + font-size: 30px; + font-weight: 550; + margin-bottom: 30px; + +} +// h1 { +// align-items:left; +// margin-left: 20px; +// font-size: 30px; +// font-weight: 550; +// margin-bottom: 30px; +// } + +.no_courses { + margin-left: 20px; +} + + + .coursesContainer { display: flex; flex-direction: row; @@ -36,6 +67,18 @@ align-items: center; } + +.courses_heading::after { + content: ''; + display: block; + margin-top: 10px; + width: 100%; + height: 1px; + font-weight: 600; + background-color: $text-color; + } + + @media (max-width: 768px) { .coursesContainer { flex-direction: column; diff --git a/devU-client/src/components/pages/homePage/homePage.tsx b/devU-client/src/components/pages/homePage/homePage.tsx index 4bb0a1d..44218b2 100644 --- a/devU-client/src/components/pages/homePage/homePage.tsx +++ b/devU-client/src/components/pages/homePage/homePage.tsx @@ -75,7 +75,7 @@ const HomePage = () => {
-

Courses

+

Courses

-

Current

+

Current

@@ -101,12 +101,12 @@ const HomePage = () => {
))} - {enrollCourses.length === 0 &&

You do not have current enrollment yet

} + {enrollCourses.length === 0 &&

You do not have current enrollment yet

}
-

Completed

+

Completed

@@ -122,12 +122,12 @@ const HomePage = () => { /> ))} - {pastCourses.length === 0 &&

No completed courses

} + {pastCourses.length === 0 &&

No completed courses

}
-

Upcoming

+

Upcoming

@@ -137,7 +137,7 @@ const HomePage = () => { ))} - {upcomingCourses.length === 0 &&

No upcoming Courses

} + {upcomingCourses.length === 0 &&

No upcoming Courses

} diff --git a/devU-client/src/components/pages/submissions/submissionDetailPage.scss b/devU-client/src/components/pages/submissions/submissionDetailPage.scss new file mode 100644 index 0000000..3bdc792 --- /dev/null +++ b/devU-client/src/components/pages/submissions/submissionDetailPage.scss @@ -0,0 +1,141 @@ +@import 'variables'; + +.heading { + text-align: center; + margin-left:250px; + +} +.scores { + padding: 20px; + } + + .submissionsLayout { + display: flex; + gap: 50px; + } + + .submissionsContainer { + flex: 1; + max-width: 250px; + padding-right: 10px; + overflow-y: auto; + } + + .submissionCard { + margin-bottom: 15px; + cursor: pointer; + } + + .submissionContent { + flex: 2; + max-height: 800px; + overflow-y: auto; + padding: 0 20px; + background-color: $background; + border: 1px solid #ddd; + color: $text-color; + border-radius: 30px; + padding:30px; + } + + pre { + color: $text-color; + white-space: pre-wrap; + word-wrap: break-word; + font-size: 12px; + } + + .feedbackContainer{ + background-color: $background; + + } + + .scoreDisplay { + + color:$text-color; + + } + +.content_title{ + display: inline-block; + padding: 5px 10px; + background-color: $secondary; + color: $text-color; + border-radius: 5px; + font-size: 1rem; + font-weight: bold; + text-align: left; + margin-bottom: 10px; + margin-top:30px; +} + +.scrollableContent { + max-height: 350px; + overflow-y: auto; + border: 1px solid $background; + padding: 10px; + background-color: $background; + border-radius: 5px; + border: 2px solid $text-color; + padding:0px; +} + p{ + text-align: left; + margin-left: 10px; + } + + .scrollableContent::-webkit-scrollbar { + width: 12px; /* Width of the scrollbar */ + } + + .scrollableContent::-webkit-scrollbar-thumb { + background-color: $purple; + border-radius: 10px; + } + + .scrollableContent::-webkit-scrollbar-track { + background-color: #f0f0f0; + } + + .problemAnswerContainer { + margin-top: 10px; + max-height: 400px; + overflow-y: auto; + padding: 10px; + background-color: $background; + border-radius: 5px; + } + + .assignmentTable { + width: 100%; + border-collapse: collapse; + } + + .assignmentTable th, .assignmentTable td { + + padding: 8px; + text-align: left; + } + + .assignmentTable th { + background-color: $background; + font-weight: bold; + } + + .assignmentTable tr:nth-child(even) { + background-color: $background; + } + + .sub_list{ + text-align: center; + + } + @media (max-width: 768px) { + .submissionsContainer { + display:none; + } + .heading { + margin:10px; + } + +} \ No newline at end of file diff --git a/devU-client/src/components/pages/submissions/submissionDetailPage.tsx b/devU-client/src/components/pages/submissions/submissionDetailPage.tsx index c2bff14..734f513 100644 --- a/devU-client/src/components/pages/submissions/submissionDetailPage.tsx +++ b/devU-client/src/components/pages/submissions/submissionDetailPage.tsx @@ -1,15 +1,20 @@ import React, {useEffect, useState} from 'react' - import PageWrapper from 'components/shared/layouts/pageWrapper' import LoadingOverlay from 'components/shared/loaders/loadingOverlay' import ErrorPage from '../errorPage/errorPage' import RequestService from 'services/request.service' -import {Assignment, AssignmentProblem, Submission, SubmissionProblemScore, SubmissionScore} from 'devu-shared-modules' -import {Link, useParams} from 'react-router-dom' +import {Assignment, AssignmentProblem, Submission, SubmissionProblemScore,SubmissionScore} from 'devu-shared-modules' +import { useParams,/*useHistory*/} from 'react-router-dom' import Button from '../../shared/inputs/button' import TextField from '../../shared/inputs/textField' import {useActionless} from 'redux/hooks' import {SET_ALERT} from 'redux/types/active.types' +import styles from './submissionDetailPage.scss' +import 'react-datepicker/dist/react-datepicker.css' +import Card from '@mui/material/Card' +import CardContent from '@mui/material/CardContent' +import {CardActionArea, Typography} from '@mui/material' +import {prettyPrintDateTime} from "../../../utils/date.utils"; const SubmissionDetailPage = () => { @@ -21,10 +26,11 @@ const SubmissionDetailPage = () => { const { submissionId, assignmentId, courseId } = useParams<{submissionId: string, assignmentId: string, courseId: string}>() const [submissionScore, setSubmissionScore] = useState(null) const [submissionProblemScores, setSubmissionProblemScores] = useState(new Array()) - const [submission, setSubmission] = useState() + const [selectedSubmission, setSelectedSubmission] = useState() + //const [submission, setSubmission] = useState() const [assignmentProblems, setAssignmentProblems] = useState(new Array()) const [assignment, setAssignment] = useState() - + const [submissions, setSubmissions] = useState(new Array()) const [showManualGrade, setToggleManualGrade] = useState(false) const [formData, setFormData] = useState({ submissionId: submissionId, @@ -32,24 +38,34 @@ const SubmissionDetailPage = () => { feedback: '', releasedAt: "2024-10-05T14:48:00.00Z" }) + const fetchData = async () => { try { - const submission = await RequestService.get(`/api/course/${courseId}/assignment/${assignmentId}/submissions/${submissionId}`) - setSubmission(submission) + + //const submission = await RequestService.get(`/api/course/${courseId}/assignment/${assignmentId}/submissions/${submissionId}`) + //setSubmission(submission) const submissionScore = (await RequestService.get(`/api/course/${courseId}/assignment/${assignmentId}/submission-scores?submission=${submissionId}`)).pop() ?? null setSubmissionScore(submissionScore) - + + const selectedSubmission = await RequestService.get(`/api/course/${courseId}/assignment/${assignmentId}/submissions/${submissionId}`); + setSelectedSubmission(selectedSubmission); + const submissionProblemScores = await RequestService.get(`/api/course/${courseId}/assignment/${assignmentId}/submission-problem-scores/submission/${submissionId}`) - setSubmissionProblemScores(submissionProblemScores) + setSubmissionProblemScores(submissionProblemScores) - const assignment = await RequestService.get(`/api/course/${courseId}/assignments/${submission.assignmentId}`) + const assignment = await RequestService.get(`/api/course/${courseId}/assignments/${selectedSubmission.assignmentId}`) setAssignment(assignment) const assignmentProblems = await RequestService.get(`/api/course/${courseId}/assignment/${assignment.id}/assignment-problems`) setAssignmentProblems(assignmentProblems) + const submissionsReq = await RequestService.get(`/api/course/${courseId}/assignment/${assignmentId}/submissions/`) + submissionsReq.sort((a, b) => (Date.parse(b.createdAt ?? '') - Date.parse(a.createdAt ?? ''))) + setSubmissions(submissionsReq) + + } catch (error: any) { setError(error) } finally { @@ -79,6 +95,7 @@ const SubmissionDetailPage = () => { setAlert({ autoDelete: true, type: 'success', message: 'Submission Score Updated' }) }) + } else { // Create a new submission score @@ -90,9 +107,13 @@ const SubmissionDetailPage = () => { } } + + + if (loading) return if (error) return - + //const history = useHistory() + //var submission_form = JSON.parse(submission?.content); return( @@ -104,27 +125,85 @@ const SubmissionDetailPage = () => { )} +
+

Submissions For Assignment {assignment?.name}

+ + +
+ +
+

Submission List:

+ {submissions.map((submission, index) => ( + + + setSelectedSubmission(submission)}> + + {`Submission ${submissions.length - index}`} + {`Submitted at: ${submission.createdAt && prettyPrintDateTime(submission.createdAt)}`} + + + + ))} +
+
+ + + {selectedSubmission ? ( + <> + +
+

{submissionScore ? `Score: ${submissionScore.score}` : "Score: N/A"}

+
-

Submission Detail for {assignment?.name}

-

Submission Grades:

- - {assignmentProblems.map(ap => ( - - ))} - - - {assignmentProblems.map(ap => ( - - ))} - - +
+

Feedback:

+
+
{ap.problemName} ({ap.maxScore})Total Score
{submissionProblemScores.find(sps => sps.assignmentProblemId === ap.id)?.score ?? "N/A"}{submissionScore?.score ?? "N/A"}
+ + + {assignmentProblems.map(ap => ( + + ))} + + + + + + + {assignmentProblems.map(ap => ( + + ))} + + +
{ap.problemName}Total Score
+ {submissionProblemScores.find(sps => sps.assignmentProblemId === ap.id)?.score ?? "N/A"} + {submissionScore?.score ?? "N/A"}
- View - Feedback -
+
+ {submissionScore?.feedback ? ( +

{submissionScore.feedback}

+ ) : ( +

No feedback provided for this submission.

+ )} + {submissionProblemScores.map(sps => ( +
+

Feedback for {assignmentProblems.find(ap => ap.id === sps.assignmentProblemId)?.problemName}:

+
{sps.feedback}
+
+ ))} -

Submission Content:

-
{submission?.content}
+
+

Content

+
+
{selectedSubmission.content}
+
+ + ) : ( +

Select a submission to view its content.

+ )} +
+ +
) }