Task 18: Add playability, anti-cheat, and steam review badges to search results

This commit is contained in:
2026-04-30 20:32:04 +08:00
parent 32d52cf3ba
commit 5f4d618d85
2 changed files with 37 additions and 0 deletions
+31
View File
@@ -17,6 +17,8 @@ import Image from "next/image"
import Link from "next/link" import Link from "next/link"
import { useSession } from "@/lib/auth-client" import { useSession } from "@/lib/auth-client"
import { WindowsIcon, MacIcon, LinuxIcon } from "@/app/components/PlatformIcons" import { WindowsIcon, MacIcon, LinuxIcon } from "@/app/components/PlatformIcons"
import { AntiCheatBadge } from "@/components/anti-cheat-badge"
import { PlayabilityBadge } from "@/components/playability-badge"
interface UnifiedResult { interface UnifiedResult {
kind: "local" | "steam" kind: "local" | "steam"
@@ -46,6 +48,13 @@ interface UnifiedResult {
bestFps?: number | null bestFps?: number | null
latestVersion?: string | null latestVersion?: string | null
tinyImage?: string | null tinyImage?: string | null
// Badges & review fields
playabilityStatus?: "great" | "playable" | "needs_tweaks" | "unplayable" | "unknown" | null
steamReviewScore?: number | null
steamReviewSentiment?: string | null
antiCheatRelevant?: boolean
antiCheatStatus?: string | null
antiCheatName?: string | null
} }
function SearchContent() { function SearchContent() {
@@ -476,6 +485,28 @@ function SearchResultCard({
label="Version" label="Version"
value={result.latestVersion ?? "—"} value={result.latestVersion ?? "—"}
/> />
{/* Playability badge */}
{result.playabilityStatus && (
<PlayabilityBadge status={result.playabilityStatus} compact />
)}
{/* Anti-cheat badge */}
{result.antiCheatRelevant && result.antiCheatStatus === "unsupported" && (
<AntiCheatBadge
antiCheatRelevant={true}
antiCheatStatus={result.antiCheatStatus}
antiCheatName={result.antiCheatName}
compact
/>
)}
{/* Steam review score */}
{result.steamReviewScore != null && (
<span className="text-xs text-zinc-400">
{result.steamReviewScore}% positive
</span>
)}
</div> </div>
</div> </div>
</motion.article> </motion.article>
+6
View File
@@ -294,6 +294,12 @@ export const searchUnifiedRoutes = new Elysia({ prefix: "/search" }).get(
isPoorPerformance: poorPerformerMap.get(g.id) ?? false, isPoorPerformance: poorPerformerMap.get(g.id) ?? false,
bestFps: bestFpsMap.get(g.id) ?? null, bestFps: bestFpsMap.get(g.id) ?? null,
latestVersion: latestVersionMap.get(g.id) ?? null, latestVersion: latestVersionMap.get(g.id) ?? null,
playabilityStatus: g.playabilityStatus,
steamReviewScore: g.steamReviewScore,
steamReviewSentiment: g.steamReviewSentiment,
antiCheatRelevant: platform?.antiCheatRelevant ?? null,
antiCheatStatus: platform?.antiCheatStatus ?? null,
antiCheatName: platform?.antiCheatName ?? null,
}) })
} }