mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-01-24 12:22:49 -05:00
Add response if we got any new dlcs or not #64
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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 = ({
|
||||
</DialogBody>
|
||||
|
||||
<DialogFooter>
|
||||
{/* Show update results if we found new DLCs */}
|
||||
{newDlcsCount > 0 && !isUpdating && (
|
||||
<div className="dlc-update-results">
|
||||
<span className="update-success-message">
|
||||
<Icon name={check} size="sm" variant="solid" className="dlc-update-icon" /> Found {newDlcsCount} new DLC{newDlcsCount > 1 ? 's' : ''}!
|
||||
</span>
|
||||
</div>
|
||||
{/* Show update results */}
|
||||
{!isUpdating && !isLoading && isEditMode && updateAttempted && (
|
||||
<>
|
||||
{newDlcsCount > 0 && (
|
||||
<div className="dlc-update-results dlc-update-success">
|
||||
<span className="update-message">
|
||||
<Icon name={check} size="md" variant="solid" className="dlc-update-icon-success"/> Found {newDlcsCount} new DLC{newDlcsCount > 1 ? 's' : ''}!
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{newDlcsCount === 0 && (
|
||||
<div className="dlc-update-results dlc-update-info">
|
||||
<span className="update-message">
|
||||
<Icon name={info} size="md" variant="solid" className="dlc-update-icon-info"/> No new DLCs found. Your list is up to date!
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
<DialogActions>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user