diff --git a/src/App.tsx b/src/App.tsx index f2c3df6..ab162a8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -113,6 +113,7 @@ function App() { isLoading={dlcDialog.isLoading} isEditMode={dlcDialog.isEditMode} isUpdating={dlcDialog.isUpdating} + updateAttempted={dlcDialog.updateAttempted} loadingProgress={dlcDialog.progress} estimatedTimeLeft={dlcDialog.timeLeft} newDlcsCount={dlcDialog.newDlcsCount} diff --git a/src/components/dialogs/DlcSelectionDialog.tsx b/src/components/dialogs/DlcSelectionDialog.tsx index 57e2bc8..67606ec 100644 --- a/src/components/dialogs/DlcSelectionDialog.tsx +++ b/src/components/dialogs/DlcSelectionDialog.tsx @@ -6,7 +6,7 @@ import DialogFooter from './DialogFooter' import DialogActions from './DialogActions' import { Button, AnimatedCheckbox } from '@/components/buttons' import { DlcInfo } from '@/types' -import { Icon, check } from '@/components/icons' +import { Icon, check, info } from '@/components/icons' export interface DlcSelectionDialogProps { visible: boolean @@ -19,6 +19,7 @@ export interface DlcSelectionDialogProps { isLoading: boolean isEditMode?: boolean isUpdating?: boolean + updateAttempted?: boolean loadingProgress?: number estimatedTimeLeft?: string newDlcsCount?: number @@ -40,6 +41,7 @@ const DlcSelectionDialog = ({ isLoading, isEditMode = false, isUpdating = false, + updateAttempted = false, loadingProgress = 0, estimatedTimeLeft = '', newDlcsCount = 0, @@ -220,13 +222,24 @@ const DlcSelectionDialog = ({ - {/* Show update results if we found new DLCs */} - {newDlcsCount > 0 && !isUpdating && ( -
- - Found {newDlcsCount} new DLC{newDlcsCount > 1 ? 's' : ''}! - -
+ {/* Show update results */} + {!isUpdating && !isLoading && isEditMode && updateAttempted && ( + <> + {newDlcsCount > 0 && ( +
+ + Found {newDlcsCount} new DLC{newDlcsCount > 1 ? 's' : ''}! + +
+ )} + {newDlcsCount === 0 && ( +
+ + No new DLCs found. Your list is up to date! + +
+ )} + )} diff --git a/src/hooks/useDlcManager.ts b/src/hooks/useDlcManager.ts index 4be1468..72e9428 100644 --- a/src/hooks/useDlcManager.ts +++ b/src/hooks/useDlcManager.ts @@ -12,6 +12,7 @@ export interface DlcDialogState { isLoading: boolean isEditMode: boolean isUpdating: boolean + updateAttempted: boolean progress: number progressMessage: string timeLeft: string @@ -39,6 +40,7 @@ export function useDlcManager() { isLoading: false, isEditMode: false, isUpdating: false, + updateAttempted: false, progress: 0, progressMessage: '', timeLeft: '', @@ -183,6 +185,7 @@ export function useDlcManager() { isLoading: true, isEditMode: true, isUpdating: false, + updateAttempted: false, progress: 0, progressMessage: 'Reading DLC configuration...', timeLeft: '', @@ -320,6 +323,7 @@ export function useDlcManager() { ...prev, isUpdating: true, isLoading: true, + updateAttempted: true, progress: 0, progressMessage: 'Checking for new DLCs...', newDlcsCount: 0, @@ -333,18 +337,21 @@ export function useDlcManager() { // Start streaming DLCs await streamGameDlcs(gameId) - // After streaming, calculate new DLCs - // This will be done when progress reaches 100% in the listener + // After streaming completes, calculate new DLCs + // Wait a bit longer to ensure all DLCs have been added setTimeout(() => { setDlcDialog((prev) => { + // Count how many DLCs are new (not in the original list) const actualNewCount = prev.dlcs.filter(dlc => !currentAppIds.has(dlc.appid)).length + console.log(`Update complete: Found ${actualNewCount} new DLCs out of ${prev.dlcs.length} total`) + return { ...prev, - newDlcsCount: actualNewCount > 0 ? actualNewCount : 0, + newDlcsCount: actualNewCount, } }) - }, 1000) + }, 1500) // Increased timeout to ensure all DLCs are processed } catch (error) { console.error('Error updating DLCs:', error) diff --git a/src/styles/components/dialogs/_dlc_dialog.scss b/src/styles/components/dialogs/_dlc_dialog.scss index 36449c6..3c62b87 100644 --- a/src/styles/components/dialogs/_dlc_dialog.scss +++ b/src/styles/components/dialogs/_dlc_dialog.scss @@ -162,16 +162,28 @@ border-radius: var(--radius-sm); margin-bottom: 0.75rem; - .update-success-message { + .update-message { color: var(--text-primary); font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; + } - .dlc-update-icon { - color: var(--success); + &.dlc-update-success { + .update-message { + .dlc-update-icon-success { + color: var(--success); + } + } + } + + &.dlc-update-info { + .update-message { + .dlc-update-icon-info { + color: var(--info); + } } } }