mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 16:53:57 +00:00
feat: adding installation logs
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { useDownload, useLibrary, useUserDetails } from "@renderer/hooks";
|
||||
import {
|
||||
useDownload,
|
||||
useLibrary,
|
||||
useToast,
|
||||
useUserDetails,
|
||||
} from "@renderer/hooks";
|
||||
|
||||
import "./bottom-panel.scss";
|
||||
|
||||
@@ -17,20 +22,52 @@ export function BottomPanel() {
|
||||
|
||||
const { library } = useLibrary();
|
||||
|
||||
const { showSuccessToast } = useToast();
|
||||
|
||||
const { lastPacket, progress, downloadSpeed, eta } = useDownload();
|
||||
|
||||
const [version, setVersion] = useState("");
|
||||
const [sessionHash, setSessionHash] = useState<null | string>("");
|
||||
const [commonRedistStatus, setCommonRedistStatus] = useState<string | null>(
|
||||
null
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
window.electron.getVersion().then((result) => setVersion(result));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const unlisten = window.electron.onCommonRedistProgress(
|
||||
({ log, complete }) => {
|
||||
if (log === "Installation timed out" || complete) {
|
||||
setCommonRedistStatus(null);
|
||||
|
||||
if (complete) {
|
||||
showSuccessToast(
|
||||
t("installation_complete"),
|
||||
t("installation_complete_message")
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
setCommonRedistStatus(log);
|
||||
}
|
||||
);
|
||||
|
||||
return () => unlisten();
|
||||
}, [t, showSuccessToast]);
|
||||
|
||||
useEffect(() => {
|
||||
window.electron.getSessionHash().then((result) => setSessionHash(result));
|
||||
}, [userDetails?.id]);
|
||||
|
||||
const status = useMemo(() => {
|
||||
if (commonRedistStatus) {
|
||||
return t("installing_common_redist", { log: commonRedistStatus });
|
||||
}
|
||||
|
||||
const game = lastPacket
|
||||
? library.find((game) => game.id === lastPacket?.gameId)
|
||||
: undefined;
|
||||
@@ -64,7 +101,15 @@ export function BottomPanel() {
|
||||
}
|
||||
|
||||
return t("no_downloads_in_progress");
|
||||
}, [t, library, lastPacket, progress, eta, downloadSpeed]);
|
||||
}, [
|
||||
t,
|
||||
library,
|
||||
lastPacket,
|
||||
progress,
|
||||
eta,
|
||||
downloadSpeed,
|
||||
commonRedistStatus,
|
||||
]);
|
||||
|
||||
return (
|
||||
<footer className="bottom-panel">
|
||||
|
||||
3
src/renderer/src/declaration.d.ts
vendored
3
src/renderer/src/declaration.d.ts
vendored
@@ -235,6 +235,9 @@ declare global {
|
||||
getFeatures: () => Promise<string[]>;
|
||||
getBadges: () => Promise<Badge[]>;
|
||||
installCommonRedist: () => Promise<void>;
|
||||
onCommonRedistProgress: (
|
||||
cb: (value: { component: string; complete: boolean }) => void
|
||||
) => () => Electron.IpcRenderer;
|
||||
platform: NodeJS.Platform;
|
||||
|
||||
/* Auto update */
|
||||
|
||||
@@ -21,9 +21,9 @@ export interface CatalogueCache {
|
||||
|
||||
export const db = new Dexie("Hydra");
|
||||
|
||||
db.version(8).stores({
|
||||
db.version(9).stores({
|
||||
repacks: `++id, title, uris, fileSize, uploadDate, downloadSourceId, repacker, objectIds, createdAt, updatedAt`,
|
||||
downloadSources: `++id, url, name, etag, objectIds, downloadCount, status, fingerprint, createdAt, updatedAt`,
|
||||
downloadSources: `++id, &url, name, etag, objectIds, downloadCount, status, fingerprint, createdAt, updatedAt`,
|
||||
howLongToBeatEntries: `++id, categories, [shop+objectId], createdAt, updatedAt`,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user