Skip to content

Commit da111fc

Browse files
authored
[Fix] Showing Install Path for Browser games (#1043)
* [Fix] Showing Install Path for Browser games * ui: dont show import button for browser games --------- Co-authored-by: Flavio F Lima <flavioislima@users.noreply.github.com>
1 parent 55c3860 commit da111fc

File tree

1 file changed

+74
-69
lines changed
  • src/frontend/screens/Library/components/InstallModal/DownloadDialog

1 file changed

+74
-69
lines changed

src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx

+74-69
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export default function DownloadDialog({
131131

132132
const isWin = platform === 'win32'
133133
const isNotNative = platformToInstall === 'Windows' && !isWin
134+
const isBrowserGame = platformToInstall === 'Browser'
134135

135136
const [gameInstallInfo, setGameInstallInfo] = useState<
136137
LegendaryInstallInfo | GogInstallInfo | HyperPlayInstallInfo | null
@@ -546,70 +547,72 @@ export default function DownloadDialog({
546547
</SelectField>
547548
)}
548549

549-
<TextInputWithIconField
550-
htmlId="setinstallpath"
551-
label={t('install.path', 'Select Install Path')}
552-
placeholder={getDefaultInstallPath()}
553-
value={installPath.replaceAll("'", '')}
554-
onChange={(event) => setInstallPath(event.target.value)}
555-
icon={<FontAwesomeIcon icon={faFolderOpen} />}
556-
inputProps={{ readOnly: true, className: styles.folderTextInput }}
557-
onIconClick={async () =>
558-
window.api
559-
.openDialog({
560-
buttonLabel: t('box.choose'),
561-
properties: ['openDirectory'],
562-
title: t('install.path'),
563-
defaultPath: getDefaultInstallPath()
564-
})
565-
.then((path) => setInstallPath(path || getDefaultInstallPath()))
566-
}
567-
afterInput={
568-
gameDownloadSize ? (
569-
<span className="smallInputInfo">
570-
{validPath && (
571-
<>
572-
<span>
573-
{`${t('install.disk-space-left', 'Space Available')}: `}
550+
{isBrowserGame ? null : (
551+
<TextInputWithIconField
552+
htmlId="setinstallpath"
553+
label={t('install.path', 'Select Install Path')}
554+
placeholder={getDefaultInstallPath()}
555+
value={installPath.replaceAll("'", '')}
556+
onChange={(event) => setInstallPath(event.target.value)}
557+
icon={<FontAwesomeIcon icon={faFolderOpen} />}
558+
inputProps={{ readOnly: true, className: styles.folderTextInput }}
559+
onIconClick={async () =>
560+
window.api
561+
.openDialog({
562+
buttonLabel: t('box.choose'),
563+
properties: ['openDirectory'],
564+
title: t('install.path'),
565+
defaultPath: getDefaultInstallPath()
566+
})
567+
.then((path) => setInstallPath(path || getDefaultInstallPath()))
568+
}
569+
afterInput={
570+
gameDownloadSize ? (
571+
<span className="smallInputInfo">
572+
{validPath && (
573+
<>
574+
<span>
575+
{`${t('install.disk-space-left', 'Space Available')}: `}
576+
</span>
577+
<span>
578+
<strong>{`${message}`}</strong>
579+
</span>
580+
{!notEnoughDiskSpace && (
581+
<>
582+
<span>
583+
{` - ${t(
584+
'install.space-after-install',
585+
'After Install'
586+
)}: `}
587+
</span>
588+
<span>
589+
<strong>{`${spaceLeftAfter}`}</strong>
590+
</span>
591+
</>
592+
)}
593+
</>
594+
)}
595+
{!validPath && (
596+
<span className="warning">
597+
{`${t(
598+
'install.path-not-writtable',
599+
'Warning: path might not be writable.'
600+
)}`}
574601
</span>
575-
<span>
576-
<strong>{`${message}`}</strong>
602+
)}
603+
{validPath && notEnoughDiskSpace && (
604+
<span className="warning">
605+
{` (${t(
606+
'install.not-enough-disk-space',
607+
'Not enough disk space'
608+
)})`}
577609
</span>
578-
{!notEnoughDiskSpace && (
579-
<>
580-
<span>
581-
{` - ${t(
582-
'install.space-after-install',
583-
'After Install'
584-
)}: `}
585-
</span>
586-
<span>
587-
<strong>{`${spaceLeftAfter}`}</strong>
588-
</span>
589-
</>
590-
)}
591-
</>
592-
)}
593-
{!validPath && (
594-
<span className="warning">
595-
{`${t(
596-
'install.path-not-writtable',
597-
'Warning: path might not be writable.'
598-
)}`}
599-
</span>
600-
)}
601-
{validPath && notEnoughDiskSpace && (
602-
<span className="warning">
603-
{` (${t(
604-
'install.not-enough-disk-space',
605-
'Not enough disk space'
606-
)})`}
607-
</span>
608-
)}
609-
</span>
610-
) : null
611-
}
612-
/>
610+
)}
611+
</span>
612+
) : null
613+
}
614+
/>
615+
)}
613616
{children}
614617
{haveSDL ? (
615618
<div className="InstallModal__sdls">
@@ -654,13 +657,15 @@ export default function DownloadDialog({
654657
)}
655658
</div>
656659
<DialogFooter>
657-
<Button
658-
type="tertiary"
659-
size="medium"
660-
onClick={async () => handleInstall('import')}
661-
>
662-
{t('button.import')}
663-
</Button>
660+
{isBrowserGame ? null : (
661+
<Button
662+
type="tertiary"
663+
size="medium"
664+
onClick={async () => handleInstall('import')}
665+
>
666+
{t('button.import')}
667+
</Button>
668+
)}
664669
<Button
665670
type="secondary"
666671
size="medium"

0 commit comments

Comments
 (0)