feat: expose game safe height

This commit is contained in:
zhx 2026-06-02 17:42:50 +08:00
parent 79ed201975
commit f7a401a183
3 changed files with 14 additions and 1 deletions

View File

@ -33,6 +33,7 @@ export interface GameCatalogDto {
launchUrl?: string; launchUrl?: string;
launchMode: string; launchMode: string;
orientation: string; orientation: string;
safeHeight: number;
minCoin: number; minCoin: number;
status: string; status: string;
sortOrder: number; sortOrder: number;
@ -198,6 +199,7 @@ function normalizeCatalog(game: Partial<GameCatalogDto>): GameCatalogDto {
launchUrl: stringValue(game.launchUrl), launchUrl: stringValue(game.launchUrl),
launchMode: normalizeLaunchMode(game.launchMode), launchMode: normalizeLaunchMode(game.launchMode),
orientation: stringValue(game.orientation || "portrait"), orientation: stringValue(game.orientation || "portrait"),
safeHeight: numberValue(game.safeHeight),
minCoin: numberValue(game.minCoin), minCoin: numberValue(game.minCoin),
status: stringValue(game.status || "active"), status: stringValue(game.status || "active"),
sortOrder: numberValue(game.sortOrder), sortOrder: numberValue(game.sortOrder),

View File

@ -25,6 +25,7 @@ const defaultGameForm = {
gameUrl: "", gameUrl: "",
launchMode: "full_screen", launchMode: "full_screen",
orientation: "portrait", orientation: "portrait",
safeHeight: 0,
minCoin: 0, minCoin: 0,
status: "active", status: "active",
sortOrder: 0, sortOrder: 0,
@ -495,6 +496,7 @@ function gameToForm(game, platforms = []) {
gameUrl: resolveGameURLFromPlatforms(platforms, game), gameUrl: resolveGameURLFromPlatforms(platforms, game),
launchMode: normalizeLaunchMode(game.launchMode), launchMode: normalizeLaunchMode(game.launchMode),
orientation: game.orientation || "portrait", orientation: game.orientation || "portrait",
safeHeight: Number(game.safeHeight || 0),
minCoin: Number(game.minCoin || 0), minCoin: Number(game.minCoin || 0),
status: game.status || "active", status: game.status || "active",
sortOrder: Number(game.sortOrder || 0), sortOrder: Number(game.sortOrder || 0),
@ -561,6 +563,7 @@ function gamePayload(form) {
coverUrl: form.coverUrl.trim(), coverUrl: form.coverUrl.trim(),
launchMode: normalizeLaunchMode(form.launchMode), launchMode: normalizeLaunchMode(form.launchMode),
orientation: form.orientation.trim() || "portrait", orientation: form.orientation.trim() || "portrait",
safeHeight: Number(form.safeHeight || 0),
minCoin: Number(form.minCoin || 0), minCoin: Number(form.minCoin || 0),
status: form.status.trim() || "active", status: form.status.trim() || "active",
sortOrder: Number(form.sortOrder || 0), sortOrder: Number(form.sortOrder || 0),

View File

@ -76,7 +76,9 @@ const baseColumns = [
render: (game) => ( render: (game) => (
<div className={styles.stack}> <div className={styles.stack}>
<span>{launchModeLabel(game.launchMode)}</span> <span>{launchModeLabel(game.launchMode)}</span>
<span className={styles.meta}>{game.orientation}</span> <span className={styles.meta}>
{game.orientation} · 安全高 {formatNumber(game.safeHeight)}
</span>
</div> </div>
), ),
}, },
@ -349,6 +351,12 @@ function GameFormDialog({ form, loading, mode, open, page, onClose, onSubmit })
</MenuItem> </MenuItem>
))} ))}
</TextField> </TextField>
<TextField
label="安全高"
type="number"
value={form.safeHeight}
onChange={(event) => page.setGameForm({ ...form, safeHeight: event.target.value })}
/>
<TextField <TextField
label="游戏 URL" label="游戏 URL"
className={styles.fullField} className={styles.fullField}