diff --git a/electron.vite.config.ts b/electron.vite.config.ts index 2b7048c46..72083a049 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -18,7 +18,7 @@ export default defineConfig(({ mode }) => { build: { sourcemap: true, rollupOptions: { - external: ["better-sqlite3"], + external: ["better-sqlite3", "level"], }, }, resolve: { diff --git a/src/main/events/library/get-game-by-object-id.ts b/src/main/events/library/get-game-by-object-id.ts index ef2c5c631..239bcb8d8 100644 --- a/src/main/events/library/get-game-by-object-id.ts +++ b/src/main/events/library/get-game-by-object-id.ts @@ -13,7 +13,7 @@ const getGameByObjectId = async ( downloadsSublevel.get(gameKey), ]); - if (!game) return null; + if (!game || game.isDeleted) return null; return { id: gameKey, ...game, download }; }; diff --git a/src/main/services/download/download-manager.ts b/src/main/services/download/download-manager.ts index 45e4bab5f..43073ede0 100644 --- a/src/main/services/download/download-manager.ts +++ b/src/main/services/download/download-manager.ts @@ -152,7 +152,13 @@ export class DownloadManager { .values() .all() .then((games) => { - return sortBy(games, "timestamp", "DESC"); + return sortBy( + games.filter( + (game) => !["complete", "seeding"].includes(game.status!) + ), + "timestamp", + "DESC" + ); }); const [nextItemOnQueue] = downloads; diff --git a/src/renderer/src/components/sidebar/sidebar.tsx b/src/renderer/src/components/sidebar/sidebar.tsx index 9b3886679..d0348bb73 100644 --- a/src/renderer/src/components/sidebar/sidebar.tsx +++ b/src/renderer/src/components/sidebar/sidebar.tsx @@ -128,9 +128,8 @@ export function Sidebar() { if (game.download?.status === "paused") return t("paused", { title: game.title }); - if (game.download) { + if (game.download?.status === "active") return t("queued", { title: game.title }); - } return game.title; }; diff --git a/src/renderer/src/context/game-details/game-details.context.tsx b/src/renderer/src/context/game-details/game-details.context.tsx index 91a638615..d94293274 100644 --- a/src/renderer/src/context/game-details/game-details.context.tsx +++ b/src/renderer/src/context/game-details/game-details.context.tsx @@ -81,7 +81,7 @@ export function GameDetailsContextProvider({ const [isLoading, setIsLoading] = useState(false); const [gameColor, setGameColor] = useState(""); - const [isGameRunning, setisGameRunning] = useState(false); + const [isGameRunning, setIsGameRunning] = useState(false); const [showRepacksModal, setShowRepacksModal] = useState(false); const [showGameOptionsModal, setShowGameOptionsModal] = useState(false); @@ -168,7 +168,7 @@ export function GameDetailsContextProvider({ setShopDetails(null); setGame(null); setIsLoading(true); - setisGameRunning(false); + setIsGameRunning(false); setAchievements(null); dispatch(setHeaderTitle(gameTitle)); }, [objectId, gameTitle, dispatch]); @@ -183,8 +183,9 @@ export function GameDetailsContextProvider({ updateGame(); } - setisGameRunning(updatedIsGameRunning); + setIsGameRunning(updatedIsGameRunning); }); + return () => { unsubscribe(); }; diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index 046398d44..390b8c5e9 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -27,6 +27,7 @@ import type { ComparedAchievements, CatalogueSearchPayload, LibraryGame, + GameRunning, } from "@types"; import type { AxiosProgressEvent } from "axios"; import type disk from "diskusage"; diff --git a/src/renderer/src/pages/game-details/sidebar/sidebar.tsx b/src/renderer/src/pages/game-details/sidebar/sidebar.tsx index d3a65ae5d..3e11be216 100644 --- a/src/renderer/src/pages/game-details/sidebar/sidebar.tsx +++ b/src/renderer/src/pages/game-details/sidebar/sidebar.tsx @@ -212,7 +212,6 @@ export function Sidebar() { ))}