mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-01-24 20:32:51 -05:00
Revert: undo broken animation patch (28a8677)
This commit is contained in:
79
src/App.tsx
79
src/App.tsx
@@ -381,21 +381,15 @@ function App() {
|
|||||||
setProgressDialog((prev) => ({ ...prev, visible: false }))
|
setProgressDialog((prev) => ({ ...prev, visible: false }))
|
||||||
|
|
||||||
// Only refresh if we need to (instructions didn't trigger update)
|
// Only refresh if we need to (instructions didn't trigger update)
|
||||||
if (
|
if (progressDialog.showInstructions === false && !refreshInProgress.current) {
|
||||||
progressDialog.showInstructions === false &&
|
refreshInProgress.current = true
|
||||||
!progressDialog.title.includes("DLC") &&
|
|
||||||
!progressDialog.title.includes("Updating") &&
|
|
||||||
!progressDialog.title.includes("Update") &&
|
|
||||||
!refreshInProgress.current
|
|
||||||
) {
|
|
||||||
refreshInProgress.current = true;
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loadGames().then(() => {
|
loadGames().then(() => {
|
||||||
refreshInProgress.current = false;
|
refreshInProgress.current = false
|
||||||
});
|
})
|
||||||
}, 100);
|
}, 100)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// Function to fetch DLCs for a game with streaming updates
|
// Function to fetch DLCs for a game with streaming updates
|
||||||
const streamGameDlcs = async (gameId: string): Promise<void> => {
|
const streamGameDlcs = async (gameId: string): Promise<void> => {
|
||||||
@@ -678,20 +672,22 @@ function App() {
|
|||||||
// Handle DLC selection confirmation
|
// Handle DLC selection confirmation
|
||||||
const handleDlcConfirm = async (selectedDlcs: DlcInfo[]) => {
|
const handleDlcConfirm = async (selectedDlcs: DlcInfo[]) => {
|
||||||
// The dialog has already started its exit animation
|
// The dialog has already started its exit animation
|
||||||
setDlcDialog((prev) => ({ ...prev, visible: false }));
|
// Just make sure it's marked as invisible
|
||||||
|
setDlcDialog((prev) => ({ ...prev, visible: false }))
|
||||||
|
|
||||||
const gameId = dlcDialog.gameId;
|
const gameId = dlcDialog.gameId
|
||||||
const game = games.find((g) => g.id === gameId);
|
const game = games.find((g) => g.id === gameId)
|
||||||
if (!game) return;
|
if (!game) return
|
||||||
|
|
||||||
// Update local state to show installation in progress
|
// Update local state to show installation in progress
|
||||||
setGames((prevGames) =>
|
setGames((prevGames) =>
|
||||||
prevGames.map((g) => (g.id === gameId ? { ...g, installing: true } : g))
|
prevGames.map((g) => (g.id === gameId ? { ...g, installing: true } : g))
|
||||||
);
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (dlcDialog.isEditMode) {
|
if (dlcDialog.isEditMode) {
|
||||||
// If in edit mode, we're updating existing cream_api.ini
|
// If in edit mode, we're updating existing cream_api.ini
|
||||||
|
// Show progress dialog for editing
|
||||||
setProgressDialog({
|
setProgressDialog({
|
||||||
visible: true,
|
visible: true,
|
||||||
title: `Updating DLCs for ${game.title}`,
|
title: `Updating DLCs for ${game.title}`,
|
||||||
@@ -699,13 +695,13 @@ function App() {
|
|||||||
progress: 30,
|
progress: 30,
|
||||||
showInstructions: false,
|
showInstructions: false,
|
||||||
instructions: undefined,
|
instructions: undefined,
|
||||||
});
|
})
|
||||||
|
|
||||||
// Call the backend to update the DLC configuration
|
// Call the backend to update the DLC configuration
|
||||||
await invoke('update_dlc_configuration_command', {
|
await invoke('update_dlc_configuration_command', {
|
||||||
gamePath: game.path,
|
gamePath: game.path,
|
||||||
dlcs: selectedDlcs,
|
dlcs: selectedDlcs,
|
||||||
});
|
})
|
||||||
|
|
||||||
// Update progress dialog for completion
|
// Update progress dialog for completion
|
||||||
setProgressDialog((prev) => ({
|
setProgressDialog((prev) => ({
|
||||||
@@ -713,22 +709,21 @@ function App() {
|
|||||||
title: `Update Complete: ${game.title}`,
|
title: `Update Complete: ${game.title}`,
|
||||||
message: 'DLC configuration updated successfully!',
|
message: 'DLC configuration updated successfully!',
|
||||||
progress: 100,
|
progress: 100,
|
||||||
}));
|
}))
|
||||||
|
|
||||||
// Most importantly: directly update the local state instead of waiting for a full scan
|
// The ProgressDialog component will now handle the exit animation
|
||||||
// This is what prevents the need for a full scan
|
// when progress reaches 100% after a delay
|
||||||
|
|
||||||
|
// But we still need to reset installing state with a delay
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Reset installing state and update the game in the local state
|
// Reset installing state
|
||||||
setGames((prevGames) =>
|
setGames((prevGames) =>
|
||||||
prevGames.map((g) => (g.id === gameId ? {
|
prevGames.map((g) => (g.id === gameId ? { ...g, installing: false } : g))
|
||||||
...g,
|
)
|
||||||
installing: false,
|
}, 2000)
|
||||||
// No other properties should need updating for a DLC config change
|
|
||||||
} : g))
|
|
||||||
);
|
|
||||||
}, 2000);
|
|
||||||
} else {
|
} else {
|
||||||
// We're doing a fresh install with selected DLCs - original code unchanged
|
// We're doing a fresh install with selected DLCs
|
||||||
|
// Show progress dialog for installation right away
|
||||||
setProgressDialog({
|
setProgressDialog({
|
||||||
visible: true,
|
visible: true,
|
||||||
title: `Installing CreamLinux for ${game.title}`,
|
title: `Installing CreamLinux for ${game.title}`,
|
||||||
@@ -736,32 +731,38 @@ function App() {
|
|||||||
progress: 0,
|
progress: 0,
|
||||||
showInstructions: false,
|
showInstructions: false,
|
||||||
instructions: undefined,
|
instructions: undefined,
|
||||||
});
|
})
|
||||||
|
|
||||||
|
// Invoke the installation with the selected DLCs
|
||||||
await invoke('install_cream_with_dlcs_command', {
|
await invoke('install_cream_with_dlcs_command', {
|
||||||
gameId,
|
gameId,
|
||||||
selectedDlcs,
|
selectedDlcs,
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(`Error installing CreamLinux with selected DLCs:`, err);
|
console.error(`Error installing CreamLinux with selected DLCs:`, err)
|
||||||
throw err;
|
throw err
|
||||||
});
|
})
|
||||||
|
|
||||||
|
// We don't need to manually close the dialog or update the game state
|
||||||
|
// because the backend will emit progress events that handle this
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error processing DLC selection:', error);
|
console.error('Error processing DLC selection:', error)
|
||||||
|
|
||||||
// Show error in progress dialog
|
// Show error in progress dialog
|
||||||
setProgressDialog((prev) => ({
|
setProgressDialog((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
message: `Error: ${error}`,
|
message: `Error: ${error}`,
|
||||||
progress: 100,
|
progress: 100,
|
||||||
}));
|
}))
|
||||||
|
|
||||||
// Reset installing state
|
// Reset installing state
|
||||||
setGames((prevGames) =>
|
setGames((prevGames) =>
|
||||||
prevGames.map((g) => (g.id === gameId ? { ...g, installing: false } : g))
|
prevGames.map((g) => (g.id === gameId ? { ...g, installing: false } : g))
|
||||||
);
|
)
|
||||||
|
|
||||||
|
// ProgressDialog will handle exit animation automatically
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// Update DLCs being streamed with enabled state
|
// Update DLCs being streamed with enabled state
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user