mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 05:24:55 +03:00
feat: disable reset achievements button if user is not logged in
This commit is contained in:
parent
3efb1425b9
commit
cade56bb12
@ -5,7 +5,7 @@ import type { Game } from "@types";
|
||||
import * as styles from "./game-options-modal.css";
|
||||
import { gameDetailsContext } from "@renderer/context";
|
||||
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
|
||||
import { useDownload, useToast } from "@renderer/hooks";
|
||||
import { useDownload, useToast, useUserDetails } from "@renderer/hooks";
|
||||
import { RemoveGameFromLibraryModal } from "./remove-from-library-modal";
|
||||
import { ResetAchievementsModal } from "./reset-achievements-modal";
|
||||
import { FileDirectoryIcon, FileIcon } from "@primer/octicons-react";
|
||||
@ -48,6 +48,8 @@ export function GameOptionsModal({
|
||||
cancelDownload,
|
||||
} = useDownload();
|
||||
|
||||
const { userDetails } = useUserDetails();
|
||||
|
||||
const hasAchievements =
|
||||
(achievements?.filter((achievement) => achievement.unlocked).length ?? 0) >
|
||||
0;
|
||||
@ -350,7 +352,12 @@ export function GameOptionsModal({
|
||||
<Button
|
||||
onClick={() => setShowResetAchievementsModal(true)}
|
||||
theme="danger"
|
||||
disabled={deleting || isDeletingAchievements || !hasAchievements}
|
||||
disabled={
|
||||
deleting ||
|
||||
isDeletingAchievements ||
|
||||
!hasAchievements ||
|
||||
!userDetails
|
||||
}
|
||||
>
|
||||
{t("reset_achievements")}
|
||||
</Button>
|
||||
|
Loading…
Reference in New Issue
Block a user