Skip to content

Commit

Permalink
fix: games with less then 4 grids now load
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed Jun 9, 2023
1 parent 31fe27c commit 5681304
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</svg>
</IconButton>
<HorizontalSpacer />
<IconButton label="Manul Games" onClick={() => { $showManualGamesModal = true; }} width="auto" tooltipPosition="auto">
<IconButton label="Manage Manul Games" onClick={() => { $showManualGamesModal = true; }} width="auto" tooltipPosition="auto">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" style="height: 12px; width: 12px;">
<!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
<path d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z"/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/core/grids/Grid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { AppController } from "../../../lib/controllers/AppController";
import type { SGDBImage } from "../../../lib/models/SGDB";
import { throttle } from "../../../lib/utils/Utils";
import { throttle } from "../../../lib/utils/Utils";
import { dowloadingGridId, gridType } from "../../../Stores";
import LoadingSpinner from "../../info/LoadingSpinner.svelte";
Expand Down
14 changes: 13 additions & 1 deletion src/components/toast-modals/manual-games/ManualGamesModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Search from "./add-methods/Search.svelte";
import Manual from "./add-methods/Manual.svelte";
import Table from "../../layout/Table.svelte";
import { manualSteamGames } from "../../../Stores";
import { appLibraryCache, manualSteamGames, originalAppLibraryCache } from "../../../Stores";
import { LogController } from "../../../lib/controllers/LogController";
import { SettingsManager } from "../../../lib/utils/SettingsManager";
import ModalBody from "../modal-utils/ModalBody.svelte";
Expand Down Expand Up @@ -55,6 +55,18 @@
async function saveChanges() {
// TODO: update state
manualSteamGames.set(JSON.parse(JSON.stringify(tempManualGames)));
const originalAppLibCache = $originalAppLibraryCache;
const appLibCache = $appLibraryCache;
for (const game of tempManualGames) {
if (!originalAppLibCache[game.appid]) originalAppLibCache[game.appid] = { "Capsule": "", "Wide Capsule": "", "Hero": "", "Logo": "", "Icon": "" };
if (!appLibCache[game.appid]) appLibCache[game.appid] = { "Capsule": "", "Wide Capsule": "", "Hero": "", "Logo": "", "Icon": "" };
}
originalAppLibraryCache.set(JSON.parse(JSON.stringify(originalAppLibCache)));
appLibraryCache.set(JSON.parse(JSON.stringify(appLibCache)));
// TODO: save settings
SettingsManager.updateSetting("manualSteamGames", tempManualGames);
// TODO: log
Expand Down
4 changes: 3 additions & 1 deletion src/lib/controllers/AppController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class AppController {

if (settings.manualSteamGames.length > 0) {
manualSteamGames.set(settings.manualSteamGames);
LogController.log(`Loaded ${settings.manualSteamGames.length} manually added games.`);
}

theme.set(settings.theme);
Expand Down Expand Up @@ -286,7 +287,8 @@ export class AppController {

const entries = Object.entries(res);
unfilteredLibraryCache.set(JSON.parse(JSON.stringify(unfiltered)));
const filtered = entries.filter(([appId, entry]) => Object.keys(entry).length >= 4 || shortcutIds.includes(appId));
// const filtered = entries.filter(([appId, entry]) => Object.keys(entry).length >= 4 || shortcutIds.includes(appId)); //! Removed this because it caused issues with games with no grids
const filtered = entries;
return Object.fromEntries(filtered);
}

Expand Down

0 comments on commit 5681304

Please sign in to comment.