This commit is contained in:
parent
9bd3eb69f9
commit
b0b16c91dc
@ -7,9 +7,7 @@ const nextConfig: NextConfig = {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: "/api/:path*",
|
source: "/api/:path*",
|
||||||
destination: "http://localhost:8082/v1/:path*",
|
destination: "http://localhost:8082/v1/:path*"
|
||||||
// source: "/v1/submissions/:submissionid/status/:statustype",
|
|
||||||
// destination: "http://submissions:8082/v1/submissions/:submissionid/status/:statustype"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -6,11 +6,11 @@ type Action = "completed" | "submit" | "reject" | "revoke" | "trigger-validate"
|
|||||||
interface ReviewButton {
|
interface ReviewButton {
|
||||||
name: Review,
|
name: Review,
|
||||||
action: Action,
|
action: Action,
|
||||||
submissionId: string,
|
submissionId: number,
|
||||||
color: ButtonOwnProps["color"]
|
color: ButtonOwnProps["color"]
|
||||||
}
|
}
|
||||||
|
|
||||||
function ReviewButtonClicked(action: Action, submissionId: string) {
|
function ReviewButtonClicked(action: Action, submissionId: number) {
|
||||||
fetch(`/api/submissions/${submissionId}/status/${action}`, {
|
fetch(`/api/submissions/${submissionId}/status/${action}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { SubmissionInfo, SubmissionStatus, SubmissionStatusToString } from "@/app/ts/Submission";
|
import { SubmissionInfo, SubmissionStatusToString } from "@/app/ts/Submission";
|
||||||
import type { CreatorAndReviewStatus } from "./_comments";
|
import type { CreatorAndReviewStatus } from "./_comments";
|
||||||
import { MapImage } from "./_map";
|
import { MapImage } from "./_map";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
@ -42,7 +42,7 @@ function RatingArea(submission: SubmissionInfo) {
|
|||||||
<MapImage/>
|
<MapImage/>
|
||||||
</section>
|
</section>
|
||||||
<Ratings/>
|
<Ratings/>
|
||||||
{ReviewButtons(submission)}
|
{/* TODO: NOT DO!!! */} {ReviewButtons(submission)}
|
||||||
{/* <ReviewButtons submissionId={submission.ID}/> */}
|
{/* <ReviewButtons submissionId={submission.ID}/> */}
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
@ -70,7 +70,7 @@ function TitleAndComments(stats: CreatorAndReviewStatus) {
|
|||||||
export default function SubmissionInfoPage() {
|
export default function SubmissionInfoPage() {
|
||||||
const dynamicId = useParams<{submissionId: string}>()
|
const dynamicId = useParams<{submissionId: string}>()
|
||||||
|
|
||||||
const [submission, setSubmission] = useState(null)
|
const [submission, setSubmission] = useState<SubmissionInfo | null>(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)
|
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() {
|
async function getSubmission() {
|
||||||
@ -79,7 +79,7 @@ export default function SubmissionInfoPage() {
|
|||||||
setSubmission(data)
|
setSubmission(data)
|
||||||
}
|
}
|
||||||
getSubmission()
|
getSubmission()
|
||||||
}, [])
|
}, [dynamicId.submissionId])
|
||||||
|
|
||||||
if (!submission) return (
|
if (!submission) return (
|
||||||
<Webpage>
|
<Webpage>
|
||||||
|
@ -2,7 +2,15 @@ import React from "react";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
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 (
|
return (
|
||||||
<Link href={`/submissions/${id}`}>
|
<Link href={`/submissions/${id}`}>
|
||||||
<div className="submissionCard">
|
<div className="submissionCard">
|
||||||
|
@ -7,9 +7,10 @@ import SubmissionCard from "./_card";
|
|||||||
import SkeletonGrid from './_loading';
|
import SkeletonGrid from './_loading';
|
||||||
|
|
||||||
import "./(styles)/page.scss";
|
import "./(styles)/page.scss";
|
||||||
|
import { SubmissionInfo } from '../ts/Submission';
|
||||||
|
|
||||||
export default function SubmissionInfoPage() {
|
export default function SubmissionInfoPage() {
|
||||||
const [submissions, setSubmissions] = useState(null)
|
const [submissions, setSubmissions] = useState<SubmissionInfo[]>([])
|
||||||
|
|
||||||
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)
|
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() {
|
async function fetchSubmissions() {
|
||||||
@ -45,7 +46,7 @@ export default function SubmissionInfoPage() {
|
|||||||
<Grid key={submission.ID}>
|
<Grid key={submission.ID}>
|
||||||
<SubmissionCard
|
<SubmissionCard
|
||||||
id={submission.ID}
|
id={submission.ID}
|
||||||
assetId={submission.AssetId}
|
assetId={submission.AssetID}
|
||||||
displayName={submission.DisplayName}
|
displayName={submission.DisplayName}
|
||||||
author={submission.Creator}
|
author={submission.Creator}
|
||||||
rating={submission.StatusID}
|
rating={submission.StatusID}
|
||||||
|
@ -2,12 +2,13 @@ import { FormControl, Select, InputLabel, MenuItem } from "@mui/material";
|
|||||||
import { styled } from '@mui/material/styles';
|
import { styled } from '@mui/material/styles';
|
||||||
import InputBase from '@mui/material/InputBase';
|
import InputBase from '@mui/material/InputBase';
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { SelectChangeEvent } from "@mui/material";
|
||||||
|
|
||||||
// TODO: Properly style everything instead of pasting 🤚
|
// TODO: Properly style everything instead of pasting 🤚
|
||||||
|
|
||||||
type GameSelectionProps = {
|
type GameSelectionProps = {
|
||||||
game: string;
|
game: number;
|
||||||
setGame: React.Dispatch<React.SetStateAction<string>>;
|
setGame: React.Dispatch<React.SetStateAction<number>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const BootstrapInput = styled(InputBase)(({ theme }) => ({
|
const BootstrapInput = styled(InputBase)(({ theme }) => ({
|
||||||
@ -44,14 +45,14 @@ const BootstrapInput = styled(InputBase)(({ theme }) => ({
|
|||||||
|
|
||||||
export default function GameSelection({ game, setGame }: GameSelectionProps) {
|
export default function GameSelection({ game, setGame }: GameSelectionProps) {
|
||||||
const handleChange = (event: SelectChangeEvent) => {
|
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 (
|
return (
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<InputLabel sx={{ color: "#646464" }}>Game</InputLabel>
|
<InputLabel sx={{ color: "#646464" }}>Game</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
value={game}
|
value={String(game)}
|
||||||
label="Game"
|
label="Game"
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
input={<BootstrapInput />}
|
input={<BootstrapInput />}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { FormControl, FormLabel, RadioGroup, FormControlLabel, Button, TextField, Checkbox } from "@mui/material"
|
import { FormControl, FormControlLabel, Button, TextField, Checkbox } from "@mui/material"
|
||||||
|
|
||||||
import GameSelection from "./_game";
|
import GameSelection from "./_game";
|
||||||
import SendIcon from '@mui/icons-material/Send';
|
import SendIcon from '@mui/icons-material/Send';
|
||||||
import Webpage from "@/app/_components/webpage"
|
import Webpage from "@/app/_components/webpage"
|
||||||
import Radio from '@mui/material/Radio';
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
import "./(styles)/page.scss"
|
import "./(styles)/page.scss"
|
||||||
@ -16,25 +15,9 @@ interface SubmissionPayload {
|
|||||||
GameID: number;
|
GameID: number;
|
||||||
AssetID: number;
|
AssetID: number;
|
||||||
AssetVersion: number;
|
AssetVersion: number;
|
||||||
Submitter: number;
|
|
||||||
SubmissionType: number;
|
SubmissionType: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum Map {
|
|
||||||
New,
|
|
||||||
Fix,
|
|
||||||
}
|
|
||||||
|
|
||||||
function TargetAsset() {
|
|
||||||
return (<FormControl>
|
|
||||||
<FormLabel id="target-asset-radio">Target:</FormLabel>
|
|
||||||
<RadioGroup defaultValue="New" aria-labelledby="target-asset-radio" name="target-asset-radio">
|
|
||||||
<FormControlLabel value="New" control={<Radio/>} label="New"/>
|
|
||||||
<FormControlLabel value="Fix" control={<Radio/>} label="Fix"/>
|
|
||||||
</RadioGroup>
|
|
||||||
</FormControl>)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function SubmissionInfoPage() {
|
export default function SubmissionInfoPage() {
|
||||||
const [game, setGame] = useState(1);
|
const [game, setGame] = useState(1);
|
||||||
const [isFixingMap, setIsFixingMap] = useState(false);
|
const [isFixingMap, setIsFixingMap] = useState(false);
|
||||||
@ -44,23 +27,14 @@ export default function SubmissionInfoPage() {
|
|||||||
|
|
||||||
const form = event.currentTarget;
|
const form = event.currentTarget;
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
const data = {
|
|
||||||
displayName: formData.get("display-name"),
|
|
||||||
creator: formData.get("creator"),
|
|
||||||
assetId: formData.get("asset-id"),
|
|
||||||
game,
|
|
||||||
isFixingMap,
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
const payload: SubmissionPayload = {
|
const payload: SubmissionPayload = {
|
||||||
DisplayName: data.displayName,
|
DisplayName: (formData.get("display-name") as string) ?? "unknown", // TEMPORARY! TODO: Change
|
||||||
Creator: data.creator,
|
Creator: (formData.get("creator") as string) ?? "unknown", // TEMPORARY! TODO: Change
|
||||||
GameID: 1073741824, // TODO: Change this!!
|
GameID: 1073741824, // TODO: Change this!!
|
||||||
AssetID: Number(data.assetId),
|
AssetID: Number((formData.get("asset-id") as string) ?? "0"),
|
||||||
AssetVersion: 0,
|
AssetVersion: 0,
|
||||||
SubmissionType: 1,
|
SubmissionType: isFixingMap ? 2 : 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(payload)
|
console.log(payload)
|
||||||
|
Loading…
Reference in New Issue
Block a user