mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: add modal to warning user about wine/lutris binaries
This commit is contained in:
parent
fb9065408f
commit
1fad610f29
7 changed files with 53 additions and 4 deletions
|
@ -107,5 +107,10 @@
|
||||||
},
|
},
|
||||||
"game_card": {
|
"game_card": {
|
||||||
"no_downloads": "No downloads available"
|
"no_downloads": "No downloads available"
|
||||||
|
},
|
||||||
|
"binary_not_found_modal": {
|
||||||
|
"title": "Programs not installed",
|
||||||
|
"description": "Wine or Lutris executables were not found on your system",
|
||||||
|
"instructions": "Check the correct way to install any of them on your Linux distro so that the game can run normally"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,5 +107,10 @@
|
||||||
},
|
},
|
||||||
"game_card": {
|
"game_card": {
|
||||||
"no_downloads": "No hay descargas disponibles"
|
"no_downloads": "No hay descargas disponibles"
|
||||||
|
},
|
||||||
|
"binary_not_found_modal": {
|
||||||
|
"title": "Programas no instalados",
|
||||||
|
"description": "Los ejecutables de Wine o Lutris no se encontraron en su sistema",
|
||||||
|
"instructions": "Comprueba la forma correcta de instalar cualquiera de ellos en tu distro Linux para que el juego pueda ejecutarse con normalidad"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,5 +107,10 @@
|
||||||
},
|
},
|
||||||
"game_card": {
|
"game_card": {
|
||||||
"no_downloads": "Sem downloads disponíveis"
|
"no_downloads": "Sem downloads disponíveis"
|
||||||
|
},
|
||||||
|
"binary_not_found_modal": {
|
||||||
|
"title": "Programas não instalados",
|
||||||
|
"description": "Não foram encontrados no seu sistema os executáveis do Wine ou Lutris",
|
||||||
|
"instructions": "Verifique a forma correta de instalar algum deles na sua distro Linux para que o jogo possa ser executado normalmente"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
src/renderer/declaration.d.ts
vendored
2
src/renderer/declaration.d.ts
vendored
|
@ -43,7 +43,7 @@ declare global {
|
||||||
/* Library */
|
/* Library */
|
||||||
getLibrary: () => Promise<Game[]>;
|
getLibrary: () => Promise<Game[]>;
|
||||||
getRepackersFriendlyNames: () => Promise<Record<string, string>>;
|
getRepackersFriendlyNames: () => Promise<Record<string, string>>;
|
||||||
openGame: (gameId: number) => Promise<void>;
|
openGame: (gameId: number) => Promise<boolean>;
|
||||||
removeGame: (gameId: number) => Promise<void>;
|
removeGame: (gameId: number) => Promise<void>;
|
||||||
deleteGameFolder: (gameId: number) => Promise<unknown>;
|
deleteGameFolder: (gameId: number) => Promise<unknown>;
|
||||||
getGameByObjectID: (objectID: string) => Promise<Game | null>;
|
getGameByObjectID: (objectID: string) => Promise<Game | null>;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import type { Game } from "@types";
|
||||||
|
|
||||||
import * as styles from "./downloads.css";
|
import * as styles from "./downloads.css";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { BinaryNotFoundModal } from "../shared-modals/binary-not-found-modal";
|
||||||
|
|
||||||
export function Downloads() {
|
export function Downloads() {
|
||||||
const { library, updateLibrary } = useLibrary();
|
const { library, updateLibrary } = useLibrary();
|
||||||
|
@ -18,6 +19,7 @@ export function Downloads() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [filteredLibrary, setFilteredLibrary] = useState<Game[]>([]);
|
const [filteredLibrary, setFilteredLibrary] = useState<Game[]>([]);
|
||||||
|
const [showBinaryNotFoundModal, setShowBinaryNotFoundModal] = useState<boolean>(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
game: gameDownloading,
|
game: gameDownloading,
|
||||||
|
@ -37,7 +39,8 @@ export function Downloads() {
|
||||||
}, [library]);
|
}, [library]);
|
||||||
|
|
||||||
const openGame = (gameId: number) =>
|
const openGame = (gameId: number) =>
|
||||||
window.electron.openGame(gameId).then(() => {
|
window.electron.openGame(gameId).then(res => {
|
||||||
|
if (!res) setShowBinaryNotFoundModal(true);
|
||||||
updateLibrary();
|
updateLibrary();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -202,6 +205,7 @@ export function Downloads() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={styles.downloadsContainer}>
|
<section className={styles.downloadsContainer}>
|
||||||
|
<BinaryNotFoundModal visible={showBinaryNotFoundModal} onClose={() => setShowBinaryNotFoundModal(false)} />
|
||||||
<TextField placeholder={t("filter")} onChange={handleFilter} />
|
<TextField placeholder={t("filter")} onChange={handleFilter} />
|
||||||
|
|
||||||
<ul className={styles.downloads}>
|
<ul className={styles.downloads}>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useMemo } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import prettyBytes from "pretty-bytes";
|
import prettyBytes from "pretty-bytes";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
@ -9,6 +9,7 @@ import type { Game, ShopDetails } from "@types";
|
||||||
|
|
||||||
import * as styles from "./hero-panel.css";
|
import * as styles from "./hero-panel.css";
|
||||||
import { formatDownloadProgress } from "@renderer/helpers";
|
import { formatDownloadProgress } from "@renderer/helpers";
|
||||||
|
import { BinaryNotFoundModal } from "../shared-modals/binary-not-found-modal";
|
||||||
|
|
||||||
export interface HeroPanelProps {
|
export interface HeroPanelProps {
|
||||||
game: Game | null;
|
game: Game | null;
|
||||||
|
@ -27,6 +28,8 @@ export function HeroPanel({
|
||||||
}: HeroPanelProps) {
|
}: HeroPanelProps) {
|
||||||
const { t } = useTranslation("game_details");
|
const { t } = useTranslation("game_details");
|
||||||
|
|
||||||
|
const [showBinaryNotFoundModal, setShowBinaryNotFoundModal] = useState<boolean>(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
game: gameDownloading,
|
game: gameDownloading,
|
||||||
isDownloading,
|
isDownloading,
|
||||||
|
@ -46,7 +49,8 @@ export function HeroPanel({
|
||||||
const isGameDownloading = isDownloading && gameDownloading?.id === game?.id;
|
const isGameDownloading = isDownloading && gameDownloading?.id === game?.id;
|
||||||
|
|
||||||
const openGame = (gameId: number) =>
|
const openGame = (gameId: number) =>
|
||||||
window.electron.openGame(gameId).then(() => {
|
window.electron.openGame(gameId).then(res => {
|
||||||
|
if (!res) setShowBinaryNotFoundModal(true);
|
||||||
updateLibrary();
|
updateLibrary();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -202,6 +206,7 @@ export function HeroPanel({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ backgroundColor: color }} className={styles.panel}>
|
<div style={{ backgroundColor: color }} className={styles.panel}>
|
||||||
|
<BinaryNotFoundModal visible={showBinaryNotFoundModal} onClose={() => setShowBinaryNotFoundModal(false)} />
|
||||||
<div className={styles.content}>{getInfo()}</div>
|
<div className={styles.content}>{getInfo()}</div>
|
||||||
<div className={styles.actions}>{getActions()}</div>
|
<div className={styles.actions}>{getActions()}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
25
src/renderer/pages/shared-modals/binary-not-found-modal.tsx
Normal file
25
src/renderer/pages/shared-modals/binary-not-found-modal.tsx
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { Modal } from "@renderer/components"
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
interface BinaryNotFoundModalProps {
|
||||||
|
visible: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const BinaryNotFoundModal = ({
|
||||||
|
visible,
|
||||||
|
onClose
|
||||||
|
}: BinaryNotFoundModalProps) => {
|
||||||
|
const { t } = useTranslation("binary_not_found_modal");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
visible={visible}
|
||||||
|
title={t("title")}
|
||||||
|
description={t("description")}
|
||||||
|
onClose={onClose}
|
||||||
|
>
|
||||||
|
{t("instructions")}
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue