feat: share button uses steamAppId/slug instead of UUID

This commit is contained in:
2026-05-20 02:23:09 +08:00
parent 1929572060
commit e61071007e
2 changed files with 19 additions and 1 deletions
+15 -1
View File
@@ -73,6 +73,9 @@ interface Preset {
interface PresetDetailModalProps {
preset: Preset
gameId: string
gameSource: string
gameSteamAppId: number | null
gameSlug: string | null
onClose: () => void
onDelete: (presetId: string) => void
onReport: (
@@ -140,6 +143,9 @@ function hasGameInfoData(p: Preset): boolean {
export function PresetDetailModal({
preset,
gameId,
gameSource,
gameSteamAppId,
gameSlug,
onClose,
onDelete,
onReport,
@@ -169,7 +175,15 @@ export function PresetDetailModal({
const isAuthenticated = !!session?.user
const handleShare = () => {
const url = `${window.location.origin}/game/${gameId}?preset=${preset.id}`
let identifier: string
if (gameSource === "steam" && gameSteamAppId != null) {
identifier = String(gameSteamAppId)
} else if (gameSlug) {
identifier = gameSlug
} else {
identifier = gameId // fallback for edge cases
}
const url = `${window.location.origin}/game/${identifier}?preset=${preset.id}`
navigator.clipboard.writeText(url)
setCopied(true)
setTimeout(() => setCopied(false), 2000)