From 1bfddafde40144647f90b6dde5da5766a918b4be Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Thu, 30 Apr 2026 20:40:45 +0800 Subject: [PATCH] feat: add anti-cheat awareness step to benchmark wizard --- app/game/[id]/submit/page.tsx | 14 ++- components/wizard/game-entry-wizard.tsx | 40 ++++++--- components/wizard/steps/anti-cheat-step.tsx | 96 +++++++++++++++++++++ components/wizard/steps/index.ts | 1 + 4 files changed, 138 insertions(+), 13 deletions(-) create mode 100644 components/wizard/steps/anti-cheat-step.tsx diff --git a/app/game/[id]/submit/page.tsx b/app/game/[id]/submit/page.tsx index 1bdc3b2..5b16f16 100644 --- a/app/game/[id]/submit/page.tsx +++ b/app/game/[id]/submit/page.tsx @@ -1,6 +1,6 @@ import { notFound } from "next/navigation" import { db } from "@/lib/db/index" -import { games, gameVersions, performanceEntries } from "@/lib/db/schema" +import { games, gameVersions, performanceEntries, gamePlatformSupport } from "@/lib/db/schema" import { eq, sql } from "drizzle-orm" import { GameEntryWizard } from "@/components/wizard/game-entry-wizard" @@ -68,6 +68,17 @@ export default async function SubmitBenchmarkPage({ .returning() } + // Fetch platform support for anti-cheat awareness + const platformSupport = await db + .select({ + hardwareSlug: gamePlatformSupport.hardwareSlug, + antiCheatRelevant: gamePlatformSupport.antiCheatRelevant, + antiCheatName: gamePlatformSupport.antiCheatName, + antiCheatStatus: gamePlatformSupport.antiCheatStatus, + }) + .from(gamePlatformSupport) + .where(eq(gamePlatformSupport.gameId, game.id)) + // If editing, fetch the existing performance entry let editEntry = null if (edit) { @@ -95,6 +106,7 @@ export default async function SubmitBenchmarkPage({ gameId={game.id} gameVersionId={version.id} editEntry={editEntry} + platformSupport={platformSupport} /> ) diff --git a/components/wizard/game-entry-wizard.tsx b/components/wizard/game-entry-wizard.tsx index dc52a2f..5b03eca 100644 --- a/components/wizard/game-entry-wizard.tsx +++ b/components/wizard/game-entry-wizard.tsx @@ -5,6 +5,7 @@ import { useRouter } from "next/navigation" import { motion, AnimatePresence } from "motion/react" import { StepIndicator } from "@/components/wizard/step-indicator" import { HardwareStep } from "@/components/wizard/steps/hardware-step" +import { AntiCheatStep } from "@/components/wizard/steps/anti-cheat-step" import { PerformanceStep, type PerformanceData } from "@/components/wizard/steps/performance-step" import { SettingsStep } from "@/components/wizard/steps/settings-step" import { EnvironmentStep, type EnvironmentData } from "@/components/wizard/steps/environment-step" @@ -14,19 +15,28 @@ import { performanceEntries } from "@/lib/db/schema" const STEPS = [ { label: "Hardware", tooltip: "Choose the hardware you tested this game on" }, + { label: "Anti-Cheat", tooltip: "Review anti-cheat compatibility for your selected hardware" }, { label: "Performance", tooltip: "Enter the performance metrics you observed. FPS Average is required." }, { label: "Settings", tooltip: "Configure the game settings you used. Add categories and settings to help others replicate your setup." }, { label: "Environment", tooltip: "Specify the software environment and any launch options used" }, { label: "Review", tooltip: "Review your entry before submitting. Add any additional notes." }, ] +interface PlatformSupportEntry { + hardwareSlug: string + antiCheatRelevant: boolean + antiCheatStatus: "none" | "supported" | "unsupported" | "unknown" + antiCheatName: string | null +} + interface GameEntryWizardProps { gameId: string gameVersionId: string editEntry?: typeof performanceEntries.$inferSelect | null + platformSupport: PlatformSupportEntry[] } -export function GameEntryWizard({ gameId, gameVersionId, editEntry }: GameEntryWizardProps) { +export function GameEntryWizard({ gameId, gameVersionId, editEntry, platformSupport }: GameEntryWizardProps) { const router = useRouter() const [currentStep, setCurrentStep] = useState(0) const [isSubmitting, setIsSubmitting] = useState(false) @@ -37,7 +47,8 @@ export function GameEntryWizard({ gameId, gameVersionId, editEntry }: GameEntryW const [hardwareSlug, setHardwareSlug] = useState(editEntry?.hardwareSlug ?? "") const [hardwareName, setHardwareName] = useState("") - // Step 2: Performance + // Step 2: Anti-Cheat (informational) + // Step 3: Performance const [performance, setPerformance] = useState( editEntry ? { @@ -51,12 +62,12 @@ export function GameEntryWizard({ gameId, gameVersionId, editEntry }: GameEntryW : {}, ) - // Step 3: Settings + // Step 4: Settings const [settingsJson, setSettingsJson] = useState( editEntry?.settingsJson ?? [], ) - // Step 4: Environment + // Step 5: Environment const [environment, setEnvironment] = useState( editEntry ? { @@ -75,7 +86,7 @@ export function GameEntryWizard({ gameId, gameVersionId, editEntry }: GameEntryW }, ) - // Step 5: Notes + // Step 6: Notes const [userNotes, setUserNotes] = useState(editEntry?.userNotes ?? "") // Fetch hardware name when slug changes @@ -122,12 +133,14 @@ export function GameEntryWizard({ gameId, gameVersionId, editEntry }: GameEntryW case 0: return hardwareSlug !== "" case 1: - return performance.fpsAvg !== undefined && performance.fpsAvg > 0 + return true // Anti-cheat is informational case 2: - return true // Settings are optional + return performance.fpsAvg !== undefined && performance.fpsAvg > 0 case 3: - return true // Environment is optional + return true // Settings are optional case 4: + return true // Environment is optional + case 5: return true default: return false @@ -250,15 +263,18 @@ export function GameEntryWizard({ gameId, gameVersionId, editEntry }: GameEntryW )} {currentStep === 1 && ( - + )} {currentStep === 2 && ( - + )} {currentStep === 3 && ( - + )} {currentStep === 4 && ( + + )} + {currentStep === 5 && ( {/* Navigation Buttons */} - {currentStep < 4 && ( + {currentStep < 5 && (