feat: adding file verification message

This commit is contained in:
Chubby Granny Chaser 2024-06-27 19:59:33 +01:00
parent 41dc504660
commit a1e41ea464
No known key found for this signature in database
6 changed files with 36 additions and 11 deletions

View File

@ -36,7 +36,8 @@
"no_downloads_in_progress": "No downloads in progress", "no_downloads_in_progress": "No downloads in progress",
"downloading_metadata": "Downloading {{title}} metadata…", "downloading_metadata": "Downloading {{title}} metadata…",
"downloading": "Downloading {{title}}… ({{percentage}} complete) - Conclusion {{eta}} - {{speed}}", "downloading": "Downloading {{title}}… ({{percentage}} complete) - Conclusion {{eta}} - {{speed}}",
"calculating_eta": "Downloading {{title}}… ({{percentage}} complete) - Calculating remaining time…" "calculating_eta": "Downloading {{title}}… ({{percentage}} complete) - Calculating remaining time…",
"checking_files": "Checking {{title}} files… ({{percentage}} complete)"
}, },
"catalogue": { "catalogue": {
"next_page": "Next page", "next_page": "Next page",
@ -144,7 +145,8 @@
"downloads_completed": "Completed", "downloads_completed": "Completed",
"queued": "Queued", "queued": "Queued",
"no_downloads_title": "Such empty", "no_downloads_title": "Such empty",
"no_downloads_description": "You haven't downloaded anything with Hydra yet, but it's never too late to start." "no_downloads_description": "You haven't downloaded anything with Hydra yet, but it's never too late to start.",
"checking_files": "Checking files…"
}, },
"settings": { "settings": {
"downloads_path": "Downloads path", "downloads_path": "Downloads path",

View File

@ -36,7 +36,8 @@
"no_downloads_in_progress": "Sem downloads em andamento", "no_downloads_in_progress": "Sem downloads em andamento",
"downloading_metadata": "Baixando metadados de {{title}}…", "downloading_metadata": "Baixando metadados de {{title}}…",
"downloading": "Baixando {{title}}… ({{percentage}} concluído) - Conclusão {{eta}} - {{speed}}", "downloading": "Baixando {{title}}… ({{percentage}} concluído) - Conclusão {{eta}} - {{speed}}",
"calculating_eta": "Baixando {{title}}… ({{percentage}} concluído) - Calculando tempo restante…" "calculating_eta": "Baixando {{title}}… ({{percentage}} concluído) - Calculando tempo restante…",
"checking_files": "Verificando arquivos de {{title}}…"
}, },
"game_details": { "game_details": {
"open_download_options": "Ver opções de download", "open_download_options": "Ver opções de download",
@ -140,7 +141,8 @@
"downloads_completed": "Completo", "downloads_completed": "Completo",
"queued": "Na fila", "queued": "Na fila",
"no_downloads_title": "Nada por aqui…", "no_downloads_title": "Nada por aqui…",
"no_downloads_description": "Você ainda não baixou nada pelo Hydra, mas nunca é tarde para começar." "no_downloads_description": "Você ainda não baixou nada pelo Hydra, mas nunca é tarde para começar.",
"checking_files": "Verificando arquivos…"
}, },
"settings": { "settings": {
"downloads_path": "Diretório dos downloads", "downloads_path": "Diretório dos downloads",

View File

@ -39,7 +39,10 @@ export function BottomPanel() {
}); });
if (lastPacket?.isDownloadingMetadata) if (lastPacket?.isDownloadingMetadata)
return t("downloading_metadata", { title: lastPacket?.game.title }); return t("downloading_metadata", {
title: lastPacket?.game.title,
percentage: progress,
});
if (!eta) { if (!eta) {
return t("calculating_eta", { return t("calculating_eta", {

View File

@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from "react"; import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useLocation, useNavigate } from "react-router-dom"; import { useLocation, useNavigate } from "react-router-dom";
@ -14,6 +14,7 @@ import { buildGameDetailsPath } from "@renderer/helpers";
import SteamLogo from "@renderer/assets/steam-logo.svg?react"; import SteamLogo from "@renderer/assets/steam-logo.svg?react";
import { SidebarProfile } from "./sidebar-profile"; import { SidebarProfile } from "./sidebar-profile";
import { sortBy } from "lodash-es";
const SIDEBAR_MIN_WIDTH = 200; const SIDEBAR_MIN_WIDTH = 200;
const SIDEBAR_INITIAL_WIDTH = 250; const SIDEBAR_INITIAL_WIDTH = 250;
@ -35,6 +36,10 @@ export function Sidebar() {
const location = useLocation(); const location = useLocation();
const sortedLibrary = useMemo(() => {
return sortBy(library, (game) => game.title);
}, [library]);
const { lastPacket, progress } = useDownload(); const { lastPacket, progress } = useDownload();
const { showWarningToast } = useToast(); const { showWarningToast } = useToast();
@ -43,7 +48,7 @@ export function Sidebar() {
updateLibrary(); updateLibrary();
}, [lastPacket?.game.id, updateLibrary]); }, [lastPacket?.game.id, updateLibrary]);
const isDownloading = library.some( const isDownloading = sortedLibrary.some(
(game) => game.status === "active" && game.progress !== 1 (game) => game.status === "active" && game.progress !== 1
); );
@ -63,7 +68,7 @@ export function Sidebar() {
const handleFilter: React.ChangeEventHandler<HTMLInputElement> = (event) => { const handleFilter: React.ChangeEventHandler<HTMLInputElement> = (event) => {
setFilteredLibrary( setFilteredLibrary(
library.filter((game) => sortedLibrary.filter((game) =>
game.title game.title
.toLowerCase() .toLowerCase()
.includes(event.target.value.toLocaleLowerCase()) .includes(event.target.value.toLocaleLowerCase())
@ -72,8 +77,8 @@ export function Sidebar() {
}; };
useEffect(() => { useEffect(() => {
setFilteredLibrary(library); setFilteredLibrary(sortedLibrary);
}, [library]); }, [sortedLibrary]);
useEffect(() => { useEffect(() => {
window.onmousemove = (event: MouseEvent) => { window.onmousemove = (event: MouseEvent) => {

View File

@ -85,7 +85,7 @@ export function useDownload() {
return { return {
downloadSpeed: `${formatBytes(lastPacket?.downloadSpeed ?? 0)}/s`, downloadSpeed: `${formatBytes(lastPacket?.downloadSpeed ?? 0)}/s`,
progress: formatDownloadProgress(lastPacket?.game.progress), progress: formatDownloadProgress(lastPacket?.progress ?? 0),
lastPacket, lastPacket,
eta: getETA(), eta: getETA(),
startDownload, startDownload,

View File

@ -67,6 +67,19 @@ export function DownloadGroup({
} }
if (isGameDownloading) { if (isGameDownloading) {
if (lastPacket?.isDownloadingMetadata) {
return <p>{t("downloading_metadata")}</p>;
}
if (lastPacket?.isCheckingFiles) {
return (
<>
<p>{progress}</p>
<p>{t("checking_files")}</p>
</>
);
}
return ( return (
<> <>
<p>{progress}</p> <p>{progress}</p>