From 6b2a480fa666a29fca9310dc8c09dc70b9aa6de3 Mon Sep 17 00:00:00 2001 From: Hydra Date: Tue, 30 Apr 2024 03:27:07 +0100 Subject: [PATCH] fix: fixing typecheck errors --- .github/workflows/build.yml | 2 +- .github/workflows/contributors.yml | 4 ++-- resources/hydra.db | 0 src/main/services/update-resolver.ts | 2 +- src/renderer/src/declaration.d.ts | 1 + src/renderer/src/pages/game-details/game-details.tsx | 10 +++++----- .../src/pages/game-details/repacks-modal.tsx | 2 +- .../src/pages/game-details/select-folder-modal.tsx | 12 +++++++----- src/renderer/src/pages/home/home.tsx | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 resources/hydra.db diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 594c2d1c..ea9180bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: push: - branches: "**" + branches: main jobs: build: diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 7eacd031..921eed6c 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -2,10 +2,10 @@ name: Contributors on: push: - branches: "**" + branches: main jobs: - lint: + contributors: runs-on: ubuntu-latest steps: diff --git a/resources/hydra.db b/resources/hydra.db new file mode 100644 index 00000000..e69de29b diff --git a/src/main/services/update-resolver.ts b/src/main/services/update-resolver.ts index 8701d17d..ef9a5ade 100644 --- a/src/main/services/update-resolver.ts +++ b/src/main/services/update-resolver.ts @@ -109,7 +109,7 @@ export const resolveDatabaseUpdates = async () => { const updateDataSource = createDataSource({ database: app.isPackaged ? path.join(process.resourcesPath, "hydra.db") - : path.join(__dirname, "..", "..", "resources", "hydra.db"), + : path.join(__dirname, "..", "..", "hydra.db"), }); return updateDataSource.initialize().then(async () => { diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index a478f687..661253d0 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -21,6 +21,7 @@ declare global { startGameDownload: ( repackId: number, objectID: string, + title: string, shop: GameShop, downloadPath: string ) => Promise; diff --git a/src/renderer/src/pages/game-details/game-details.tsx b/src/renderer/src/pages/game-details/game-details.tsx index adbe7ca0..8f5c6405 100644 --- a/src/renderer/src/pages/game-details/game-details.tsx +++ b/src/renderer/src/pages/game-details/game-details.tsx @@ -75,7 +75,7 @@ export function GameDetails() { const getGame = useCallback(() => { window.electron - .getGameByObjectID(objectID) + .getGameByObjectID(objectID!) .then((result) => setGame(result)); }, [setGame, objectID]); @@ -92,7 +92,7 @@ export function GameDetails() { getRandomGame(); window.electron - .getGameShopDetails(objectID, "steam", getSteamLanguage(i18n.language)) + .getGameShopDetails(objectID!, "steam", getSteamLanguage(i18n.language)) .then((result) => { if (!result) { navigate(-1); @@ -100,7 +100,7 @@ export function GameDetails() { } window.electron - .getHowLongToBeat(objectID, "steam", result.name) + .getHowLongToBeat(objectID!, "steam", result.name) .then((data) => { setHowLongToBeat({ isLoading: false, data }); }); @@ -191,7 +191,7 @@ export function GameDetails() {
diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index a8c7d368..fe684a85 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -29,7 +29,7 @@ export function RepacksModal({ onClose, }: RepacksModalProps) { const [filteredRepacks, setFilteredRepacks] = useState([]); - const [repack, setRepack] = useState(null); + const [repack, setRepack] = useState(null); const repackersFriendlyNames = useAppSelector( (state) => state.repackersFriendlyNames.value diff --git a/src/renderer/src/pages/game-details/select-folder-modal.tsx b/src/renderer/src/pages/game-details/select-folder-modal.tsx index 0a86c37e..af6e4691 100644 --- a/src/renderer/src/pages/game-details/select-folder-modal.tsx +++ b/src/renderer/src/pages/game-details/select-folder-modal.tsx @@ -13,7 +13,7 @@ export interface SelectFolderModalProps { gameDetails: ShopDetails; onClose: () => void; startDownload: (repackId: number, downloadPath: string) => Promise; - repack: GameRepack; + repack: GameRepack | null; } export function SelectFolderModal({ @@ -61,10 +61,12 @@ export function SelectFolderModal({ }; const handleStartClick = () => { - setDownloadStarting(true); - startDownload(repack.id, selectedPath).finally(() => { - setDownloadStarting(false); - }); + if (repack) { + setDownloadStarting(true); + startDownload(repack.id, selectedPath).finally(() => { + setDownloadStarting(false); + }); + } }; return ( diff --git a/src/renderer/src/pages/home/home.tsx b/src/renderer/src/pages/home/home.tsx index da561016..d4739d6a 100644 --- a/src/renderer/src/pages/home/home.tsx +++ b/src/renderer/src/pages/home/home.tsx @@ -51,7 +51,7 @@ export function Home() { const handleSelectCategory = (category: CatalogueCategory) => { if (category !== currentCategory) { getCatalogue(category); - navigate(`/?category=${category}`, { replace: true }); + navigate(`/?category=${category}`); } };