Skip to content

feat: implemented submission review system - #19

Merged
R3Nexe merged 2 commits into
sky-ruler:mainfrom
R3Nexe:feat/review-work-overhaul
May 9, 2026
Merged

feat: implemented submission review system#19
R3Nexe merged 2 commits into
sky-ruler:mainfrom
R3Nexe:feat/review-work-overhaul

Conversation

@R3Nexe

@R3Nexe R3Nexe commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Overview

This PR implements a full‑cycle admin/​clan‑chief review system for user code submissions, making the workflow accessible to admins, super‑admins, and clan‑chiefs. It adds review metadata, UI enhancements, and the ability for reviewers to provide feedback and for users to see that feedback and retry challenges.


Backend Changes

File Change
server/models/Submission.js Added reviewComment (String), reviewedBy (ObjectId → User), reviewedAt (Date) fields to store reviewer feedback and audit data.
server/validators/submissionSchemas.js Updated submissionUpdateSchema → reviewComment now requires a minimum length of 1 (.min(1, { message: 'Comment cannot be empty' })), preventing empty comments on rejection.
server/controllers/SubmissionController.js getSubmissionById now populates reviewedBy (username & role).
updateSubmissionStatus persists status, reviewComment, reviewedBy, and reviewedAt; validates reviewer role via existing chiefOrAdmin middleware.
server/routes/submissionRoutes.js No changes needed – the existing chiefOrAdmin middleware already allows admin, super-admin, and clan-chief.

Result: The API can now record who reviewed a submission, when, and any rejection comments.


Front‑end – Admin / Clan‑Chief Review Flow

File Change
client/src/pages/AdminPanel.jsx Imported Link. Challenge titles in the Review Work tab are now clickable <Link>s that navigate to /challenge/:challengeId?review=:submissionId.
client/src/pages/ClanChiefPanel.jsx Same clickable links added, mirroring AdminPanel behavior.
client/src/pages/ChallengeDetails.jsx • Added useSearchParams & useAuth to detect review mode (?review=) and verify reviewer role.
• When in review mode:
 - Fetches the submission, pre‑loads its code, makes the editor read‑only.
 - Shows a “Review Mode” badge.
 - Replaces the normal submit panel with a review panel (accept / reject buttons, optional comment textarea).
 - Handles grading via PUT /api/submissions/:id including reviewComment when rejecting.
client/src/pages/Dashboard.jsx Added FiMessageSquare import and a “Feedback” badge next to the status for rejected submissions that contain a review comment, making it obvious in Recent Activity that feedback exists.

Result: Reviewers can click a submission, view the submitted code in a read‑only editor, and accept or reject it with optional feedback—all from the same UI used for solving challenges.


Front‑end – User Feedback View

File Change
client/src/pages/SubmissionDetails.jsx Complete redesign:
Left panel – read‑only CodeMirror showing the submitted code.
Right panel – reviewer feedback card (if rejected with comment), status‑specific cards, challenge info, and a “Retry Challenge” button for rejected submissions.
client/src/pages/SubmissionDetails.jsx (new components) StatusBadge, color‑coded status display, and a reviewer info block.
client/src/pages/SubmissionDetails.jsx (styles) Applied premium glass‑morphism, subtle gradients, and micro‑animations consistent with the app’s visual language.

Result: Users can instantly see reviewer comments, understand the submission status, and retry the challenge directly from the details page.


How to Test

  1. Create a submission as a normal user.
  2. Log in as admin / clan‑chief and go to Admin Panel → Review Work. Click the challenge title.
  3. Verify the code loads read‑only, accept or reject with optional comment.
  4. Switch back to the user and open Dashboard → Recent Activity → click the submission to view SubmissionDetails.
  5. Confirm the feedback card appears (if rejected) and the “Retry Challenge” button works.

@vercel

vercel Bot commented May 9, 2026

Copy link
Copy Markdown

@R3Nexe is attempting to deploy a commit to the Sky Ruler's projects Team on Vercel.

A member of the Team first needs to authorize it.

@R3Nexe
R3Nexe merged commit a5c9fe9 into sky-ruler:main May 9, 2026
1 of 3 checks passed
R3Nexe referenced this pull request in R3Nexe/Algorithm-Arena-V2 Jun 12, 2026
feat: implemented submission review system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant