From ffadaa44becf1c9e295c6ea42eda3b14f7c9e6fc Mon Sep 17 00:00:00 2001 From: rhpidfyre Date: Tue, 17 Dec 2024 18:31:59 -0500 Subject: [PATCH] web: review buttons are no longer hard-coded for submission id 1 --- .../[submissionId]/_reviewButtons.tsx | 30 ++++++++++++------- .../app/submissions/[submissionId]/page.tsx | 10 +++++-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/web/src/app/submissions/[submissionId]/_reviewButtons.tsx b/web/src/app/submissions/[submissionId]/_reviewButtons.tsx index 05431f4..5493ced 100644 --- a/web/src/app/submissions/[submissionId]/_reviewButtons.tsx +++ b/web/src/app/submissions/[submissionId]/_reviewButtons.tsx @@ -5,11 +5,16 @@ type Action = "completed" | "submit" | "reject" | "revoke" | "trigger-validate" interface ReviewButton { name: Review, action: Action, + submissionId: string, color: ButtonOwnProps["color"] } -function ReviewButtonClicked(action: Action) { - fetch(`http://localhost:3000/v1/submissions/1/status/${action}`, { +interface ReviewId { + submissionId: string +} + +function ReviewButtonClicked(action: Action, submissionId: string) { + fetch(`http://localhost:3000/v1/submissions/${submissionId}/status/${action}`, { method: "POST", headers: { "Content-type": "application/json", @@ -18,19 +23,22 @@ function ReviewButtonClicked(action: Action) { } function ReviewButton(props: ReviewButton) { - return + return } -export default function ReviewButtons() { +export default function ReviewButtons(props: ReviewId) { return (
- - - - - - - + + + + + + +
) } diff --git a/web/src/app/submissions/[submissionId]/page.tsx b/web/src/app/submissions/[submissionId]/page.tsx index 8f52fd6..30b1302 100644 --- a/web/src/app/submissions/[submissionId]/page.tsx +++ b/web/src/app/submissions/[submissionId]/page.tsx @@ -13,6 +13,10 @@ import Link from "next/link"; import "./(styles)/page.scss"; +interface ReviewId { + submissionId: string +} + function Ratings() { return ( @@ -34,14 +38,14 @@ function Ratings() { ) } -function RatingArea() { +function RatingArea(submission: ReviewId) { return ( ) } @@ -71,7 +75,7 @@ export default function SubmissionInfoPage() {
- +