From f7a401a18347c54b745c00e9d52eeadd5c7c07e7 Mon Sep 17 00:00:00 2001 From: zhx Date: Tue, 2 Jun 2026 17:42:50 +0800 Subject: [PATCH] feat: expose game safe height --- src/features/games/api.ts | 2 ++ src/features/games/hooks/useGamesPage.js | 3 +++ src/features/games/pages/GameListPage.jsx | 10 +++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/features/games/api.ts b/src/features/games/api.ts index ab4e920..0effe24 100644 --- a/src/features/games/api.ts +++ b/src/features/games/api.ts @@ -33,6 +33,7 @@ export interface GameCatalogDto { launchUrl?: string; launchMode: string; orientation: string; + safeHeight: number; minCoin: number; status: string; sortOrder: number; @@ -198,6 +199,7 @@ function normalizeCatalog(game: Partial): GameCatalogDto { launchUrl: stringValue(game.launchUrl), launchMode: normalizeLaunchMode(game.launchMode), orientation: stringValue(game.orientation || "portrait"), + safeHeight: numberValue(game.safeHeight), minCoin: numberValue(game.minCoin), status: stringValue(game.status || "active"), sortOrder: numberValue(game.sortOrder), diff --git a/src/features/games/hooks/useGamesPage.js b/src/features/games/hooks/useGamesPage.js index 078bede..db255b2 100644 --- a/src/features/games/hooks/useGamesPage.js +++ b/src/features/games/hooks/useGamesPage.js @@ -25,6 +25,7 @@ const defaultGameForm = { gameUrl: "", launchMode: "full_screen", orientation: "portrait", + safeHeight: 0, minCoin: 0, status: "active", sortOrder: 0, @@ -495,6 +496,7 @@ function gameToForm(game, platforms = []) { gameUrl: resolveGameURLFromPlatforms(platforms, game), launchMode: normalizeLaunchMode(game.launchMode), orientation: game.orientation || "portrait", + safeHeight: Number(game.safeHeight || 0), minCoin: Number(game.minCoin || 0), status: game.status || "active", sortOrder: Number(game.sortOrder || 0), @@ -561,6 +563,7 @@ function gamePayload(form) { coverUrl: form.coverUrl.trim(), launchMode: normalizeLaunchMode(form.launchMode), orientation: form.orientation.trim() || "portrait", + safeHeight: Number(form.safeHeight || 0), minCoin: Number(form.minCoin || 0), status: form.status.trim() || "active", sortOrder: Number(form.sortOrder || 0), diff --git a/src/features/games/pages/GameListPage.jsx b/src/features/games/pages/GameListPage.jsx index 74a2399..99403d8 100644 --- a/src/features/games/pages/GameListPage.jsx +++ b/src/features/games/pages/GameListPage.jsx @@ -76,7 +76,9 @@ const baseColumns = [ render: (game) => (
{launchModeLabel(game.launchMode)} - {game.orientation} + + {game.orientation} · 安全高 {formatNumber(game.safeHeight)} +
), }, @@ -349,6 +351,12 @@ function GameFormDialog({ form, loading, mode, open, page, onClose, onSubmit }) ))} + page.setGameForm({ ...form, safeHeight: event.target.value })} + />