dlc dialog

This commit is contained in:
Tickbase
2025-05-18 11:49:50 +02:00
parent f5abcfdb6d
commit a6407c96c8
4 changed files with 95 additions and 69 deletions

View File

@@ -50,7 +50,7 @@ export function useDlcManager() {
const unlistenDlcFound = await listen<string>('dlc-found', (event) => {
const dlc = JSON.parse(event.payload) as { appid: string; name: string }
// Add the DLC to the current list with enabled=true
// Add the DLC to the current list with enabled=true by default
setDlcDialog((prev) => ({
...prev,
dlcs: [...prev.dlcs, { ...dlc, enabled: true }],
@@ -175,7 +175,7 @@ export function useDlcManager() {
dlcs: [],
enabledDlcs: [],
isLoading: true,
isEditMode: true,
isEditMode: true, // This is an edit operation
progress: 0,
progressMessage: 'Reading DLC configuration...',
timeLeft: '',

View File

@@ -81,6 +81,13 @@ export function useGameActions() {
// Unified handler for game actions (install/uninstall)
const handleGameAction = useCallback(async (gameId: string, action: ActionType, games: Game[]) => {
try {
// For CreamLinux installation, we should NOT call process_game_action directly
// Instead, we show the DLC selection dialog first, which is handled in AppProvider
if (action === 'install_cream') {
return
}
// For other actions (uninstall_cream, install_smoke, uninstall_smoke)
// Find game to get title
const game = games.find((g) => g.id === gameId)
if (!game) return
@@ -179,7 +186,7 @@ export function useGameActions() {
setProgressDialog({
visible: true,
title: `Installing CreamLinux for ${game.title}`,
message: 'Processing...',
message: 'Preparing to download CreamLinux...',
progress: 0,
showInstructions: false,
instructions: undefined,
@@ -190,6 +197,8 @@ export function useGameActions() {
gameId,
selectedDlcs,
})
// Note: The progress dialog will be updated through the installation-progress event listener
}
} catch (error) {
console.error('Error processing DLC selection:', error)