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 { showSuccessToast, showErrorToast } = useToast();
|
||||||
|
|
||||||
const { updateGame, setShowRepacksModal, repacks, selectGameExecutable } =
|
const { updateGame, setShowRepacksModal, repacks, selectGameExecutable, achievements } =
|
||||||
useContext(gameDetailsContext);
|
useContext(gameDetailsContext);
|
||||||
|
|
||||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||||
@ -43,6 +43,10 @@ export function GameOptionsModal({
|
|||||||
cancelDownload,
|
cancelDownload,
|
||||||
} = useDownload();
|
} = useDownload();
|
||||||
|
|
||||||
|
const hasAchievements =
|
||||||
|
(achievements?.filter((achievement) => achievement.unlocked).length ?? 0) >
|
||||||
|
0;
|
||||||
|
|
||||||
const deleting = isGameDeleting(game.id);
|
const deleting = isGameDeleting(game.id);
|
||||||
|
|
||||||
const { lastPacket } = useDownload();
|
const { lastPacket } = useDownload();
|
||||||
@ -341,7 +345,7 @@ export function GameOptionsModal({
|
|||||||
<Button
|
<Button
|
||||||
onClick={() => setShowResetAchievementsModal(true)}
|
onClick={() => setShowResetAchievementsModal(true)}
|
||||||
theme="danger"
|
theme="danger"
|
||||||
disabled={deleting || isDeletingAchievements}
|
disabled={deleting || isDeletingAchievements || !hasAchievements}
|
||||||
>
|
>
|
||||||
{t("reset_achievements")}
|
{t("reset_achievements")}
|
||||||
</Button>
|
</Button>
|
||||||
|
Loading…
Reference in New Issue
Block a user