Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2025-05-15 - [Delete Confirmation & Build Strictness]
**Learning:** Destructive actions like deleting a game from the library should always have a confirmation dialog to prevent accidental data loss. Additionally, the project's production build (`pnpm build`) includes strict TypeScript linting that blocks on unused variables, making cleanup mandatory for a successful build.
**Action:** Always implement `window.confirm` for delete buttons and ensure all unused variables are removed before attempting to build/submit.
6 changes: 5 additions & 1 deletion src/components/Library/GameDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export function GameDetail({ gameId, onBack, onFilter }: GameDetailProps) {
setGame({ ...game, notes: notesValue });
};

const handleDelete = async () => { if (await deleteGame(game.id)) onBack(); };
const handleDelete = async () => {
if (window.confirm(t('confirmDelete'))) {
if (await deleteGame(game.id)) onBack();
}
};

const handlePlayTimeChange = async (hours: number) => {
if (await updatePlayTime(game.id, hours)) {
Expand Down
2 changes: 0 additions & 2 deletions src/components/Library/GameScreenshotsCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export function GameScreenshotsCarousel({ gameId }: GameScreenshotsCarouselProps
const [igdbScreenshots, setIgdbScreenshots] = useState<string[]>([]);
const [currentIndex, setCurrentIndex] = useState(0);
const [loading, setLoading] = useState(true);
const [hasIgdbId, setHasIgdbId] = useState(false);

useEffect(() => {
const loadScreenshots = async () => {
Expand All @@ -29,7 +28,6 @@ export function GameScreenshotsCarousel({ gameId }: GameScreenshotsCarouselProps
// Load game data to check IGDB ID
try {
const game = await invoke<{ igdb_id: number | null }>("get_game_by_id", { id: gameId });
setHasIgdbId(!!game?.igdb_id);

// Load IGDB screenshots if available
if (game?.igdb_id) {
Expand Down