Dialog fixes

This commit is contained in:
Tickbase
2025-05-18 10:37:53 +02:00
parent 3a8dccf7f8
commit f5abcfdb6d
3 changed files with 11 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ function App() {
const { const {
dlcDialog, dlcDialog,
handleDlcDialogClose, handleDlcDialogClose,
handleProgressDialogClose,
progressDialog, progressDialog,
handleGameAction, handleGameAction,
handleDlcConfirm, handleDlcConfirm,
@@ -91,7 +92,7 @@ function App() {
progress={progressDialog.progress} progress={progressDialog.progress}
showInstructions={progressDialog.showInstructions} showInstructions={progressDialog.showInstructions}
instructions={progressDialog.instructions} instructions={progressDialog.instructions}
onClose={() => {}} onClose={handleProgressDialogClose}
/> />
{/* DLC Selection Dialog */} {/* DLC Selection Dialog */}

View File

@@ -37,6 +37,7 @@ export interface AppContextType {
isLoading: boolean; isLoading: boolean;
error: string | null; error: string | null;
loadGames: () => Promise<boolean>; loadGames: () => Promise<boolean>;
handleProgressDialogClose: () => void;
// DLC management // DLC management
dlcDialog: DlcDialogState; dlcDialog: DlcDialogState;

View File

@@ -33,6 +33,7 @@ export const AppProvider = ({ children }: AppProviderProps) => {
const { const {
progressDialog, progressDialog,
handleCloseProgressDialog,
handleGameAction: executeGameAction, handleGameAction: executeGameAction,
handleDlcConfirm: executeDlcConfirm, handleDlcConfirm: executeDlcConfirm,
} = useGameActions() } = useGameActions()
@@ -55,8 +56,7 @@ export const AppProvider = ({ children }: AppProviderProps) => {
} }
try { try {
await streamGameDlcs(gameId) // Open the dialog
setDlcDialog({ setDlcDialog({
...dlcDialog, ...dlcDialog,
visible: true, visible: true,
@@ -64,8 +64,12 @@ export const AppProvider = ({ children }: AppProviderProps) => {
gameTitle: game.title, gameTitle: game.title,
isLoading: true, isLoading: true,
isEditMode: true, isEditMode: true,
dlcs: [], // start empty
progress: 0,
}) })
// Now fetch DLCs in the background
streamGameDlcs(gameId)
} catch (error) { } catch (error) {
showError(`Failed to load DLCs: ${error}`) showError(`Failed to load DLCs: ${error}`)
} }
@@ -157,6 +161,7 @@ export const AppProvider = ({ children }: AppProviderProps) => {
progressDialog, progressDialog,
handleGameAction, handleGameAction,
handleDlcConfirm, handleDlcConfirm,
handleProgressDialogClose: handleCloseProgressDialog,
// Toast notifications // Toast notifications
showToast, showToast,