mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: fixing translations and typescript renderer errors
This commit is contained in:
parent
22633ba45f
commit
0a597acd26
12 changed files with 90 additions and 49 deletions
2
src/renderer/src/declaration.d.ts
vendored
2
src/renderer/src/declaration.d.ts
vendored
|
@ -56,7 +56,7 @@ declare global {
|
|||
objectID: string,
|
||||
title: string,
|
||||
shop: GameShop,
|
||||
executablePath: string
|
||||
executablePath: string | null
|
||||
) => Promise<void>;
|
||||
getLibrary: () => Promise<Game[]>;
|
||||
getRepackersFriendlyNames: () => Promise<Record<string, string>>;
|
||||
|
|
|
@ -24,5 +24,7 @@ export const getSteamLanguage = (language: string) => {
|
|||
if (language.startsWith("ru")) return "russian";
|
||||
if (language.startsWith("it")) return "italian";
|
||||
if (language.startsWith("hu")) return "hungarian";
|
||||
if (language.startsWith("pl")) return "polish";
|
||||
|
||||
return "english";
|
||||
};
|
||||
|
|
|
@ -103,6 +103,7 @@ export function Downloads() {
|
|||
</>
|
||||
);
|
||||
}
|
||||
|
||||
if (game?.status === "cancelled") return <p>{t("cancelled")}</p>;
|
||||
if (game?.status === "downloading_metadata")
|
||||
return <p>{t("starting_download")}</p>;
|
||||
|
@ -115,6 +116,8 @@ export function Downloads() {
|
|||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const openDeleteModal = (gameId: number) => {
|
||||
|
@ -210,6 +213,12 @@ export function Downloads() {
|
|||
);
|
||||
};
|
||||
|
||||
const handleDeleteGame = () => {
|
||||
if (gameToBeDeleted.current) {
|
||||
deleteGame(gameToBeDeleted.current).then(updateLibrary);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<section className={styles.downloadsContainer}>
|
||||
<BinaryNotFoundModal
|
||||
|
@ -219,9 +228,7 @@ export function Downloads() {
|
|||
<DeleteModal
|
||||
visible={showDeleteModal}
|
||||
onClose={() => setShowDeleteModal(false)}
|
||||
deleteGame={() =>
|
||||
deleteGame(gameToBeDeleted.current).then(updateLibrary)
|
||||
}
|
||||
deleteGame={handleDeleteGame}
|
||||
/>
|
||||
|
||||
<TextField placeholder={t("filter")} onChange={handleFilter} />
|
||||
|
|
|
@ -68,7 +68,7 @@ export function HeroPanelActions({
|
|||
try {
|
||||
if (game) {
|
||||
await removeGameFromLibrary(game.id);
|
||||
} else {
|
||||
} else if (gameDetails) {
|
||||
const gameExecutablePath = await selectGameExecutable();
|
||||
|
||||
await window.electron.addGameToLibrary(
|
||||
|
@ -87,30 +87,37 @@ export function HeroPanelActions({
|
|||
};
|
||||
|
||||
const openGameInstaller = () => {
|
||||
window.electron.openGameInstaller(game.id).then((isBinaryInPath) => {
|
||||
if (!isBinaryInPath) openBinaryNotFoundModal();
|
||||
updateLibrary();
|
||||
});
|
||||
if (game) {
|
||||
window.electron.openGameInstaller(game.id).then((isBinaryInPath) => {
|
||||
if (!isBinaryInPath) openBinaryNotFoundModal();
|
||||
updateLibrary();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const openGame = async () => {
|
||||
if (game.executablePath) {
|
||||
window.electron.openGame(game.id, game.executablePath);
|
||||
return;
|
||||
}
|
||||
if (game) {
|
||||
if (game.executablePath) {
|
||||
window.electron.openGame(game.id, game.executablePath);
|
||||
return;
|
||||
}
|
||||
|
||||
if (game?.executablePath) {
|
||||
window.electron.openGame(game.id, game.executablePath);
|
||||
return;
|
||||
}
|
||||
if (game?.executablePath) {
|
||||
window.electron.openGame(game.id, game.executablePath);
|
||||
return;
|
||||
}
|
||||
|
||||
const gameExecutablePath = await selectGameExecutable();
|
||||
window.electron.openGame(game.id, gameExecutablePath);
|
||||
const gameExecutablePath = await selectGameExecutable();
|
||||
if (gameExecutablePath)
|
||||
window.electron.openGame(game.id, gameExecutablePath);
|
||||
}
|
||||
};
|
||||
|
||||
const closeGame = () => window.electron.closeGame(game.id);
|
||||
const closeGame = () => {
|
||||
if (game) window.electron.closeGame(game.id);
|
||||
};
|
||||
|
||||
const deleting = isGameDeleting(game?.id);
|
||||
const deleting = game ? isGameDeleting(game?.id) : false;
|
||||
|
||||
const toggleGameOnLibraryButton = (
|
||||
<Button
|
||||
|
@ -124,7 +131,7 @@ export function HeroPanelActions({
|
|||
</Button>
|
||||
);
|
||||
|
||||
if (isGameDownloading) {
|
||||
if (game && isGameDownloading) {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
|
|
|
@ -98,7 +98,7 @@ export function HeroPanel({
|
|||
return <p>{t("deleting")}</p>;
|
||||
}
|
||||
|
||||
if (isGameDownloading) {
|
||||
if (isGameDownloading && gameDownloading?.status) {
|
||||
return (
|
||||
<>
|
||||
<p className={styles.downloadDetailsRow}>
|
||||
|
@ -106,14 +106,14 @@ export function HeroPanel({
|
|||
{eta && <small>{t("eta", { eta })}</small>}
|
||||
</p>
|
||||
|
||||
{gameDownloading?.status !== "downloading" ? (
|
||||
{gameDownloading.status !== "downloading" ? (
|
||||
<>
|
||||
<p>{t(gameDownloading?.status)}</p>
|
||||
<p>{t(gameDownloading.status)}</p>
|
||||
{eta && <small>{t("eta", { eta })}</small>}
|
||||
</>
|
||||
) : (
|
||||
<p className={styles.downloadDetailsRow}>
|
||||
{formatBytes(gameDownloading?.bytesDownloaded)} /{" "}
|
||||
{formatBytes(gameDownloading.bytesDownloaded)} /{" "}
|
||||
{finalDownloadSize}
|
||||
<small>
|
||||
{numPeers} peers / {numSeeds} seeds
|
||||
|
@ -148,7 +148,7 @@ export function HeroPanel({
|
|||
<>
|
||||
<p>
|
||||
{t("play_time", {
|
||||
amount: formatPlayTime(game.playTimeInMilliseconds),
|
||||
amount: formatPlayTime(),
|
||||
})}
|
||||
</p>
|
||||
|
||||
|
|
|
@ -89,7 +89,9 @@ export function RepacksModal({
|
|||
<p style={{ color: "#DADBE1" }}>{repack.title}</p>
|
||||
<p style={{ fontSize: "12px" }}>
|
||||
{repack.fileSize} - {repackersFriendlyNames[repack.repacker]} -{" "}
|
||||
{format(repack.uploadDate, "dd/MM/yyyy")}
|
||||
{repack.uploadDate
|
||||
? format(repack.uploadDate, "dd/MM/yyyy")
|
||||
: ""}
|
||||
</p>
|
||||
</Button>
|
||||
))}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue