feat(questions): list and restore removed games
Build, Test & Push Frontend / quality-check (push) Successful in 36s
Build, Test & Push Frontend / docker (push) Successful in 26s

Add a "Removed games" section on the questions page and an Undo
toast after removing a manual game (#39).
This commit is contained in:
lobo committed 2026-10-11 09:52:11 +02:00
1 parent c126592887
commit 84b16a2ca8
14 files changed
+280 -9

No files matched your search

+12 -2
View File
@@ -8,10 +8,12 @@ import {Button} from '@/components/ui/button';
import {Card} from '@/components/ui/card';
import {Input} from '@/components/ui/input';
import {Label} from '@/components/ui/label';
import {hoursToMinutes, removeGame, toHours, updateManualGame} from '../utils/manualGames.js';
import {hoursToMinutes, removeGame, restoreGame, toHours, updateManualGame} from '../utils/manualGames.js';
import {MAX_PLATFORM_LENGTH} from '../utils/limits.js';
import useUnsavedChanges, {discardChanges} from '../hooks/useUnsavedChanges.js';
const UNDO_MS = 8000;
/**
* Platform and hours of a game added by hand, and removing it. Steam games get both from the sync.
*
@@ -54,8 +56,16 @@ export default function ManualGameCard({game, onSaved}) {
toast.success(t('BACKLOG.SAVED'));
});
const undoRemove = () => run(() => restoreGame(game.appid), () => {
toast.success(t('REMOVED_GAMES.RESTORED'));
navigate(`/library/${game.appid}`);
});
const remove = () => run(() => removeGame(game.appid), () => {
toast.success(t('MANUAL_GAME.REMOVED'));
toast.success(t('MANUAL_GAME.REMOVED'), {
duration: UNDO_MS,
action: {label: t('MANUAL_GAME.UNDO'), onClick: undoRemove},
});
// The game is gone, so are its unsaved edits on this page.
discardChanges();
navigate('/library', {replace: true});