feat: adding repacker friendly name

This commit is contained in:
Hydra 2024-04-20 20:40:16 +01:00
parent 78789632b4
commit 1395cd40a9
No known key found for this signature in database
6 changed files with 19 additions and 7 deletions

View File

@ -25,7 +25,7 @@
"downloads": "Descargas", "downloads": "Descargas",
"search_results": "Resultados de búsqueda", "search_results": "Resultados de búsqueda",
"settings": "Ajustes", "settings": "Ajustes",
"home": "Hogar" "home": "Início"
}, },
"bottom_panel": { "bottom_panel": {
"no_downloads_in_progress": "Sin descargas en progreso", "no_downloads_in_progress": "Sin descargas en progreso",

View File

@ -16,7 +16,7 @@
"paused": "{{title}} (En pause)", "paused": "{{title}} (En pause)",
"downloading": "{{title}} ({{percentage}} - Téléchargement en cours…)", "downloading": "{{title}} ({{percentage}} - Téléchargement en cours…)",
"filter": "Filtrer la bibliothèque", "filter": "Filtrer la bibliothèque",
"home": "Maison", "home": "Page daccueil",
"follow_us": "Suivez-nous" "follow_us": "Suivez-nous"
}, },
"header": { "header": {

View File

@ -23,7 +23,7 @@ export class UserPreferences {
@Column("boolean", { default: false }) @Column("boolean", { default: false })
repackUpdatesNotificationsEnabled: boolean; repackUpdatesNotificationsEnabled: boolean;
@Column("boolean", { default: false }) @Column("boolean", { default: true })
telemetryEnabled: boolean; telemetryEnabled: boolean;
@CreateDateColumn() @CreateDateColumn()

View File

@ -12,6 +12,7 @@ export interface HeroPanelActionsProps {
isGamePlaying: boolean; isGamePlaying: boolean;
isGameDownloading: boolean; isGameDownloading: boolean;
openRepacksModal: () => void; openRepacksModal: () => void;
openBinaryNotFoundModal: () => void;
getGame: () => void; getGame: () => void;
} }
@ -21,6 +22,7 @@ export function HeroPanelActions({
isGamePlaying, isGamePlaying,
isGameDownloading, isGameDownloading,
openRepacksModal, openRepacksModal,
openBinaryNotFoundModal,
getGame, getGame,
}: HeroPanelActionsProps) { }: HeroPanelActionsProps) {
const [toggleLibraryGameDisabled, setToggleLibraryGameDisabled] = const [toggleLibraryGameDisabled, setToggleLibraryGameDisabled] =
@ -43,7 +45,10 @@ export function HeroPanelActions({
.showOpenDialog({ .showOpenDialog({
properties: ["openFile"], properties: ["openFile"],
filters: [ filters: [
{ name: "Game executable (.exe)", extensions: ["exe", "app"] }, {
name: "Game executable",
extensions: window.electron.platform === "win32" ? ["exe"] : [],
},
], ],
}) })
.then(({ filePaths }) => { .then(({ filePaths }) => {
@ -78,8 +83,8 @@ export function HeroPanelActions({
}; };
const openGameInstaller = () => { const openGameInstaller = () => {
window.electron.openGameInstaller(game.id).then(() => { window.electron.openGameInstaller(game.id).then((isBinaryInPath) => {
// if (!isBinaryInPath) setShowBinaryNotFoundModal(true); if (!isBinaryInPath) openBinaryNotFoundModal();
updateLibrary(); updateLibrary();
}); });
}; };

View File

@ -176,6 +176,7 @@ export function HeroPanel({
visible={showBinaryNotFoundModal} visible={showBinaryNotFoundModal}
onClose={() => setShowBinaryNotFoundModal(false)} onClose={() => setShowBinaryNotFoundModal(false)}
/> />
<div style={{ backgroundColor: color }} className={styles.panel}> <div style={{ backgroundColor: color }} className={styles.panel}>
<div className={styles.content}>{getInfo()}</div> <div className={styles.content}>{getInfo()}</div>
<div className={styles.actions}> <div className={styles.actions}>
@ -184,6 +185,7 @@ export function HeroPanel({
gameDetails={gameDetails} gameDetails={gameDetails}
getGame={getGame} getGame={getGame}
openRepacksModal={openRepacksModal} openRepacksModal={openRepacksModal}
openBinaryNotFoundModal={() => setShowBinaryNotFoundModal(true)}
isGamePlaying={isGamePlaying} isGamePlaying={isGamePlaying}
isGameDownloading={isGameDownloading} isGameDownloading={isGameDownloading}
/> />

View File

@ -10,6 +10,7 @@ import type { DiskSpace } from "check-disk-space";
import { format } from "date-fns"; import { format } from "date-fns";
import { SPACING_UNIT } from "@renderer/theme.css"; import { SPACING_UNIT } from "@renderer/theme.css";
import { formatBytes } from "@renderer/utils"; import { formatBytes } from "@renderer/utils";
import { useAppSelector } from "@renderer/hooks";
export interface RepacksModalProps { export interface RepacksModalProps {
visible: boolean; visible: boolean;
@ -28,6 +29,10 @@ export function RepacksModal({
const [diskFreeSpace, setDiskFreeSpace] = useState<DiskSpace>(null); const [diskFreeSpace, setDiskFreeSpace] = useState<DiskSpace>(null);
const [filteredRepacks, setFilteredRepacks] = useState<GameRepack[]>([]); const [filteredRepacks, setFilteredRepacks] = useState<GameRepack[]>([]);
const repackersFriendlyNames = useAppSelector(
(state) => state.repackersFriendlyNames.value
);
const { t } = useTranslation("game_details"); const { t } = useTranslation("game_details");
useEffect(() => { useEffect(() => {
@ -85,7 +90,7 @@ export function RepacksModal({
> >
<p style={{ color: "#DADBE1" }}>{repack.title}</p> <p style={{ color: "#DADBE1" }}>{repack.title}</p>
<p style={{ fontSize: "12px" }}> <p style={{ fontSize: "12px" }}>
{repack.fileSize} - {repack.repacker} -{" "} {repack.fileSize} - {repackersFriendlyNames[repack.repacker]} -{" "}
{format(repack.uploadDate, "dd/MM/yyyy")} {format(repack.uploadDate, "dd/MM/yyyy")}
</p> </p>
</Button> </Button>