From 163b17324ec3786ad88d7c0736286ca00055c719 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Fri, 7 Jun 2024 18:55:03 -0300 Subject: [PATCH 1/9] set executable as null on remove game from library --- src/locales/pt/translation.json | 2 +- src/main/events/library/remove-game-from-library.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index 9b34e09d..ee404e9f 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -104,7 +104,7 @@ "open_download_location": "Abrir local de download", "create_shortcut": "Criar atalho", "remove_files": "Remover arquivos", - "remove_from_library_description": "Tem certeza que deseja remover {{game}} da sua biblioteca?", + "remove_from_library_description": "Isso irá remover {{game}} da sua biblioteca", "remove_from_library_title": "Tem certeza?" }, "activation": { diff --git a/src/main/events/library/remove-game-from-library.ts b/src/main/events/library/remove-game-from-library.ts index 2581a555..29a7a635 100644 --- a/src/main/events/library/remove-game-from-library.ts +++ b/src/main/events/library/remove-game-from-library.ts @@ -5,7 +5,10 @@ const removeGameFromLibrary = async ( _event: Electron.IpcMainInvokeEvent, gameId: number ) => { - gameRepository.update({ id: gameId }, { isDeleted: true }); + gameRepository.update( + { id: gameId }, + { isDeleted: true, executablePath: null } + ); }; registerEvent("removeGameFromLibrary", removeGameFromLibrary); From 9eef445b1a18e12d411ce5c31dc45d4b9d12eb0a Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Fri, 7 Jun 2024 23:37:03 -0300 Subject: [PATCH 2/9] trying better ui on modal #1 --- .../modals/game-options-modal.tsx | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx index 145e262c..64732571 100644 --- a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx @@ -93,14 +93,8 @@ export function GameOptionsModal({ />
+

Arquivos baixados

- +
+ +

Executável

+
- +
+

Novo Download

+
+ +
+

Remover

+
- -
-

Executável

+
+

Executável

+

+ O caminho do arquivo que sera executado ao clicar em "Jogar" +

+
-

Novo Download

+
+

Downloads

+

+ Confira atualizações ou versões diferentes para este mesmo título +

+
-

Remover

+
+

Zona de perigo

+

+ Remova o jogo da sua biblioteca ou os arquivos que foram baixados + pelo Hydra +

+
+
From f1b30eb969fd354f64b16364a378ba37c01ce7fd Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:16:29 -0300 Subject: [PATCH 4/9] i18n --- src/locales/en/translation.json | 9 ++++++++- src/locales/pt/translation.json | 9 ++++++++- .../game-details/modals/game-options-modal.tsx | 16 +++++++--------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 838c795f..f55702b1 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -108,7 +108,14 @@ "create_shortcut": "Create shortcut", "remove_files": "Remove files", "remove_from_library_title": "Are you sure?", - "remove_from_library_description": "This will remove {{game}} from your library" + "remove_from_library_description": "This will remove {{game}} from your library", + "downloaded_files": "Downloaded files", + "executable_section_title": "Executable", + "executable_section_description": "Path of the file that will be executed when \"Play\" is clicked", + "downloads_secion_title": "Downloads", + "downloads_section_description": "Check out updates or other versions of this game", + "danger_zone_section_title": "Danger zone", + "danger_zone_section_description": "Remove this game from your library or the files downloaded by Hydra" }, "activation": { "title": "Activate Hydra", diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index ee404e9f..702dc791 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -105,7 +105,14 @@ "create_shortcut": "Criar atalho", "remove_files": "Remover arquivos", "remove_from_library_description": "Isso irá remover {{game}} da sua biblioteca", - "remove_from_library_title": "Tem certeza?" + "remove_from_library_title": "Tem certeza?", + "downloaded_files": "Arquivos baixados", + "executable_section_title": "Executável", + "executable_section_description": "O caminho do arquivo que sera executado ao clicar em \"Jogar\"", + "downloads_secion_title": "Downloads", + "downloads_section_description": "Confira atualizações ou versões diferentes para este mesmo título", + "danger_zone_section_title": "Zona de perigo", + "danger_zone_section_description": "Remova o jogo da sua biblioteca ou os arquivos que foram baixados pelo Hydra" }, "activation": { "title": "Ativação", diff --git a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx index e12a9834..73b49417 100644 --- a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx @@ -4,7 +4,6 @@ import { Button, Modal, TextField } from "@renderer/components"; import type { Game } from "@types"; import * as styles from "./game-options-modal.css"; import { gameDetailsContext } from "../game-details.context"; -import { NoEntryIcon, TrashIcon } from "@primer/octicons-react"; import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal"; import { useDownload } from "@renderer/hooks"; import { RemoveGameFromLibraryModal } from "./remove-from-library-modal"; @@ -94,7 +93,7 @@ export function GameOptionsModal({
-

Arquivos baixados

+

{t("downloaded_files")}

-

Downloads

+

{t("downloads_secion_title")}

- Confira atualizações ou versões diferentes para este mesmo título + {t("downloads_section_description")}

@@ -166,10 +165,9 @@ export function GameOptionsModal({
-

Zona de perigo

+

{t("danger_zone_section_title")}

- Remova o jogo da sua biblioteca ou os arquivos que foram baixados - pelo Hydra + {t("danger_zone_section_description")}

From 2e427b33e28adc241c2c4ca9a6b23102004ecea5 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 8 Jun 2024 01:11:37 -0300 Subject: [PATCH 5/9] add danger style to button --- src/renderer/src/components/button/button.css.ts | 12 ++++++++++++ .../pages/game-details/modals/game-options-modal.tsx | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/button/button.css.ts b/src/renderer/src/components/button/button.css.ts index e342b2e9..1b59c697 100644 --- a/src/renderer/src/components/button/button.css.ts +++ b/src/renderer/src/components/button/button.css.ts @@ -55,4 +55,16 @@ export const button = styleVariants({ color: "#c0c1c7", }, ], + danger: [ + base, + { + border: `solid 1px #a31533`, + backgroundColor: "transparent", + color: "white", + ":hover": { + backgroundColor: "#a31533", + color: "white", + }, + }, + ], }); diff --git a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx index 73b49417..acb2afdb 100644 --- a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx @@ -174,7 +174,7 @@ export function GameOptionsModal({ -
-

{t("executable_section_title")}

@@ -123,32 +109,32 @@ export function GameOptionsModal({ -

-
- -
+ {game.executablePath && ( +
+ + +
+ )} +

{t("downloads_secion_title")}

@@ -163,6 +149,15 @@ export function GameOptionsModal({ > {t("open_download_options")} + {game.downloadPath && ( + + )}

{t("danger_zone_section_title")}

@@ -173,7 +168,6 @@ export function GameOptionsModal({
From ca73316ee96d1c9256d712f7923c801749629221 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 8 Jun 2024 11:33:59 -0300 Subject: [PATCH 9/9] code adjustment --- .../game-details/modals/game-options-modal.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx index 569a9509..26ac041f 100644 --- a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx @@ -35,12 +35,12 @@ export function GameOptionsModal({ cancelDownload, } = useDownload(); - const deleting = game ? isGameDeleting(game?.id) : false; + const deleting = isGameDeleting(game.id); const { lastPacket } = useDownload(); const isGameDownloading = - game?.status === "active" && lastPacket?.game.id === game?.id; + game.status === "active" && lastPacket?.game.id === game.id; const handleRemoveGameFromLibrary = async () => { if (isGameDownloading) { @@ -129,15 +129,10 @@ export function GameOptionsModal({ type="button" theme="outline" onClick={handleOpenGameExecutablePath} - disabled={!game.executablePath} > {t("open_folder")} -
@@ -161,7 +156,7 @@ export function GameOptionsModal({