mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-13 19:52:08 +00:00
feat: using retry system to connect to aria2
This commit is contained in:
parent
ffb3d79954
commit
d353002eab
2 changed files with 16 additions and 14 deletions
|
@ -1,5 +1,7 @@
|
||||||
import { NoEntryIcon, PlusCircleIcon } from "@primer/octicons-react";
|
import { NoEntryIcon, PlusCircleIcon } from "@primer/octicons-react";
|
||||||
|
|
||||||
|
import { BinaryNotFoundModal } from "../../shared-modals/binary-not-found-modal";
|
||||||
|
|
||||||
import { Button } from "@renderer/components";
|
import { Button } from "@renderer/components";
|
||||||
import { useDownload, useLibrary } from "@renderer/hooks";
|
import { useDownload, useLibrary } from "@renderer/hooks";
|
||||||
import { useContext, useState } from "react";
|
import { useContext, useState } from "react";
|
||||||
|
@ -11,6 +13,7 @@ import { gameDetailsContext } from "../game-details.context";
|
||||||
export function HeroPanelActions() {
|
export function HeroPanelActions() {
|
||||||
const [toggleLibraryGameDisabled, setToggleLibraryGameDisabled] =
|
const [toggleLibraryGameDisabled, setToggleLibraryGameDisabled] =
|
||||||
useState(false);
|
useState(false);
|
||||||
|
const [showBinaryNotFoundModal, setShowBinaryNotFoundModal] = useState(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
resumeDownload,
|
resumeDownload,
|
||||||
|
@ -90,7 +93,7 @@ export function HeroPanelActions() {
|
||||||
const openGameInstaller = () => {
|
const openGameInstaller = () => {
|
||||||
if (game) {
|
if (game) {
|
||||||
window.electron.openGameInstaller(game.id).then((isBinaryInPath) => {
|
window.electron.openGameInstaller(game.id).then((isBinaryInPath) => {
|
||||||
if (!isBinaryInPath) openBinaryNotFoundModal();
|
if (!isBinaryInPath) setShowBinaryNotFoundModal(true);
|
||||||
updateLibrary();
|
updateLibrary();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -252,5 +255,14 @@ export function HeroPanelActions() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return toggleGameOnLibraryButton;
|
return (
|
||||||
|
<>
|
||||||
|
<BinaryNotFoundModal
|
||||||
|
visible={showBinaryNotFoundModal}
|
||||||
|
onClose={() => setShowBinaryNotFoundModal(false)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{toggleGameOnLibraryButton}
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { useContext, useMemo, useState } from "react";
|
import { useContext, useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import Color from "color";
|
import Color from "color";
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import { formatDownloadProgress } from "@renderer/helpers";
|
||||||
import { HeroPanelActions } from "./hero-panel-actions";
|
import { HeroPanelActions } from "./hero-panel-actions";
|
||||||
import { Downloader, formatBytes } from "@shared";
|
import { Downloader, formatBytes } from "@shared";
|
||||||
|
|
||||||
import { BinaryNotFoundModal } from "../../shared-modals/binary-not-found-modal";
|
|
||||||
import * as styles from "./hero-panel.css";
|
import * as styles from "./hero-panel.css";
|
||||||
import { HeroPanelPlaytime } from "./hero-panel-playtime";
|
import { HeroPanelPlaytime } from "./hero-panel-playtime";
|
||||||
import { gameDetailsContext } from "../game-details.context";
|
import { gameDetailsContext } from "../game-details.context";
|
||||||
|
@ -19,8 +18,6 @@ export function HeroPanel() {
|
||||||
|
|
||||||
const { game, repacks, gameColor } = useContext(gameDetailsContext);
|
const { game, repacks, gameColor } = useContext(gameDetailsContext);
|
||||||
|
|
||||||
const [showBinaryNotFoundModal, setShowBinaryNotFoundModal] = useState(false);
|
|
||||||
|
|
||||||
const { progress, eta, lastPacket, isGameDeleting } = useDownload();
|
const { progress, eta, lastPacket, isGameDeleting } = useDownload();
|
||||||
|
|
||||||
const finalDownloadSize = useMemo(() => {
|
const finalDownloadSize = useMemo(() => {
|
||||||
|
@ -125,17 +122,10 @@ export function HeroPanel() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BinaryNotFoundModal
|
|
||||||
visible={showBinaryNotFoundModal}
|
|
||||||
onClose={() => setShowBinaryNotFoundModal(false)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div style={{ backgroundColor }} className={styles.panel}>
|
<div style={{ backgroundColor }} className={styles.panel}>
|
||||||
<div className={styles.content}>{getInfo()}</div>
|
<div className={styles.content}>{getInfo()}</div>
|
||||||
<div className={styles.actions}>
|
<div className={styles.actions}>
|
||||||
<HeroPanelActions
|
<HeroPanelActions />
|
||||||
openBinaryNotFoundModal={() => setShowBinaryNotFoundModal(true)}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showProgressBar && (
|
{showProgressBar && (
|
||||||
|
|
Loading…
Reference in a new issue