refactor: clean up code formatting and improve readability in DownloadGroup and ProfileHero components

- Adjusted indentation and spacing for better code clarity in DownloadGroup.
- Removed unnecessary blank lines in ProfileHero to streamline the code structure.
- Ensured consistent formatting across both components.
This commit is contained in:
Chubby Granny Chaser
2026-01-11 17:14:24 +00:00
parent 2029f861f6
commit f8ba72a0e2
2 changed files with 36 additions and 33 deletions

View File

@@ -783,11 +783,10 @@ export function DownloadGroup({
const actionTypesPromises = completedGames.map(async (game) => {
try {
const actionType =
await window.electron.getGameInstallerActionType(
game.shop,
game.objectId
);
const actionType = await window.electron.getGameInstallerActionType(
game.shop,
game.objectId
);
return { gameId: game.id, actionType };
} catch {
return { gameId: game.id, actionType: "open-folder" as const };
@@ -937,31 +936,35 @@ export function DownloadGroup({
)}
<div className="download-group__simple-actions">
{game.download?.progress === 1 && (() => {
const actionType = gameActionTypes[game.id] || "open-folder";
const isInstall = actionType === "install";
return (
<Button
theme="primary"
onClick={() => openGameInstaller(game.shop, game.objectId)}
disabled={isGameDeleting(game.id)}
className="download-group__simple-action-btn"
>
{isInstall ? (
<>
<DownloadIcon size={16} />
{t("install")}
</>
) : (
<>
<Folder size={16} />
{tGameDetails("open_folder")}
</>
)}
</Button>
);
})()}
{game.download?.progress === 1 &&
(() => {
const actionType =
gameActionTypes[game.id] || "open-folder";
const isInstall = actionType === "install";
return (
<Button
theme="primary"
onClick={() =>
openGameInstaller(game.shop, game.objectId)
}
disabled={isGameDeleting(game.id)}
className="download-group__simple-action-btn"
>
{isInstall ? (
<>
<DownloadIcon size={16} />
{t("install")}
</>
) : (
<>
<Folder size={16} />
{tGameDetails("open_folder")}
</>
)}
</Button>
);
})()}
{isQueuedGroup && game.download?.progress !== 1 && (
<Button
theme="primary"

View File

@@ -260,10 +260,10 @@ export function ProfileHero() {
if (userProfile?.id) {
navigator.clipboard.writeText(userProfile.id);
setIsCopied(true);
const startTime = performance.now();
const duration = 1200; // 1.2 seconds
const animate = (currentTime: number) => {
const elapsed = currentTime - startTime;
if (elapsed < duration) {
@@ -272,7 +272,7 @@ export function ProfileHero() {
setIsCopied(false);
}
};
requestAnimationFrame(animate);
}
}, [userProfile]);