diff --git a/web/next.config.ts b/web/next.config.ts index d1565b7..ece2de4 100644 --- a/web/next.config.ts +++ b/web/next.config.ts @@ -7,9 +7,7 @@ const nextConfig: NextConfig = { return [ { source: "/api/:path*", - destination: "http://localhost:8082/v1/:path*", - // source: "/v1/submissions/:submissionid/status/:statustype", - // destination: "http://submissions:8082/v1/submissions/:submissionid/status/:statustype" + destination: "http://localhost:8082/v1/:path*" } ] }, diff --git a/web/src/app/submissions/[submissionId]/_reviewButtons.tsx b/web/src/app/submissions/[submissionId]/_reviewButtons.tsx index 8be6f20..d0bb359 100644 --- a/web/src/app/submissions/[submissionId]/_reviewButtons.tsx +++ b/web/src/app/submissions/[submissionId]/_reviewButtons.tsx @@ -6,11 +6,11 @@ type Action = "completed" | "submit" | "reject" | "revoke" | "trigger-validate" interface ReviewButton { name: Review, action: Action, - submissionId: string, + submissionId: number, color: ButtonOwnProps["color"] } -function ReviewButtonClicked(action: Action, submissionId: string) { +function ReviewButtonClicked(action: Action, submissionId: number) { fetch(`/api/submissions/${submissionId}/status/${action}`, { method: "POST", headers: { diff --git a/web/src/app/submissions/[submissionId]/page.tsx b/web/src/app/submissions/[submissionId]/page.tsx index 9948142..994f041 100644 --- a/web/src/app/submissions/[submissionId]/page.tsx +++ b/web/src/app/submissions/[submissionId]/page.tsx @@ -1,6 +1,6 @@ "use client" -import { SubmissionInfo, SubmissionStatus, SubmissionStatusToString } from "@/app/ts/Submission"; +import { SubmissionInfo, SubmissionStatusToString } from "@/app/ts/Submission"; import type { CreatorAndReviewStatus } from "./_comments"; import { MapImage } from "./_map"; import { useParams } from "next/navigation"; @@ -42,7 +42,7 @@ function RatingArea(submission: SubmissionInfo) { - {ReviewButtons(submission)} + {/* TODO: NOT DO!!! */} {ReviewButtons(submission)} {/* */} ) @@ -70,7 +70,7 @@ function TitleAndComments(stats: CreatorAndReviewStatus) { export default function SubmissionInfoPage() { const dynamicId = useParams<{submissionId: string}>() - const [submission, setSubmission] = useState(null) + const [submission, setSubmission] = useState(null) useEffect(() => { // needs to be client sided since server doesn't have a session, nextjs got mad at me for exporting an async function: (https://nextjs.org/docs/messages/no-async-client-component) async function getSubmission() { @@ -79,7 +79,7 @@ export default function SubmissionInfoPage() { setSubmission(data) } getSubmission() - }, []) + }, [dynamicId.submissionId]) if (!submission) return ( diff --git a/web/src/app/submissions/_card.tsx b/web/src/app/submissions/_card.tsx index 5446573..a58fdb9 100644 --- a/web/src/app/submissions/_card.tsx +++ b/web/src/app/submissions/_card.tsx @@ -2,7 +2,15 @@ import React from "react"; import Image from "next/image"; import Link from "next/link"; -export default function SubmissionCard({ id, displayName, author, rating }) { +interface SubmissionCardProps { + id: number; + assetId: number; + displayName: string; + author: string; + rating: number; +} + +export default function SubmissionCard({ id, displayName, author, rating }: SubmissionCardProps) { return (
diff --git a/web/src/app/submissions/page.tsx b/web/src/app/submissions/page.tsx index 57ba65a..866e2e6 100644 --- a/web/src/app/submissions/page.tsx +++ b/web/src/app/submissions/page.tsx @@ -7,9 +7,10 @@ import SubmissionCard from "./_card"; import SkeletonGrid from './_loading'; import "./(styles)/page.scss"; +import { SubmissionInfo } from '../ts/Submission'; export default function SubmissionInfoPage() { - const [submissions, setSubmissions] = useState(null) + const [submissions, setSubmissions] = useState([]) useEffect(() => { // needs to be client sided since server doesn't have a session, nextjs got mad at me for exporting an async function: (https://nextjs.org/docs/messages/no-async-client-component) async function fetchSubmissions() { @@ -45,7 +46,7 @@ export default function SubmissionInfoPage() { >; + game: number; + setGame: React.Dispatch>; }; const BootstrapInput = styled(InputBase)(({ theme }) => ({ @@ -44,14 +45,14 @@ const BootstrapInput = styled(InputBase)(({ theme }) => ({ export default function GameSelection({ game, setGame }: GameSelectionProps) { const handleChange = (event: SelectChangeEvent) => { - setGame(event.target.value); + setGame(Number(event.target.value)); // TODO: Change later!! there's 100% a proper way of doing this }; return ( Game