mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: using showItemInFolder to open exe and download paths
This commit is contained in:
parent
cead92d900
commit
08eda5573d
7 changed files with 28 additions and 21 deletions
2
src/renderer/src/declaration.d.ts
vendored
2
src/renderer/src/declaration.d.ts
vendored
|
@ -63,7 +63,7 @@ declare global {
|
|||
getLibrary: () => Promise<LibraryGame[]>;
|
||||
openGameInstaller: (gameId: number) => Promise<boolean>;
|
||||
openGameInstallerPath: (gameId: number) => Promise<boolean>;
|
||||
openGameExecutablePath: (gameId: number) => Promise<boolean>;
|
||||
openGameExecutablePath: (gameId: number) => Promise<void>;
|
||||
openGame: (gameId: number, executablePath: string) => Promise<void>;
|
||||
closeGame: (gameId: number) => Promise<boolean>;
|
||||
removeGameFromLibrary: (gameId: number) => Promise<void>;
|
||||
|
|
|
@ -140,7 +140,7 @@ export function HeroPanelActions() {
|
|||
setShowGameOptionsModal(true);
|
||||
}}
|
||||
theme="outline"
|
||||
disabled={deleting}
|
||||
disabled={deleting || isGameRunning}
|
||||
className={styles.heroPanelAction}
|
||||
>
|
||||
<GearIcon />
|
||||
|
|
|
@ -21,6 +21,8 @@ export function GameOptionsModal({
|
|||
onClose,
|
||||
selectGameExecutable,
|
||||
}: GameOptionsModalProps) {
|
||||
const { t } = useTranslation("game_details");
|
||||
|
||||
const { updateGame, openRepacksModal } = useContext(gameDetailsContext);
|
||||
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
|
@ -30,7 +32,10 @@ export function GameOptionsModal({
|
|||
|
||||
const deleting = game ? isGameDeleting(game?.id) : false;
|
||||
|
||||
const { t } = useTranslation("game_details");
|
||||
const { lastPacket } = useDownload();
|
||||
|
||||
const isGameDownloading =
|
||||
game?.status === "active" && lastPacket?.game.id === game?.id;
|
||||
|
||||
const handleRemoveGameFromLibrary = async () => {
|
||||
await removeGameFromLibrary(game.id);
|
||||
|
@ -51,6 +56,10 @@ export function GameOptionsModal({
|
|||
await window.electron.createGameShortcut(game.id);
|
||||
};
|
||||
|
||||
const handleOpenDownloadFolder = async () => {
|
||||
await window.electron.openGameInstallerPath(game.id);
|
||||
};
|
||||
|
||||
const handleDeleteGame = async () => {
|
||||
await removeGameInstaller(game.id);
|
||||
updateGame();
|
||||
|
@ -84,12 +93,12 @@ export function GameOptionsModal({
|
|||
{t("open_download_options")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleCreateShortcut}
|
||||
onClick={handleOpenDownloadFolder}
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
theme="outline"
|
||||
disabled={deleting || !game.downloadPath}
|
||||
>
|
||||
{"Abrir local de download"}
|
||||
{t("open_download_location")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleCreateShortcut}
|
||||
|
@ -129,13 +138,15 @@ export function GameOptionsModal({
|
|||
</div>
|
||||
<div className={styles.gameOptionRow}>
|
||||
<Button
|
||||
onClick={handleCreateShortcut}
|
||||
onClick={() => {
|
||||
setShowDeleteModal(true);
|
||||
}}
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
theme="outline"
|
||||
disabled={deleting || !game.downloadPath}
|
||||
disabled={isGameDownloading || deleting || !game.downloadPath}
|
||||
>
|
||||
<TrashIcon />
|
||||
Remover arquivos
|
||||
{t("remove_files")}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
|
@ -145,7 +156,7 @@ export function GameOptionsModal({
|
|||
disabled={deleting}
|
||||
>
|
||||
<NoEntryIcon />
|
||||
Remover da biblioteca
|
||||
{t("remove_from_library")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue