diff --git a/app/game/[id]/preset-detail-modal.tsx b/app/game/[id]/preset-detail-modal.tsx index e99ed5c..dfa61bf 100644 --- a/app/game/[id]/preset-detail-modal.tsx +++ b/app/game/[id]/preset-detail-modal.tsx @@ -20,6 +20,9 @@ import { PencilIcon, } from "lucide-react" import { TiptapRenderer } from "@/components/tiptap-renderer" +import { ScreenshotLightbox } from "@/components/ui/screenshot-lightbox" + +type TabKey = "details" | "media" | "settings" | "notes" interface Preset { id: string @@ -85,6 +88,37 @@ function formatValue(value: string | number | boolean): string { return String(value) } +function MetaItem({ + label, + value, +}: { + label: string + value: React.ReactNode | string | null +}) { + return ( +
+ {label} + {value ?? "—"} +
+ ) +} + +function hasPerformanceData(p: Preset): boolean { + return p.fpsAvg !== null || p.fpsOnePercentLow !== null || p.loadTimeSsd !== null || p.loadTimeSd !== null +} + +function hasHardwarePowerData(p: Preset): boolean { + return p.tdpWatts !== null || p.hardwareWattHours !== null +} + +function hasSoftwareData(p: Preset): boolean { + return !!(p.protonVersion || p.osVersion || (p.upscalerType && p.upscalerType !== "none") || (p.frameGenMethod && p.frameGenMethod !== "none") || p.launchOptions) +} + +function hasGameInfoData(p: Preset): boolean { + return !!(p.versionString || p.buildId || p.gameAntiCheatName) +} + export function PresetDetailModal({ preset, gameId, @@ -108,7 +142,9 @@ export function PresetDetailModal({ const [userVote, setUserVote] = useState<"up" | "down" | null>(null) const [localUpvotes, setLocalUpvotes] = useState(preset.upvotes) const [localDownvotes, setLocalDownvotes] = useState(preset.downvotes) - const [mobileTab, setMobileTab] = useState<"details" | "settings">("settings") + const [activeTab, setActiveTab] = useState("media") + const [lightboxOpen, setLightboxOpen] = useState(false) + const [lightboxIndex, setLightboxIndex] = useState(0) const isOwner = session?.user?.id === preset.userId const isAdmin = session?.user?.role === "admin" @@ -162,11 +198,7 @@ export function PresetDetailModal({ } const handleReportSubmit = () => { - onReport( - preset.id, - reportReason, - reportDetails.trim() || undefined, - ) + onReport(preset.id, reportReason, reportDetails.trim() || undefined) setShowReportForm(false) setReportDetails("") } @@ -183,6 +215,9 @@ export function PresetDetailModal({ } } + const visibleTabs: TabKey[] = ["details", "media", "settings"] + if (preset.userNotes) visibleTabs.push("notes") + return ( <> @@ -219,7 +254,7 @@ export function PresetDetailModal({ onClick={(e) => e.stopPropagation()} > {/* Header */} -
+

{preset.hardwareName} @@ -236,33 +271,26 @@ export function PresetDetailModal({ {/* Mobile tabs */}
- - + {visibleTabs.map((tab) => ( + + ))}
{/* Two-column body */}
- {/* Left panel */} + {/* Left panel — Details (always visible on desktop, tab on mobile) */}
{/* User info */}
@@ -323,14 +351,9 @@ export function PresetDetailModal({ ) : (
- - Are you sure? - + Are you sure? )} - - {session && !hasReported && ( <> {!showReportForm ? ( @@ -378,31 +398,17 @@ export function PresetDetailModal({