diff --git a/web/next.config.ts b/web/next.config.ts index cb651cd..6f7f3fe 100644 --- a/web/next.config.ts +++ b/web/next.config.ts @@ -1,5 +1,7 @@ import type { NextConfig } from "next"; -const nextConfig: NextConfig = {}; +const nextConfig: NextConfig = { + distDir: "build" +}; export default nextConfig; diff --git a/web/src/app/_components/webpage.tsx b/web/src/app/_components/webpage.tsx new file mode 100644 index 0000000..c3f2a34 --- /dev/null +++ b/web/src/app/_components/webpage.tsx @@ -0,0 +1,10 @@ +import Header from "./header"; + +export default function Webpage({children}: Readonly<{children?: React.ReactNode}>) { + return ( + <> +
+ {children} + + ) +} \ No newline at end of file diff --git a/web/src/app/layout.tsx b/web/src/app/layout.tsx index 9cd2cd4..d524fd0 100644 --- a/web/src/app/layout.tsx +++ b/web/src/app/layout.tsx @@ -1,8 +1,5 @@ import "./globals.scss"; -interface Component { - -} export default function RootLayout({children}: Readonly<{children: React.ReactNode}>) { return ( diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index c208b1c..f6de7c1 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -1,7 +1,7 @@ -import Header from "./_components/header"; +import Webpage from "./_components/webpage"; export default function Home() { return ( -
+ ); } \ No newline at end of file diff --git a/web/src/app/submissions/[submission_id]/styles/page.scss b/web/src/app/submissions/[submissionId]/(styles)/page.scss similarity index 82% rename from web/src/app/submissions/[submission_id]/styles/page.scss rename to web/src/app/submissions/[submissionId]/(styles)/page.scss index 33dfcca..918b693 100644 --- a/web/src/app/submissions/[submission_id]/styles/page.scss +++ b/web/src/app/submissions/[submissionId]/(styles)/page.scss @@ -7,6 +7,12 @@ @use "../../../globals.scss"; +.map-page-main { + display: flex; + justify-content: center; + width: 100vw; +} + .spacer { display: block; width: 100%; diff --git a/web/src/app/submissions/[submission_id]/styles/page/comments.scss b/web/src/app/submissions/[submissionId]/(styles)/page/comments.scss similarity index 100% rename from web/src/app/submissions/[submission_id]/styles/page/comments.scss rename to web/src/app/submissions/[submissionId]/(styles)/page/comments.scss diff --git a/web/src/app/submissions/[submission_id]/styles/page/leave_comment_window.scss b/web/src/app/submissions/[submissionId]/(styles)/page/leave_comment_window.scss similarity index 100% rename from web/src/app/submissions/[submission_id]/styles/page/leave_comment_window.scss rename to web/src/app/submissions/[submissionId]/(styles)/page/leave_comment_window.scss diff --git a/web/src/app/submissions/[submission_id]/styles/page/map.scss b/web/src/app/submissions/[submissionId]/(styles)/page/map.scss similarity index 100% rename from web/src/app/submissions/[submission_id]/styles/page/map.scss rename to web/src/app/submissions/[submissionId]/(styles)/page/map.scss diff --git a/web/src/app/submissions/[submission_id]/styles/page/rating_window.scss b/web/src/app/submissions/[submissionId]/(styles)/page/rating_window.scss similarity index 100% rename from web/src/app/submissions/[submission_id]/styles/page/rating_window.scss rename to web/src/app/submissions/[submissionId]/(styles)/page/rating_window.scss diff --git a/web/src/app/submissions/[submission_id]/styles/page/review.scss b/web/src/app/submissions/[submissionId]/(styles)/page/review.scss similarity index 100% rename from web/src/app/submissions/[submission_id]/styles/page/review.scss rename to web/src/app/submissions/[submissionId]/(styles)/page/review.scss diff --git a/web/src/app/submissions/[submission_id]/styles/page/review_status.scss b/web/src/app/submissions/[submissionId]/(styles)/page/review_status.scss similarity index 100% rename from web/src/app/submissions/[submission_id]/styles/page/review_status.scss rename to web/src/app/submissions/[submissionId]/(styles)/page/review_status.scss diff --git a/web/src/app/submissions/[submission_id]/map.tsx b/web/src/app/submissions/[submissionId]/_map.tsx similarity index 97% rename from web/src/app/submissions/[submission_id]/map.tsx rename to web/src/app/submissions/[submissionId]/_map.tsx index 9393d9a..80fc925 100644 --- a/web/src/app/submissions/[submission_id]/map.tsx +++ b/web/src/app/submissions/[submissionId]/_map.tsx @@ -13,7 +13,7 @@ function MapImage(asset: AssetID) { useEffect(() => { AssetImage(asset.id, "420x420").then(image => setAssetImage(image)) - }, []); + }, [asset.id]); if (!assetImage) { return

Fetching map image...

; } diff --git a/web/src/app/submissions/[submission_id]/page.tsx b/web/src/app/submissions/[submissionId]/page.tsx similarity index 67% rename from web/src/app/submissions/[submission_id]/page.tsx rename to web/src/app/submissions/[submissionId]/page.tsx index f2799aa..226cbb4 100644 --- a/web/src/app/submissions/[submission_id]/page.tsx +++ b/web/src/app/submissions/[submissionId]/page.tsx @@ -1,18 +1,20 @@ -"use client" +'use client' import { SubmissionStatus, SubmissionStatusToString, type SubmissionInfo } from "@/app/ts/Submission"; -import { MapImage, type AssetID } from "./map"; +import { MapImage, type AssetID } from "./_map"; import { Rating, Button } from "@mui/material"; -import type {ReactNode} from "react"; import SendIcon from '@mui/icons-material/Send'; +import Webpage from "@/app/_components/webpage"; +import { useParams } from "next/navigation"; +import Image from "next/image"; import Link from "next/link"; -import "./styles/page.scss"; +import "./(styles)/page.scss"; interface Window { className: string, title: string, - children: ReactNode + children: React.ReactNode } interface Comment { picture?: string, //TEMP @@ -23,12 +25,8 @@ interface Comment { interface CreatorAndReviewStatus { creator: SubmissionInfo["DisplayName"], review: SubmissionInfo["StatusID"], - comments: Comment[] -} -interface MapInfo { - assetid: SubmissionInfo["AssetID"], - status: SubmissionStatus, - comments: Comment[] + comments: Comment[], + name: string } function Window(window: Window) { @@ -73,7 +71,7 @@ function Comment(comment: Comment) { return (
- {`${comment.name}'s + {`${comment.name}'s

{comment.name}

@@ -91,7 +89,7 @@ function TitleAndComments(stats: CreatorAndReviewStatus) { return (
-

bhop_quaternions

+

{stats.name}

@@ -99,7 +97,9 @@ function TitleAndComments(stats: CreatorAndReviewStatus) {

by {stats.creator}

- {stats.comments.length===0 &&

There are no comments.

|| stats.comments.map(comment => ( + {stats.comments.length===0 + &&

There are no comments.

+ || stats.comments.map(comment => ( ))}
@@ -111,11 +111,35 @@ function TitleAndComments(stats: CreatorAndReviewStatus) { ) } -export default function MapInfoPage(info: MapInfo) { - return ( -
- - -
+// const placeholder_Comments = [ +// { +// comment: "This map has been accepted and is in the game.", +// date: "on Dec 8 '24 at 18:46", +// name: "BhopMaptest" +// }, +// { +// comment: "This map is so mid...", +// date: "on Dec 8 '24 at 18:46", +// name: "vmsize" +// }, +// { +// comment: "I prefer strafe client", +// date: "on Dec 8 '24 at 18:46", +// name: "Quaternions" +// } +// ] + +export default function SubmissionInfoPage() { + const params = useParams<{submissionId: string}>() + + return ( + +
+
+ + +
+
+
) } \ No newline at end of file diff --git a/web/src/app/submissions/[submission_id]/layout.tsx b/web/src/app/submissions/[submission_id]/layout.tsx deleted file mode 100644 index b08281d..0000000 --- a/web/src/app/submissions/[submission_id]/layout.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { SubmissionStatus } from "@/app/ts/Submission"; -import MapInfoPage from "./page"; -import Header from "@/app/_components/header"; - -import "./styles/layout.scss"; - -export default function MapPage() { - // const placeholder_Comments = [ - // { - // comment: "This map has been accepted and is in the game.", - // date: "on Dec 8 '24 at 18:46", - // name: "BhopMaptest" - // }, - // { - // comment: "This map is so mid...", - // date: "on Dec 8 '24 at 18:46", - // name: "vmsize" - // }, - // { - // comment: "I prefer strafe client", - // date: "on Dec 8 '24 at 18:46", - // name: "Quaternions" - // } - // ] - - return ( - <> -
-
- -
- - ) -} \ No newline at end of file diff --git a/web/src/app/submissions/[submission_id]/styles/layout.scss b/web/src/app/submissions/[submission_id]/styles/layout.scss deleted file mode 100644 index bcdb4bb..0000000 --- a/web/src/app/submissions/[submission_id]/styles/layout.scss +++ /dev/null @@ -1,5 +0,0 @@ -.map-page-main { - display: flex; - justify-content: center; - width: 100vw; -} \ No newline at end of file diff --git a/web/src/app/ts/Roblox.ts b/web/src/app/ts/Roblox.ts index 0551f8a..bdc9304 100644 --- a/web/src/app/ts/Roblox.ts +++ b/web/src/app/ts/Roblox.ts @@ -2,8 +2,17 @@ const FALLBACK_IMAGE = "" type thumbsizes = "420" | "720" type thumbsize = `${S}x${S}` +type ParsedJson = { + errors: A, + data: { + [0]: { + state: string, + imageUrl: string, + } + } +} -function Parse(json: any): string { +function Parse(json: ParsedJson): string { if (json.errors) { console.warn(json.errors) return FALLBACK_IMAGE diff --git a/web/tsconfig.json b/web/tsconfig.json index d0a9bc2..47909a7 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "ES2017", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -20,9 +24,19 @@ } ], "paths": { - "@/*": ["./src/*"] + "@/*": [ + "./src/*" + ] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "include": [ + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + "next-env.d.ts", + "build/types/**/*.ts" + ], + "exclude": [ + "node_modules" + ] }