mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: add reset achievements modal
This commit is contained in:
parent
500db90974
commit
47a5f4d327
4 changed files with 73 additions and 2 deletions
|
@ -168,7 +168,10 @@
|
||||||
"select_folder": "Select folder",
|
"select_folder": "Select folder",
|
||||||
"backup_from": "Backup from {{date}}",
|
"backup_from": "Backup from {{date}}",
|
||||||
"custom_backup_location_set": "Custom backup location set",
|
"custom_backup_location_set": "Custom backup location set",
|
||||||
"no_directory_selected": "No directory selected"
|
"no_directory_selected": "No directory selected",
|
||||||
|
"reset_achievements": "Reset achievements",
|
||||||
|
"reset_achievements_description": "This will reset all achievements for {{game}}",
|
||||||
|
"reset_achievements_title": "Are you sure?"
|
||||||
},
|
},
|
||||||
"activation": {
|
"activation": {
|
||||||
"title": "Activate Hydra",
|
"title": "Activate Hydra",
|
||||||
|
|
|
@ -164,7 +164,10 @@
|
||||||
"select_folder": "Selecione a pasta",
|
"select_folder": "Selecione a pasta",
|
||||||
"manage_files_description": "Gerencie quais arquivos serão feitos backup",
|
"manage_files_description": "Gerencie quais arquivos serão feitos backup",
|
||||||
"clear": "Limpar",
|
"clear": "Limpar",
|
||||||
"no_directory_selected": "Nenhum diretório selecionado"
|
"no_directory_selected": "Nenhum diretório selecionado",
|
||||||
|
"reset_achievements": "Resetar conquistas",
|
||||||
|
"reset_achievements_description": "Isso irá resetar todas as conquistas de {{game}}",
|
||||||
|
"reset_achievements_title": "Tem certeza?"
|
||||||
},
|
},
|
||||||
"activation": {
|
"activation": {
|
||||||
"title": "Ativação",
|
"title": "Ativação",
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { gameDetailsContext } from "@renderer/context";
|
||||||
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
|
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
|
||||||
import { useDownload, useToast } from "@renderer/hooks";
|
import { useDownload, useToast } from "@renderer/hooks";
|
||||||
import { RemoveGameFromLibraryModal } from "./remove-from-library-modal";
|
import { RemoveGameFromLibraryModal } from "./remove-from-library-modal";
|
||||||
|
import { ResetAchievementsModal } from "./reset-achievements-modal";
|
||||||
import { FileDirectoryIcon, FileIcon } from "@primer/octicons-react";
|
import { FileDirectoryIcon, FileIcon } from "@primer/octicons-react";
|
||||||
|
|
||||||
export interface GameOptionsModalProps {
|
export interface GameOptionsModalProps {
|
||||||
|
@ -29,6 +30,8 @@ export function GameOptionsModal({
|
||||||
|
|
||||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||||
const [showRemoveGameModal, setShowRemoveGameModal] = useState(false);
|
const [showRemoveGameModal, setShowRemoveGameModal] = useState(false);
|
||||||
|
const [showResetAchievementsModal, setShowResetAchievementsModal] =
|
||||||
|
useState(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
removeGameInstaller,
|
removeGameInstaller,
|
||||||
|
@ -134,6 +137,13 @@ export function GameOptionsModal({
|
||||||
game={game}
|
game={game}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ResetAchievementsModal
|
||||||
|
visible={showResetAchievementsModal}
|
||||||
|
onClose={() => setShowResetAchievementsModal(false)}
|
||||||
|
// resetAchievements={handleResetAchievements}
|
||||||
|
game={game}
|
||||||
|
/>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
visible={visible}
|
||||||
title={game.title}
|
title={game.title}
|
||||||
|
@ -267,6 +277,15 @@ export function GameOptionsModal({
|
||||||
>
|
>
|
||||||
{t("remove_from_library")}
|
{t("remove_from_library")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
onClick={() => setShowResetAchievementsModal(true)}
|
||||||
|
theme="danger"
|
||||||
|
disabled={isGameDownloading || deleting}
|
||||||
|
>
|
||||||
|
{t("reset_achievements")}
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowDeleteModal(true);
|
setShowDeleteModal(true);
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Button, Modal } from "@renderer/components";
|
||||||
|
import * as styles from "./remove-from-library-modal.css";
|
||||||
|
import type { Game } from "@types";
|
||||||
|
|
||||||
|
interface ResetAchievementsModalProps {
|
||||||
|
visible: boolean;
|
||||||
|
game: Game;
|
||||||
|
onClose: () => void;
|
||||||
|
// resetAchievements: () => Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ResetAchievementsModal({
|
||||||
|
onClose,
|
||||||
|
game,
|
||||||
|
visible,
|
||||||
|
// resetAchievements,
|
||||||
|
}: ResetAchievementsModalProps) {
|
||||||
|
const { t } = useTranslation("game_details");
|
||||||
|
|
||||||
|
const handleResetAchievements = async () => {
|
||||||
|
// await resetAchievements();
|
||||||
|
onClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
visible={visible}
|
||||||
|
title={t("reset_achievements_title")}
|
||||||
|
description={t("reset_achievements_description", {
|
||||||
|
game: game.title,
|
||||||
|
})}
|
||||||
|
onClose={onClose}
|
||||||
|
>
|
||||||
|
<div className={styles.deleteActionsButtonsCtn}>
|
||||||
|
<Button onClick={handleResetAchievements} theme="outline">
|
||||||
|
{t("reset_achievements")}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button onClick={onClose} theme="primary">
|
||||||
|
{t("cancel")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue