fix: play button not showing when manually adding game to library

This commit is contained in:
Chubby Granny Chaser 2024-05-30 01:24:47 +01:00
parent e6829ca39b
commit c9cb279213
No known key found for this signature in database

View file

@ -139,46 +139,7 @@ export function HeroPanelActions() {
</Button>
);
if (game?.progress === 1) {
return (
<>
{game?.progress === 1 ? (
<Button
onClick={openGameInstaller}
theme="outline"
disabled={deleting || isGameRunning}
className={styles.heroPanelAction}
>
{t("install")}
</Button>
) : (
toggleGameOnLibraryButton
)}
{isGameRunning ? (
<Button
onClick={closeGame}
theme="outline"
disabled={deleting}
className={styles.heroPanelAction}
>
{t("close")}
</Button>
) : (
<Button
onClick={openGame}
theme="outline"
disabled={deleting || isGameRunning}
className={styles.heroPanelAction}
>
{t("play")}
</Button>
)}
</>
);
}
if (game?.status === "active") {
if (game?.status === "active" && game?.progress !== 1) {
return (
<>
<Button
@ -248,7 +209,7 @@ export function HeroPanelActions() {
);
}
if (repacks.length) {
if (repacks.length && !game) {
return (
<>
{toggleGameOnLibraryButton}
@ -265,12 +226,45 @@ export function HeroPanelActions() {
return (
<>
<BinaryNotFoundModal
visible={showBinaryNotFoundModal}
onClose={() => setShowBinaryNotFoundModal(false)}
/>
{game?.progress === 1 ? (
<>
<BinaryNotFoundModal
visible={showBinaryNotFoundModal}
onClose={() => setShowBinaryNotFoundModal(false)}
/>
{toggleGameOnLibraryButton}
<Button
onClick={openGameInstaller}
theme="outline"
disabled={deleting || isGameRunning}
className={styles.heroPanelAction}
>
{t("install")}
</Button>
</>
) : (
toggleGameOnLibraryButton
)}
{isGameRunning ? (
<Button
onClick={closeGame}
theme="outline"
disabled={deleting}
className={styles.heroPanelAction}
>
{t("close")}
</Button>
) : (
<Button
onClick={openGame}
theme="outline"
disabled={deleting || isGameRunning}
className={styles.heroPanelAction}
>
{t("play")}
</Button>
)}
</>
);
}