From 1395cd40a9be8d6ad04cecd4b70843602de46ceb Mon Sep 17 00:00:00 2001 From: Hydra Date: Sat, 20 Apr 2024 20:40:16 +0100 Subject: [PATCH] feat: adding repacker friendly name --- src/locales/es/translation.json | 2 +- src/locales/fr/translation.json | 2 +- src/main/entity/user-preferences.entity.ts | 2 +- .../pages/game-details/hero-panel-actions.tsx | 11 ++++++++--- src/renderer/pages/game-details/hero-panel.tsx | 2 ++ src/renderer/pages/game-details/repacks-modal.tsx | 7 ++++++- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json index 9f6c9b255..d28fccc4b 100644 --- a/src/locales/es/translation.json +++ b/src/locales/es/translation.json @@ -25,7 +25,7 @@ "downloads": "Descargas", "search_results": "Resultados de búsqueda", "settings": "Ajustes", - "home": "Hogar" + "home": "Início" }, "bottom_panel": { "no_downloads_in_progress": "Sin descargas en progreso", diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index da0521d89..e3d2bd3d5 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -16,7 +16,7 @@ "paused": "{{title}} (En pause)", "downloading": "{{title}} ({{percentage}} - Téléchargement en cours…)", "filter": "Filtrer la bibliothèque", - "home": "Maison", + "home": "Page d’accueil", "follow_us": "Suivez-nous" }, "header": { diff --git a/src/main/entity/user-preferences.entity.ts b/src/main/entity/user-preferences.entity.ts index ba9bcafdf..40f1a26ae 100644 --- a/src/main/entity/user-preferences.entity.ts +++ b/src/main/entity/user-preferences.entity.ts @@ -23,7 +23,7 @@ export class UserPreferences { @Column("boolean", { default: false }) repackUpdatesNotificationsEnabled: boolean; - @Column("boolean", { default: false }) + @Column("boolean", { default: true }) telemetryEnabled: boolean; @CreateDateColumn() diff --git a/src/renderer/pages/game-details/hero-panel-actions.tsx b/src/renderer/pages/game-details/hero-panel-actions.tsx index 479e58d86..17394e7e3 100644 --- a/src/renderer/pages/game-details/hero-panel-actions.tsx +++ b/src/renderer/pages/game-details/hero-panel-actions.tsx @@ -12,6 +12,7 @@ export interface HeroPanelActionsProps { isGamePlaying: boolean; isGameDownloading: boolean; openRepacksModal: () => void; + openBinaryNotFoundModal: () => void; getGame: () => void; } @@ -21,6 +22,7 @@ export function HeroPanelActions({ isGamePlaying, isGameDownloading, openRepacksModal, + openBinaryNotFoundModal, getGame, }: HeroPanelActionsProps) { const [toggleLibraryGameDisabled, setToggleLibraryGameDisabled] = @@ -43,7 +45,10 @@ export function HeroPanelActions({ .showOpenDialog({ properties: ["openFile"], filters: [ - { name: "Game executable (.exe)", extensions: ["exe", "app"] }, + { + name: "Game executable", + extensions: window.electron.platform === "win32" ? ["exe"] : [], + }, ], }) .then(({ filePaths }) => { @@ -78,8 +83,8 @@ export function HeroPanelActions({ }; const openGameInstaller = () => { - window.electron.openGameInstaller(game.id).then(() => { - // if (!isBinaryInPath) setShowBinaryNotFoundModal(true); + window.electron.openGameInstaller(game.id).then((isBinaryInPath) => { + if (!isBinaryInPath) openBinaryNotFoundModal(); updateLibrary(); }); }; diff --git a/src/renderer/pages/game-details/hero-panel.tsx b/src/renderer/pages/game-details/hero-panel.tsx index be3c933bf..09a04970a 100644 --- a/src/renderer/pages/game-details/hero-panel.tsx +++ b/src/renderer/pages/game-details/hero-panel.tsx @@ -176,6 +176,7 @@ export function HeroPanel({ visible={showBinaryNotFoundModal} onClose={() => setShowBinaryNotFoundModal(false)} /> +
{getInfo()}
@@ -184,6 +185,7 @@ export function HeroPanel({ gameDetails={gameDetails} getGame={getGame} openRepacksModal={openRepacksModal} + openBinaryNotFoundModal={() => setShowBinaryNotFoundModal(true)} isGamePlaying={isGamePlaying} isGameDownloading={isGameDownloading} /> diff --git a/src/renderer/pages/game-details/repacks-modal.tsx b/src/renderer/pages/game-details/repacks-modal.tsx index b3917b23d..24cf78e72 100644 --- a/src/renderer/pages/game-details/repacks-modal.tsx +++ b/src/renderer/pages/game-details/repacks-modal.tsx @@ -10,6 +10,7 @@ import type { DiskSpace } from "check-disk-space"; import { format } from "date-fns"; import { SPACING_UNIT } from "@renderer/theme.css"; import { formatBytes } from "@renderer/utils"; +import { useAppSelector } from "@renderer/hooks"; export interface RepacksModalProps { visible: boolean; @@ -28,6 +29,10 @@ export function RepacksModal({ const [diskFreeSpace, setDiskFreeSpace] = useState(null); const [filteredRepacks, setFilteredRepacks] = useState([]); + const repackersFriendlyNames = useAppSelector( + (state) => state.repackersFriendlyNames.value + ); + const { t } = useTranslation("game_details"); useEffect(() => { @@ -85,7 +90,7 @@ export function RepacksModal({ >

{repack.title}

- {repack.fileSize} - {repack.repacker} -{" "} + {repack.fileSize} - {repackersFriendlyNames[repack.repacker]} -{" "} {format(repack.uploadDate, "dd/MM/yyyy")}