fix/confirm-pack-delete: adjust code

This commit is contained in:
Guilherme Viana 2024-04-15 15:42:31 -03:00
parent 99ad11a3e5
commit 8836984454
2 changed files with 11 additions and 25 deletions

View File

@ -2,51 +2,39 @@ import { Button, Modal } from "@renderer/components";
import { useTranslation } from "react-i18next";
import * as styles from "./delete-modal.css";
type DeleteModalProps = {
interface DeleteModalProps {
visible: boolean;
title: string;
description: string;
onClose: () => void;
deleting: boolean;
deleteGame: () => void;
};
}
export function DeleteModal({
description,
onClose,
title,
visible,
deleting,
deleteGame,
}: DeleteModalProps) {
const { t } = useTranslation("game_details");
function handleDeleteGame() {
deleteGame();
onClose();
}
return (
<Modal
visible={visible}
title={title}
description={description}
title={t("delete_modal_title")}
description={t("delete_modal_description")}
onClose={onClose}
>
<div className={styles.deleteActionsButtonsCtn}>
<Button
onClick={() => {
deleteGame();
onClose();
}}
theme="outline"
disabled={deleting}
>
<Button onClick={handleDeleteGame} theme="outline" disabled={deleting}>
{t("delete")}
</Button>
<Button
onClick={() => {
onClose();
}}
theme="primary"
disabled={deleting}
>
<Button onClick={onClose} theme="primary" disabled={deleting}>
{t("cancel")}
</Button>
</div>

View File

@ -179,8 +179,6 @@ export function HeroPanel({
<DeleteModal
visible={showDeleteModal}
title={t("delete_modal_title")}
description={t("delete_modal_description")}
onClose={() => setShowDeleteModal(false)}
deleting={deleting}
deleteGame={() => deleteGame(game.id).then(getGame)}