diff --git a/web/src/app/_components/mapCard.tsx b/web/src/app/_components/mapCard.tsx
index e328689..79ee73a 100644
--- a/web/src/app/_components/mapCard.tsx
+++ b/web/src/app/_components/mapCard.tsx
@@ -4,6 +4,7 @@ import {StatusChip} from "@/app/_components/statusChip";
import {Link} from "react-router-dom";
import {useAssetThumbnail, useUserThumbnail} from "@/app/hooks/useThumbnails";
import {useUsername} from "@/app/hooks/useUsername";
+import { getGameName } from "@/app/utils/games";
interface MapCardProps {
displayName: string;
@@ -120,7 +121,7 @@ export function MapCard(props: MapCardProps) {
- {props.gameID === 1 ? 'Bhop' : props.gameID === 2 ? 'Surf' : props.gameID === 5 ? 'Fly Trials' : props.gameID === 4 ? 'Deathrun' : 'Unknown'}
+ {getGameName(props.gameID)}
diff --git a/web/src/app/_components/review/ReviewItem.tsx b/web/src/app/_components/review/ReviewItem.tsx
index da446f0..19e1ee4 100644
--- a/web/src/app/_components/review/ReviewItem.tsx
+++ b/web/src/app/_components/review/ReviewItem.tsx
@@ -4,6 +4,7 @@ import { CopyableField } from "@/app/_components/review/CopyableField";
import WorkflowStepper from "./WorkflowStepper";
import { SubmissionInfo } from "@/app/ts/Submission";
import { MapfixInfo } from "@/app/ts/Mapfix";
+import { getGameName } from "@/app/utils/games";
// Define a field configuration for specific types
interface FieldConfig {
@@ -76,6 +77,14 @@ export function ReviewItem({
);
})}
+
+
+ Game
+
+
+ {getGameName(item.GameID)}
+
+
{/* Description Section */}
diff --git a/web/src/app/maps/[mapId]/fix/page.tsx b/web/src/app/maps/[mapId]/fix/page.tsx
index 3d85f6a..1d00c3e 100644
--- a/web/src/app/maps/[mapId]/fix/page.tsx
+++ b/web/src/app/maps/[mapId]/fix/page.tsx
@@ -17,6 +17,7 @@ import Webpage from "@/app/_components/webpage";
import { useParams, Link, useNavigate } from "react-router-dom";
import {MapInfo} from "@/app/ts/Map";
import {useTitle} from "@/app/hooks/useTitle";
+import { getGameName } from "@/app/utils/games";
interface MapfixPayload {
AssetID: number;
@@ -24,13 +25,6 @@ interface MapfixPayload {
Description: string;
}
-// Game ID mapping
-const gameTypes: Record = {
- 1: "Bhop",
- 2: "Surf",
- 5: "Flytrials"
-};
-
export default function MapfixInfoPage() {
const { mapId } = useParams<{ mapId: string }>();
const navigate = useNavigate();
@@ -67,12 +61,6 @@ export default function MapfixInfoPage() {
}
}, [mapId]);
- // Get game type from game ID
- const getGameType = (gameId: number | undefined): string => {
- if (!gameId) return "Unknown";
- return gameTypes[gameId] || "Unknown";
- };
-
const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
setIsSubmitting(true);
@@ -199,7 +187,7 @@ export default function MapfixInfoPage() {
label="Game Type"
variant="outlined"
fullWidth
- value={getGameType(mapDetails?.GameID)}
+ value={mapDetails?.GameID ? getGameName(mapDetails.GameID) : "Unknown"}
disabled
/>
diff --git a/web/src/app/maps/[mapId]/page.tsx b/web/src/app/maps/[mapId]/page.tsx
index 935b0fe..ad93bca 100644
--- a/web/src/app/maps/[mapId]/page.tsx
+++ b/web/src/app/maps/[mapId]/page.tsx
@@ -7,6 +7,7 @@ import { Snackbar, Alert } from "@mui/material";
import { MapfixStatus, type MapfixInfo, getMapfixStatusInfo } from "@/app/ts/Mapfix";
import LaunchIcon from '@mui/icons-material/Launch';
import { useAssetThumbnail } from "@/app/hooks/useThumbnails";
+import { getGameInfo } from "@/app/utils/games";
// MUI Components
import {
@@ -138,31 +139,6 @@ export default function MapDetails() {
});
};
- const getGameInfo = (gameId: number) => {
- switch (gameId) {
- case 1:
- return {
- name: "Bhop",
- color: "#2196f3" // blue
- };
- case 2:
- return {
- name: "Surf",
- color: "#4caf50" // green
- };
- case 5:
- return {
- name: "Fly Trials",
- color: "#ff9800" // orange
- };
- default:
- return {
- name: "Unknown",
- color: "#9e9e9e" // gray
- };
- }
- };
-
const getStatusIcon = (iconName: string) => {
switch (iconName) {
case "Build": return BuildIcon;
diff --git a/web/src/app/maps/page.tsx b/web/src/app/maps/page.tsx
index 8cd1eaf..6e7ba12 100644
--- a/web/src/app/maps/page.tsx
+++ b/web/src/app/maps/page.tsx
@@ -25,6 +25,7 @@ import { Link } from "react-router-dom";
import NavigateNextIcon from "@mui/icons-material/NavigateNext";
import {useTitle} from "@/app/hooks/useTitle";
import {usePrefetchThumbnails, useAssetThumbnail} from "@/app/hooks/useThumbnails";
+import { getGameName, getGameLabelStyles } from "@/app/utils/games";
interface Map {
ID: number;
@@ -37,14 +38,9 @@ interface Map {
interface MapCardProps {
map: Map;
formatDate: (timestamp: number) => string;
- getGameName: (gameId: number) => string;
- getGameLabelStyles: (gameId: number) => {
- bgcolor: string;
- color: string;
- };
}
-function MapCard({ map, formatDate, getGameName, getGameLabelStyles }: MapCardProps) {
+function MapCard({ map, formatDate }: MapCardProps) {
const { thumbnailUrl, isLoading } = useAssetThumbnail(map.ID, '420x420');
return (
@@ -205,44 +201,6 @@ export default function MapsPage() {
});
};
- const getGameName = (gameId: number) => {
- switch (gameId) {
- case 1:
- return "Bhop";
- case 2:
- return "Surf";
- case 5:
- return "Fly Trials";
- default:
- return "Unknown";
- }
- };
-
- const getGameLabelStyles = (gameId: number) => {
- switch (gameId) {
- case 1: // Bhop
- return {
- bgcolor: "info.main",
- color: "white",
- };
- case 2: // Surf
- return {
- bgcolor: "success.main",
- color: "white",
- };
- case 5: // Fly Trials
- return {
- bgcolor: "warning.main",
- color: "white",
- };
- default: // Unknown
- return {
- bgcolor: "grey.500",
- color: "white",
- };
- }
- };
-
return (
@@ -334,8 +292,6 @@ export default function MapsPage() {
))}
diff --git a/web/src/app/utils/games.ts b/web/src/app/utils/games.ts
new file mode 100644
index 0000000..729b42b
--- /dev/null
+++ b/web/src/app/utils/games.ts
@@ -0,0 +1,62 @@
+export function getGameName(gameId: number): string {
+ switch (gameId) {
+ case 1:
+ return "Bhop";
+ case 2:
+ return "Surf";
+ case 5:
+ return "Fly Trials";
+ default:
+ return "Unknown";
+ }
+}
+
+export function getGameInfo(gameId: number) {
+ switch (gameId) {
+ case 1:
+ return {
+ name: "Bhop",
+ color: "#2196f3" // blue
+ };
+ case 2:
+ return {
+ name: "Surf",
+ color: "#4caf50" // green
+ };
+ case 5:
+ return {
+ name: "Fly Trials",
+ color: "#ff9800" // orange
+ };
+ default:
+ return {
+ name: "Unknown",
+ color: "#9e9e9e" // gray
+ };
+ }
+}
+
+export function getGameLabelStyles(gameId: number) {
+ switch (gameId) {
+ case 1: // Bhop
+ return {
+ bgcolor: "info.main",
+ color: "white",
+ };
+ case 2: // Surf
+ return {
+ bgcolor: "success.main",
+ color: "white",
+ };
+ case 5: // Fly Trials
+ return {
+ bgcolor: "warning.main",
+ color: "white",
+ };
+ default: // Unknown
+ return {
+ bgcolor: "grey.500",
+ color: "white",
+ };
+ }
+}