mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-15 16:33:02 -03:00
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:
@@ -783,11 +783,10 @@ export function DownloadGroup({
|
|||||||
|
|
||||||
const actionTypesPromises = completedGames.map(async (game) => {
|
const actionTypesPromises = completedGames.map(async (game) => {
|
||||||
try {
|
try {
|
||||||
const actionType =
|
const actionType = await window.electron.getGameInstallerActionType(
|
||||||
await window.electron.getGameInstallerActionType(
|
game.shop,
|
||||||
game.shop,
|
game.objectId
|
||||||
game.objectId
|
);
|
||||||
);
|
|
||||||
return { gameId: game.id, actionType };
|
return { gameId: game.id, actionType };
|
||||||
} catch {
|
} catch {
|
||||||
return { gameId: game.id, actionType: "open-folder" as const };
|
return { gameId: game.id, actionType: "open-folder" as const };
|
||||||
@@ -937,31 +936,35 @@ export function DownloadGroup({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="download-group__simple-actions">
|
<div className="download-group__simple-actions">
|
||||||
{game.download?.progress === 1 && (() => {
|
{game.download?.progress === 1 &&
|
||||||
const actionType = gameActionTypes[game.id] || "open-folder";
|
(() => {
|
||||||
const isInstall = actionType === "install";
|
const actionType =
|
||||||
|
gameActionTypes[game.id] || "open-folder";
|
||||||
return (
|
const isInstall = actionType === "install";
|
||||||
<Button
|
|
||||||
theme="primary"
|
return (
|
||||||
onClick={() => openGameInstaller(game.shop, game.objectId)}
|
<Button
|
||||||
disabled={isGameDeleting(game.id)}
|
theme="primary"
|
||||||
className="download-group__simple-action-btn"
|
onClick={() =>
|
||||||
>
|
openGameInstaller(game.shop, game.objectId)
|
||||||
{isInstall ? (
|
}
|
||||||
<>
|
disabled={isGameDeleting(game.id)}
|
||||||
<DownloadIcon size={16} />
|
className="download-group__simple-action-btn"
|
||||||
{t("install")}
|
>
|
||||||
</>
|
{isInstall ? (
|
||||||
) : (
|
<>
|
||||||
<>
|
<DownloadIcon size={16} />
|
||||||
<Folder size={16} />
|
{t("install")}
|
||||||
{tGameDetails("open_folder")}
|
</>
|
||||||
</>
|
) : (
|
||||||
)}
|
<>
|
||||||
</Button>
|
<Folder size={16} />
|
||||||
);
|
{tGameDetails("open_folder")}
|
||||||
})()}
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
{isQueuedGroup && game.download?.progress !== 1 && (
|
{isQueuedGroup && game.download?.progress !== 1 && (
|
||||||
<Button
|
<Button
|
||||||
theme="primary"
|
theme="primary"
|
||||||
|
|||||||
@@ -260,10 +260,10 @@ export function ProfileHero() {
|
|||||||
if (userProfile?.id) {
|
if (userProfile?.id) {
|
||||||
navigator.clipboard.writeText(userProfile.id);
|
navigator.clipboard.writeText(userProfile.id);
|
||||||
setIsCopied(true);
|
setIsCopied(true);
|
||||||
|
|
||||||
const startTime = performance.now();
|
const startTime = performance.now();
|
||||||
const duration = 1200; // 1.2 seconds
|
const duration = 1200; // 1.2 seconds
|
||||||
|
|
||||||
const animate = (currentTime: number) => {
|
const animate = (currentTime: number) => {
|
||||||
const elapsed = currentTime - startTime;
|
const elapsed = currentTime - startTime;
|
||||||
if (elapsed < duration) {
|
if (elapsed < duration) {
|
||||||
@@ -272,7 +272,7 @@ export function ProfileHero() {
|
|||||||
setIsCopied(false);
|
setIsCopied(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
requestAnimationFrame(animate);
|
requestAnimationFrame(animate);
|
||||||
}
|
}
|
||||||
}, [userProfile]);
|
}, [userProfile]);
|
||||||
|
|||||||
Reference in New Issue
Block a user