feat: rearrange game benchmark wizard and improve overall

This commit is contained in:
2026-05-01 01:18:13 +08:00
parent 293aadbff0
commit 824fbbd13f
22 changed files with 722 additions and 143 deletions
+1 -1
View File
@@ -677,7 +677,7 @@ function GameCard({ game }: { game: GamesListItem }) {
</h3>
<div className="flex flex-wrap gap-1 mt-1">
{game.playabilityStatus && (
<PlayabilityBadge status={game.playabilityStatus} compact showLabel={false} />
<PlayabilityBadge status={game.playabilityStatus} compact />
)}
{game.antiCheatRelevant && game.antiCheatStatus === "unsupported" && (
<AntiCheatBadge
+22
View File
@@ -1,4 +1,5 @@
import type { Metadata } from "next"
import { after } from "next/server"
import { db } from "@/lib/db/index"
import {
games,
@@ -8,6 +9,7 @@ import {
hardware,
} from "@/lib/db/schema"
import { sql, eq, and, desc, inArray } from "drizzle-orm"
import { isSyncStale, syncSteamGame } from "@/lib/steam/sync"
import { GamesPageClient } from "./games-page-client"
// This page needs live data — skip static generation at build time
@@ -51,6 +53,7 @@ export default async function GamesPage() {
steamReviewScore: games.steamReviewScore,
playabilityStatus: games.playabilityStatus,
onlineMultiplayerStatus: games.onlineMultiplayerStatus,
lastSync: games.lastSync,
})
.from(games)
.orderBy(desc(games.createdAt))
@@ -163,6 +166,25 @@ export default async function GamesPage() {
const allGenres = Array.from(genreSet).sort()
const allDevices = deviceRows
// ── Background sync for stale games ────────────────────────────────
const staleSteamAppIds = gamesData
.filter((g) => g.source === "steam" && g.steamAppId && isSyncStale(g.lastSync))
.map((g) => g.steamAppId!)
if (staleSteamAppIds.length > 0) {
after(async () => {
// Sync stale games sequentially with a small delay to avoid rate-limiting
for (const appId of staleSteamAppIds) {
try {
await syncSteamGame(appId)
} catch {
// Stale sync failure is non-fatal — data will be refreshed on next visit
}
await new Promise((r) => setTimeout(r, 1500))
}
})
}
// JSON-LD ItemList
const jsonLd = {
"@context": "https://schema.org",