From bb45599fe9c4ab6ddeb46da31f1d4b6a8a9d8e1d Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Sat, 9 May 2026 23:25:30 +0800 Subject: [PATCH] feat: add TDP and YouTube video inputs to benchmark submission wizard --- components/wizard/game-entry-wizard.tsx | 4 +++ components/wizard/steps/environment-step.tsx | 26 ++++++++++++++++ components/wizard/steps/performance-step.tsx | 31 +++++++++++++++++++- components/wizard/steps/review-step.tsx | 2 ++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/components/wizard/game-entry-wizard.tsx b/components/wizard/game-entry-wizard.tsx index 7cc67fc..f8601f9 100644 --- a/components/wizard/game-entry-wizard.tsx +++ b/components/wizard/game-entry-wizard.tsx @@ -94,6 +94,7 @@ export function GameEntryWizard({ gameId, gameVersions, defaultVersionId, editEn fpsHigh: editEntry.fpsHigh ?? undefined, loadTimeSsd: editEntry.loadTimeSsd ?? undefined, loadTimeSd: editEntry.loadTimeSd ?? undefined, + tdpWatts: editEntry.tdpWatts ?? undefined, } : {}, ) @@ -115,6 +116,7 @@ export function GameEntryWizard({ gameId, gameVersions, defaultVersionId, editEn launchOptions: editEntry.launchOptions ?? undefined, estimatedBatteryMin: editEntry.estimatedBatteryMin ?? undefined, customSystem: editEntry.customSystem ?? false, + youtubeVideoId: editEntry.youtubeVideoId ?? undefined, } : { upscalerType: "none", @@ -259,6 +261,8 @@ export function GameEntryWizard({ gameId, gameVersions, defaultVersionId, editEn fpsHigh: performance.fpsHigh !== undefined ? Number(performance.fpsHigh) : null, loadTimeSsd: performance.loadTimeSsd !== undefined ? Number(performance.loadTimeSsd) : null, loadTimeSd: performance.loadTimeSd !== undefined ? Number(performance.loadTimeSd) : null, + tdpWatts: performance.tdpWatts !== undefined ? Number(performance.tdpWatts) : null, + youtubeVideoId: environment.youtubeVideoId || null, protonVersion: environment.protonVersion || null, osVersion: environment.osVersion || null, upscalerType: environment.upscalerType ?? "none", diff --git a/components/wizard/steps/environment-step.tsx b/components/wizard/steps/environment-step.tsx index 6756f3f..6216da5 100644 --- a/components/wizard/steps/environment-step.tsx +++ b/components/wizard/steps/environment-step.tsx @@ -31,6 +31,7 @@ export interface EnvironmentData { launchOptions?: string estimatedBatteryMin?: number customSystem?: boolean + youtubeVideoId?: string // NEW } interface EnvironmentStepProps { @@ -307,6 +308,31 @@ export function EnvironmentStep({ value, onChange }: EnvironmentStepProps) { + +
+ + { + const val = e.target.value + // Accept full URLs or just the 11-char ID + let videoId = val + const ytMatch = val.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/) + if (ytMatch) videoId = ytMatch[1] + onChange({ ...value, youtubeVideoId: videoId || undefined }) + }} + placeholder="YouTube video ID or URL" + maxLength={200} + className="w-full px-4 py-3 rounded-lg border border-border bg-text/5 text-text text-sm placeholder:text-text/40 outline-none focus:border-primary focus:ring-2 focus:ring-primary/50 transition-colors" + /> + {value.youtubeVideoId && !/^[a-zA-Z0-9_-]{11}$/.test(value.youtubeVideoId) && ( +

Invalid YouTube video ID (must be 11 characters)

+ )} +
) } diff --git a/components/wizard/steps/performance-step.tsx b/components/wizard/steps/performance-step.tsx index 3f10e00..eebe935 100644 --- a/components/wizard/steps/performance-step.tsx +++ b/components/wizard/steps/performance-step.tsx @@ -1,7 +1,7 @@ "use client" import { useMemo } from "react" -import { Gauge, Timer } from "lucide-react" +import { Gauge, Timer, Zap } from "lucide-react" export interface PerformanceData { fpsAvg?: number @@ -10,6 +10,7 @@ export interface PerformanceData { fpsHigh?: number loadTimeSsd?: number loadTimeSd?: number + tdpWatts?: number } interface PerformanceStepProps { @@ -141,6 +142,34 @@ export function PerformanceStep({ value, onChange }: PerformanceStepProps) { + + {/* Power Section */} +
+
+ +

Power

+
+
+
+ + { + const val = e.target.value.replace(/[^0-9.]/g, "").replace(/(\..*)\./g, "$1") + const num = val === "" || val === "." ? undefined : Number(val) + onChange({ ...value, tdpWatts: num }) + }} + placeholder="e.g. 10" + className="w-full px-4 py-3 rounded-lg border border-border bg-text/5 text-text text-sm placeholder:text-text/40 outline-none focus:border-primary focus:ring-2 focus:ring-primary/50 transition-colors" + /> +
+
+
) } diff --git a/components/wizard/steps/review-step.tsx b/components/wizard/steps/review-step.tsx index 89611e4..6af11c9 100644 --- a/components/wizard/steps/review-step.tsx +++ b/components/wizard/steps/review-step.tsx @@ -120,6 +120,7 @@ export function ReviewStep({ + {/* Environment */} @@ -141,6 +142,7 @@ export function ReviewStep({ } /> )} + {/* Settings */}