diff --git a/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx b/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx index b36bec23..a2467b4a 100644 --- a/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx +++ b/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx @@ -1,5 +1,7 @@ import { NoEntryIcon, PlusCircleIcon } from "@primer/octicons-react"; +import { BinaryNotFoundModal } from "../../shared-modals/binary-not-found-modal"; + import { Button } from "@renderer/components"; import { useDownload, useLibrary } from "@renderer/hooks"; import { useContext, useState } from "react"; @@ -11,6 +13,7 @@ import { gameDetailsContext } from "../game-details.context"; export function HeroPanelActions() { const [toggleLibraryGameDisabled, setToggleLibraryGameDisabled] = useState(false); + const [showBinaryNotFoundModal, setShowBinaryNotFoundModal] = useState(false); const { resumeDownload, @@ -90,7 +93,7 @@ export function HeroPanelActions() { const openGameInstaller = () => { if (game) { window.electron.openGameInstaller(game.id).then((isBinaryInPath) => { - if (!isBinaryInPath) openBinaryNotFoundModal(); + if (!isBinaryInPath) setShowBinaryNotFoundModal(true); updateLibrary(); }); } @@ -252,5 +255,14 @@ export function HeroPanelActions() { ); } - return toggleGameOnLibraryButton; + return ( + <> + setShowBinaryNotFoundModal(false)} + /> + + {toggleGameOnLibraryButton} + + ); } diff --git a/src/renderer/src/pages/game-details/hero/hero-panel.tsx b/src/renderer/src/pages/game-details/hero/hero-panel.tsx index 7d72d5b7..c07ca22c 100644 --- a/src/renderer/src/pages/game-details/hero/hero-panel.tsx +++ b/src/renderer/src/pages/game-details/hero/hero-panel.tsx @@ -1,5 +1,5 @@ import { format } from "date-fns"; -import { useContext, useMemo, useState } from "react"; +import { useContext, useMemo } from "react"; import { useTranslation } from "react-i18next"; import Color from "color"; @@ -9,7 +9,6 @@ import { formatDownloadProgress } from "@renderer/helpers"; import { HeroPanelActions } from "./hero-panel-actions"; import { Downloader, formatBytes } from "@shared"; -import { BinaryNotFoundModal } from "../../shared-modals/binary-not-found-modal"; import * as styles from "./hero-panel.css"; import { HeroPanelPlaytime } from "./hero-panel-playtime"; import { gameDetailsContext } from "../game-details.context"; @@ -19,8 +18,6 @@ export function HeroPanel() { const { game, repacks, gameColor } = useContext(gameDetailsContext); - const [showBinaryNotFoundModal, setShowBinaryNotFoundModal] = useState(false); - const { progress, eta, lastPacket, isGameDeleting } = useDownload(); const finalDownloadSize = useMemo(() => { @@ -125,17 +122,10 @@ export function HeroPanel() { return ( <> - setShowBinaryNotFoundModal(false)} - /> -
{getInfo()}
- setShowBinaryNotFoundModal(true)} - /> +
{showProgressBar && (