implement unlocker selection #61

This commit is contained in:
Novattz
2026-01-17 17:56:46 +01:00
parent 6b16ec6168
commit 03cae08df1
4 changed files with 67 additions and 5 deletions

View File

@@ -51,11 +51,14 @@ const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps)
}, [game.id, imageUrl])
// Determine if we should show CreamLinux buttons (only for native games)
const shouldShowCream = game.native === true
const shouldShowCream = game.native && game.cream_installed // Only show if installed (for uninstall)
// Determine if we should show SmokeAPI buttons (only for non-native games with API files)
const shouldShowSmoke = !game.native && game.api_files && game.api_files.length > 0
// Show generic button if nothing installed
const shouldShowUnlocker = game.native && !game.cream_installed && !game.smoke_installed
// Check if this is a Proton game without API files
const isProtonNoApi = !game.native && (!game.api_files || game.api_files.length === 0)
@@ -71,6 +74,11 @@ const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps)
onAction(game.id, action)
}
const handleUnlockerAction = () => {
if (game.installing) return
onAction(game.id, 'install_unlocker')
}
// Handle edit button click
const handleEdit = () => {
if (onEdit && game.cream_installed) {
@@ -116,17 +124,27 @@ const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps)
</div>
<div className="game-actions">
{/* Show CreamLinux button only for native games */}
{/* Show generic "Install" button for native games with nothing installed */}
{shouldShowUnlocker && (
<ActionButton
action="install_unlocker"
isInstalled={false}
isWorking={!!game.installing}
onClick={handleUnlockerAction}
/>
)}
{/* Show CreamLinux uninstall button if CreamLinux is installed */}
{shouldShowCream && (
<ActionButton
action={game.cream_installed ? 'uninstall_cream' : 'install_cream'}
isInstalled={!!game.cream_installed}
action="uninstall_cream"
isInstalled={true}
isWorking={!!game.installing}
onClick={handleCreamAction}
/>
)}
{/* Show SmokeAPI button only for Proton/Windows games with API files */}
{/* Show SmokeAPI button for Proton games OR native games with SmokeAPI installed */}
{shouldShowSmoke && (
<ActionButton
action={game.smoke_installed ? 'uninstall_smoke' : 'install_smoke'}
@@ -136,6 +154,16 @@ const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps)
/>
)}
{/* Show SmokeAPI uninstall for native games if installed */}
{game.native && game.smoke_installed && (
<ActionButton
action="uninstall_smoke"
isInstalled={true}
isWorking={!!game.installing}
onClick={handleSmokeAction}
/>
)}
{/* Show message for Proton games without API files */}
{isProtonNoApi && (
<div className="api-not-found-message">