From e3fa4016672a936a539a13f0e7f0705ad97b4242 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 14 Sep 2024 15:32:27 -0300 Subject: [PATCH] feat: show download button if game has no executable selected --- .../game-details/hero/hero-panel-actions.tsx | 68 +++++++++++++------ 1 file changed, 48 insertions(+), 20 deletions(-) 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 795aa8af..323b3c8f 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 @@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next"; import * as styles from "./hero-panel-actions.css"; import { gameDetailsContext } from "@renderer/context"; +import { DownloadIcon } from "@renderer/components/sidebar/download-icon"; export function HeroPanelActions() { const [toggleLibraryGameDisabled, setToggleLibraryGameDisabled] = @@ -25,6 +26,11 @@ export function HeroPanelActions() { selectGameExecutable, } = useContext(gameDetailsContext); + const { lastPacket } = useDownload(); + + const isGameDownloading = + game?.status === "active" && lastPacket?.game.id === game?.id; + const { updateLibrary } = useLibrary(); const { t } = useTranslation("game_details"); @@ -84,6 +90,47 @@ export function HeroPanelActions() { ); + const gameActionButton = () => { + if (isGameRunning) { + return ( + + ); + } + + if (game?.executablePath) { + return ( + + ); + } + + return ( + + ); + }; + if (repacks.length && !game) { return ( <> @@ -96,26 +143,7 @@ export function HeroPanelActions() { if (game) { return (
- {isGameRunning ? ( - - ) : ( - - )} + {gameActionButton()}