mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 05:24:55 +03:00
feat: disable reset achievement button if has no achievements
This commit is contained in:
parent
5061695500
commit
2df57b071d
@ -26,7 +26,7 @@ export function GameOptionsModal({
|
||||
|
||||
const { showSuccessToast, showErrorToast } = useToast();
|
||||
|
||||
const { updateGame, setShowRepacksModal, repacks, selectGameExecutable } =
|
||||
const { updateGame, setShowRepacksModal, repacks, selectGameExecutable, achievements } =
|
||||
useContext(gameDetailsContext);
|
||||
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
@ -43,6 +43,10 @@ export function GameOptionsModal({
|
||||
cancelDownload,
|
||||
} = useDownload();
|
||||
|
||||
const hasAchievements =
|
||||
(achievements?.filter((achievement) => achievement.unlocked).length ?? 0) >
|
||||
0;
|
||||
|
||||
const deleting = isGameDeleting(game.id);
|
||||
|
||||
const { lastPacket } = useDownload();
|
||||
@ -341,7 +345,7 @@ export function GameOptionsModal({
|
||||
<Button
|
||||
onClick={() => setShowResetAchievementsModal(true)}
|
||||
theme="danger"
|
||||
disabled={deleting || isDeletingAchievements}
|
||||
disabled={deleting || isDeletingAchievements || !hasAchievements}
|
||||
>
|
||||
{t("reset_achievements")}
|
||||
</Button>
|
||||
|
Loading…
Reference in New Issue
Block a user