From f5abcfdb6de2544875d157b910bb7d1bbf9f60c5 Mon Sep 17 00:00:00 2001 From: Tickbase Date: Sun, 18 May 2025 10:37:53 +0200 Subject: [PATCH] Dialog fixes --- src/App.tsx | 3 ++- src/contexts/AppContext.tsx | 1 + src/contexts/AppProvider.tsx | 11 ++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 135a9ff..21482e3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -34,6 +34,7 @@ function App() { const { dlcDialog, handleDlcDialogClose, + handleProgressDialogClose, progressDialog, handleGameAction, handleDlcConfirm, @@ -91,7 +92,7 @@ function App() { progress={progressDialog.progress} showInstructions={progressDialog.showInstructions} instructions={progressDialog.instructions} - onClose={() => {}} + onClose={handleProgressDialogClose} /> {/* DLC Selection Dialog */} diff --git a/src/contexts/AppContext.tsx b/src/contexts/AppContext.tsx index 0f27013..d478d08 100644 --- a/src/contexts/AppContext.tsx +++ b/src/contexts/AppContext.tsx @@ -37,6 +37,7 @@ export interface AppContextType { isLoading: boolean; error: string | null; loadGames: () => Promise; + handleProgressDialogClose: () => void; // DLC management dlcDialog: DlcDialogState; diff --git a/src/contexts/AppProvider.tsx b/src/contexts/AppProvider.tsx index ad3f503..4803f48 100644 --- a/src/contexts/AppProvider.tsx +++ b/src/contexts/AppProvider.tsx @@ -33,6 +33,7 @@ export const AppProvider = ({ children }: AppProviderProps) => { const { progressDialog, + handleCloseProgressDialog, handleGameAction: executeGameAction, handleDlcConfirm: executeDlcConfirm, } = useGameActions() @@ -55,8 +56,7 @@ export const AppProvider = ({ children }: AppProviderProps) => { } try { - await streamGameDlcs(gameId) - + // Open the dialog setDlcDialog({ ...dlcDialog, visible: true, @@ -64,8 +64,12 @@ export const AppProvider = ({ children }: AppProviderProps) => { gameTitle: game.title, isLoading: true, isEditMode: true, + dlcs: [], // start empty + progress: 0, }) - + + // Now fetch DLCs in the background + streamGameDlcs(gameId) } catch (error) { showError(`Failed to load DLCs: ${error}`) } @@ -157,6 +161,7 @@ export const AppProvider = ({ children }: AppProviderProps) => { progressDialog, handleGameAction, handleDlcConfirm, + handleProgressDialogClose: handleCloseProgressDialog, // Toast notifications showToast,