Merge branch 'main' into hyd-332-friendsblocks-list-pagination-and-set-privacy-settings

# Conflicts:
#	src/renderer/src/pages/user/user-content.tsx
This commit is contained in:
Zamitto 2024-08-15 17:28:48 -03:00
commit a99058805b
39 changed files with 561 additions and 407 deletions

View file

@ -26,7 +26,7 @@ globalStyle("html, body, #root, main", {
globalStyle("body", {
overflow: "hidden",
userSelect: "none",
fontFamily: "'Fira Mono', monospace",
fontFamily: "Noto Sans, sans-serif",
fontSize: vars.size.body,
background: vars.color.background,
color: vars.color.body,

View file

@ -45,7 +45,6 @@ export const description = style({
maxWidth: "700px",
color: vars.color.muted,
textAlign: "left",
fontFamily: "'Fira Sans', sans-serif",
lineHeight: "20px",
marginTop: `${SPACING_UNIT * 2}px`,
});

View file

@ -24,6 +24,7 @@ export const modal = recipe({
animation: `${scaleFadeIn} 0.2s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running`,
backgroundColor: vars.color.background,
borderRadius: "4px",
minWidth: "400px",
maxWidth: "600px",
color: vars.color.body,
maxHeight: "100%",

View file

@ -5,4 +5,6 @@ export const VERSION_CODENAME = "Leviticus";
export const DOWNLOADER_NAME = {
[Downloader.RealDebrid]: "Real-Debrid",
[Downloader.Torrent]: "Torrent",
[Downloader.Gofile]: "Gofile",
[Downloader.PixelDrain]: "PixelDrain",
};

View file

@ -8,12 +8,10 @@ import { HashRouter, Route, Routes } from "react-router-dom";
import * as Sentry from "@sentry/electron/renderer";
import "@fontsource/fira-mono/400.css";
import "@fontsource/fira-mono/500.css";
import "@fontsource/fira-mono/700.css";
import "@fontsource/fira-sans/400.css";
import "@fontsource/fira-sans/500.css";
import "@fontsource/fira-sans/700.css";
import "@fontsource/noto-sans/400.css";
import "@fontsource/noto-sans/500.css";
import "@fontsource/noto-sans/700.css";
import "react-loading-skeleton/dist/skeleton.css";
import { App } from "./app";

View file

@ -132,9 +132,7 @@ export function Downloads() {
<ArrowDownIcon size={24} />
</div>
<h2>{t("no_downloads_title")}</h2>
<p style={{ fontFamily: "Fira Sans" }}>
{t("no_downloads_description")}
</p>
<p>{t("no_downloads_description")}</p>
</div>
)}
</>

View file

@ -19,7 +19,10 @@ export function DescriptionHeader() {
date: shopDetails?.release_date.date,
})}
</p>
<p>{t("publisher", { publisher: shopDetails.publishers[0] })}</p>
{Array.isArray(shopDetails.publishers) && (
<p>{t("publisher", { publisher: shopDetails.publishers[0] })}</p>
)}
</section>
</div>
);

View file

@ -101,7 +101,6 @@ export const descriptionContent = style({
export const description = style({
userSelect: "text",
lineHeight: "22px",
fontFamily: "'Fira Sans', sans-serif",
fontSize: "16px",
padding: `${SPACING_UNIT * 3}px ${SPACING_UNIT * 2}px`,
"@media": {

View file

@ -9,6 +9,7 @@ export const panel = recipe({
height: "72px",
minHeight: "72px",
padding: `${SPACING_UNIT * 2}px ${SPACING_UNIT * 3}px`,
backgroundColor: vars.color.darkBackground,
display: "flex",
alignItems: "center",
justifyContent: "space-between",

View file

@ -1,11 +1,11 @@
import { useEffect, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import { DiskSpace } from "check-disk-space";
import * as styles from "./download-settings-modal.css";
import { Button, Link, Modal, TextField } from "@renderer/components";
import { CheckCircleFillIcon, DownloadIcon } from "@primer/octicons-react";
import { Downloader, formatBytes } from "@shared";
import { Downloader, formatBytes, getDownloadersForUri } from "@shared";
import type { GameRepack } from "@types";
import { SPACING_UNIT } from "@renderer/theme.css";
@ -23,8 +23,6 @@ export interface DownloadSettingsModalProps {
repack: GameRepack | null;
}
const downloaders = [Downloader.Torrent, Downloader.RealDebrid];
export function DownloadSettingsModal({
visible,
onClose,
@ -36,9 +34,8 @@ export function DownloadSettingsModal({
const [diskFreeSpace, setDiskFreeSpace] = useState<DiskSpace | null>(null);
const [selectedPath, setSelectedPath] = useState("");
const [downloadStarting, setDownloadStarting] = useState(false);
const [selectedDownloader, setSelectedDownloader] = useState(
Downloader.Torrent
);
const [selectedDownloader, setSelectedDownloader] =
useState<Downloader | null>(null);
const userPreferences = useAppSelector(
(state) => state.userPreferences.value
@ -50,6 +47,10 @@ export function DownloadSettingsModal({
}
}, [visible, selectedPath]);
const downloaders = useMemo(() => {
return getDownloadersForUri(repack?.magnet ?? "");
}, [repack?.magnet]);
useEffect(() => {
if (userPreferences?.downloadsPath) {
setSelectedPath(userPreferences.downloadsPath);
@ -59,9 +60,27 @@ export function DownloadSettingsModal({
.then((defaultDownloadsPath) => setSelectedPath(defaultDownloadsPath));
}
if (userPreferences?.realDebridApiToken)
setSelectedDownloader(Downloader.RealDebrid);
}, [userPreferences?.downloadsPath, userPreferences?.realDebridApiToken]);
const filteredDownloaders = downloaders.filter((downloader) => {
if (downloader === Downloader.RealDebrid)
return userPreferences?.realDebridApiToken;
return true;
});
/* Gives preference to Real Debrid */
const selectedDownloader = filteredDownloaders.includes(
Downloader.RealDebrid
)
? Downloader.RealDebrid
: filteredDownloaders[0];
setSelectedDownloader(
selectedDownloader === undefined ? null : selectedDownloader
);
}, [
userPreferences?.downloadsPath,
downloaders,
userPreferences?.realDebridApiToken,
]);
const getDiskFreeSpace = (path: string) => {
window.electron.getDiskFreeSpace(path).then((result) => {
@ -85,7 +104,7 @@ export function DownloadSettingsModal({
if (repack) {
setDownloadStarting(true);
startDownload(repack, selectedDownloader, selectedPath).finally(() => {
startDownload(repack, selectedDownloader!, selectedPath).finally(() => {
setDownloadStarting(false);
onClose();
});
@ -167,7 +186,10 @@ export function DownloadSettingsModal({
</p>
</div>
<Button onClick={handleStartClick} disabled={downloadStarting}>
<Button
onClick={handleStartClick}
disabled={downloadStarting || selectedDownloader === null}
>
<DownloadIcon />
{t("download_now")}
</Button>

View file

@ -15,7 +15,6 @@ export const gameOptionHeader = style({
});
export const gameOptionHeaderDescription = style({
fontFamily: "'Fira Sans', sans-serif",
fontWeight: "400",
});

View file

@ -44,8 +44,10 @@ export function RepacksModal({
}, [repacks]);
const getInfoHash = useCallback(async () => {
const torrent = await parseTorrent(game?.uri ?? "");
if (torrent.infoHash) setInfoHash(torrent.infoHash);
if (game?.uri?.startsWith("magnet:")) {
const torrent = await parseTorrent(game?.uri ?? "");
if (torrent.infoHash) setInfoHash(torrent.infoHash);
}
}, [game]);
useEffect(() => {

View file

@ -46,7 +46,6 @@ export const requirementButton = style({
export const requirementsDetails = style({
padding: `${SPACING_UNIT * 2}px`,
lineHeight: "22px",
fontFamily: "'Fira Sans', sans-serif",
fontSize: "16px",
});

View file

@ -82,9 +82,7 @@ export function SettingsDownloadSources() {
onAddDownloadSource={handleAddDownloadSource}
/>
<p style={{ fontFamily: '"Fira Sans"' }}>
{t("download_sources_description")}
</p>
<p>{t("download_sources_description")}</p>
<div className={styles.downloadSourcesHeader}>
<Button

View file

@ -9,6 +9,5 @@ export const form = style({
});
export const description = style({
fontFamily: "'Fira Sans', sans-serif",
marginBottom: `${SPACING_UNIT * 2}px`,
});

View file

@ -25,9 +25,7 @@ export const UserBlockModal = ({
onClose={onClose}
>
<div className={styles.signOutModalContent}>
<p style={{ fontFamily: "Fira Sans" }}>
{t("user_block_modal_text", { displayName })}
</p>
<p>{t("user_block_modal_text", { displayName })}</p>
<div className={styles.signOutModalButtonsContainer}>
<Button onClick={onConfirm} theme="danger">
{t("block_user")}

View file

@ -378,11 +378,7 @@ export function UserContent({
<TelescopeIcon size={24} />
</div>
<h2>{t("no_recent_activity_title")}</h2>
{isMe && (
<p style={{ fontFamily: "Fira Sans" }}>
{t("no_recent_activity_description")}
</p>
)}
{isMe && <p>{t("no_recent_activity_description")}</p>}
</div>
) : (
<div

View file

@ -23,7 +23,7 @@ export const UserSignOutModal = ({
onClose={onClose}
>
<div className={styles.signOutModalContent}>
<p style={{ fontFamily: "Fira Sans" }}>{t("sign_out_modal_text")}</p>
<p>{t("sign_out_modal_text")}</p>
<div className={styles.signOutModalButtonsContainer}>
<Button onClick={onConfirm} theme="danger">
{t("sign_out")}