mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-20 09:43:57 +00:00
feat: implement reset game achievements functionality
This commit is contained in:
2
src/renderer/src/declaration.d.ts
vendored
2
src/renderer/src/declaration.d.ts
vendored
@@ -105,7 +105,7 @@ declare global {
|
||||
) => void
|
||||
) => () => Electron.IpcRenderer;
|
||||
onLibraryBatchComplete: (cb: () => void) => () => Electron.IpcRenderer;
|
||||
|
||||
resetGameAchievements: (gameId: number) => Promise<void>;
|
||||
/* User preferences */
|
||||
getUserPreferences: () => Promise<UserPreferences | null>;
|
||||
updateUserPreferences: (
|
||||
|
||||
@@ -122,6 +122,11 @@ export function GameOptionsModal({
|
||||
const shouldShowWinePrefixConfiguration =
|
||||
window.electron.platform === "linux";
|
||||
|
||||
const handleResetAchievements = async () => {
|
||||
await window.electron.resetGameAchievements(game.id);
|
||||
updateGame();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DeleteGameModal
|
||||
@@ -140,7 +145,7 @@ export function GameOptionsModal({
|
||||
<ResetAchievementsModal
|
||||
visible={showResetAchievementsModal}
|
||||
onClose={() => setShowResetAchievementsModal(false)}
|
||||
// resetAchievements={handleResetAchievements}
|
||||
resetAchievements={handleResetAchievements}
|
||||
game={game}
|
||||
/>
|
||||
|
||||
|
||||
@@ -7,19 +7,19 @@ interface ResetAchievementsModalProps {
|
||||
visible: boolean;
|
||||
game: Game;
|
||||
onClose: () => void;
|
||||
// resetAchievements: () => Promise<void>;
|
||||
resetAchievements: () => Promise<void>;
|
||||
}
|
||||
|
||||
export function ResetAchievementsModal({
|
||||
onClose,
|
||||
game,
|
||||
visible,
|
||||
// resetAchievements,
|
||||
resetAchievements,
|
||||
}: ResetAchievementsModalProps) {
|
||||
const { t } = useTranslation("game_details");
|
||||
|
||||
const handleResetAchievements = async () => {
|
||||
// await resetAchievements();
|
||||
await resetAchievements();
|
||||
onClose();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user