From 855f0aa334fff6407824c1ea28ec8508c8c9e868 Mon Sep 17 00:00:00 2001 From: Hachi-R Date: Sun, 22 Dec 2024 18:50:19 -0300 Subject: [PATCH 1/4] refactor: remove commented-out code in download-manager.ts --- .../services/download/download-manager.ts | 57 +------------------ 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/src/main/services/download/download-manager.ts b/src/main/services/download/download-manager.ts index 7c57300e..a4106fef 100644 --- a/src/main/services/download/download-manager.ts +++ b/src/main/services/download/download-manager.ts @@ -84,7 +84,7 @@ export class DownloadManager { public static async watchDownloads() { const status = await this.getDownloadStatus(); - // // status = await RealDebridDownloader.getStatus(); + // status = await RealDebridDownloader.getStatus(); if (status) { const { gameId, progress } = status; @@ -180,61 +180,6 @@ export class DownloadManager { "on-seeding-status", JSON.parse(JSON.stringify(seedStatus.data)) ); - - // const gamesToSeed = await gameRepository.find({ - // where: { shouldSeed: true, isDeleted: false }, - // }); - // if (gamesToSeed.length === 0) return; - // const seedStatus = await PythonRPC.rpc - // .get("/seed-status") - // .then((results) => { - // if (results === null) return []; - // return results.data; - // }); - // if (!seedStatus.length === 0) { - // for (const game of gamesToSeed) { - // if (game.uri && game.downloadPath) { - // await this.resumeSeeding(game.id, game.uri, game.downloadPath); - // } - // } - // } - // const gameIds = seedStatus.map((status) => status.gameId); - // for (const gameId of gameIds) { - // const game = await gameRepository.findOne({ - // where: { id: gameId }, - // }); - // if (game) { - // const isNotDeleted = fs.existsSync( - // path.join(game.downloadPath!, game.folderName!) - // ); - // if (!isNotDeleted) { - // await this.pauseSeeding(game.id); - // await gameRepository.update(game.id, { - // status: "complete", - // shouldSeed: false, - // }); - // WindowManager.mainWindow?.webContents.send("on-hard-delete"); - // } - // } - // } - // const updateList = await gameRepository.find({ - // where: { - // id: In(gameIds), - // status: Not(In(["complete", "seeding"])), - // shouldSeed: true, - // isDeleted: false, - // }, - // }); - // if (updateList.length > 0) { - // await gameRepository.update( - // { id: In(updateList.map((game) => game.id)) }, - // { status: "seeding" } - // ); - // } - // WindowManager.mainWindow?.webContents.send( - // "on-seeding-status", - // JSON.parse(JSON.stringify(seedStatus)) - // ); } static async pauseDownload() { From 859d849d36d61482fc52fca981bb2ab618599187 Mon Sep 17 00:00:00 2001 From: Hachi-R Date: Sun, 22 Dec 2024 19:30:05 -0300 Subject: [PATCH 2/4] fix: update Portuguese translations and enhance dropdown menu styling --- src/locales/pt-BR/translation.json | 4 ++-- .../dropdown-menu/dropdown-menu.scss | 2 +- .../src/pages/downloads/download-group.tsx | 21 +++++++++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/locales/pt-BR/translation.json b/src/locales/pt-BR/translation.json index 92fe94ea..348f6797 100644 --- a/src/locales/pt-BR/translation.json +++ b/src/locales/pt-BR/translation.json @@ -199,8 +199,8 @@ "no_downloads_description": "Você ainda não baixou nada pelo Hydra, mas nunca é tarde para começar.", "checking_files": "Verificando arquivos…", "seeding": "Semeando", - "stop_seeding": "Parar semeio", - "resume_seeding": "Retomar semeio", + "stop_seeding": "Parar de semear", + "resume_seeding": "Semear", "options": "Gerenciar" }, "settings": { diff --git a/src/renderer/src/components/dropdown-menu/dropdown-menu.scss b/src/renderer/src/components/dropdown-menu/dropdown-menu.scss index 3c615116..0f73c608 100644 --- a/src/renderer/src/components/dropdown-menu/dropdown-menu.scss +++ b/src/renderer/src/components/dropdown-menu/dropdown-menu.scss @@ -4,7 +4,7 @@ &__content { background-color: globals.$dark-background-color; border: 1px solid globals.$border-color; - border-radius: 4px; + border-radius: 6px; min-width: 200px; flex-direction: column; align-items: center; diff --git a/src/renderer/src/pages/downloads/download-group.tsx b/src/renderer/src/pages/downloads/download-group.tsx index ae428c2c..e9ae8a82 100644 --- a/src/renderer/src/pages/downloads/download-group.tsx +++ b/src/renderer/src/pages/downloads/download-group.tsx @@ -20,7 +20,16 @@ import { DropdownMenu, DropdownMenuItem, } from "@renderer/components/dropdown-menu/dropdown-menu"; -import { ThreeBarsIcon } from "@primer/octicons-react"; +import { + ColumnsIcon, + DownloadIcon, + LinkIcon, + PlayIcon, + ThreeBarsIcon, + TrashIcon, + UnlinkIcon, + XCircleIcon, +} from "@primer/octicons-react"; export interface DownloadGroupProps { library: LibraryGame[]; @@ -168,10 +177,12 @@ export function DownloadGroup({ label: t("install"), disabled: deleting, onClick: () => openGameInstaller(game.id), + icon: , }, { label: t("stop_seeding"), disabled: deleting, + icon: , show: game.status === "seeding" && game.downloader === Downloader.Torrent, onClick: () => pauseSeeding(game.id), @@ -179,6 +190,7 @@ export function DownloadGroup({ { label: t("resume_seeding"), disabled: deleting, + icon: , show: game.status !== "seeding" && game.downloader === Downloader.Torrent, onClick: () => resumeSeeding(game.id), @@ -186,6 +198,7 @@ export function DownloadGroup({ { label: t("delete"), disabled: deleting, + icon: , onClick: () => openDeleteGameModal(game.id), }, ]; @@ -196,10 +209,12 @@ export function DownloadGroup({ { label: t("pause"), onClick: () => pauseDownload(game.id), + icon: , }, { label: t("cancel"), onClick: () => cancelDownload(game.id), + icon: , }, ]; } @@ -211,10 +226,12 @@ export function DownloadGroup({ game.downloader === Downloader.RealDebrid && !userPreferences?.realDebridApiToken, onClick: () => resumeDownload(game.id), + icon: , }, { label: t("cancel"), onClick: () => cancelDownload(game.id), + icon: , }, ]; }; @@ -290,7 +307,7 @@ export function DownloadGroup({