mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 11:42:21 +03:00
fix/confirm-pack-delete: adjust code
This commit is contained in:
parent
99ad11a3e5
commit
8836984454
@ -2,51 +2,39 @@ import { Button, Modal } from "@renderer/components";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import * as styles from "./delete-modal.css";
|
import * as styles from "./delete-modal.css";
|
||||||
|
|
||||||
type DeleteModalProps = {
|
interface DeleteModalProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
deleting: boolean;
|
deleting: boolean;
|
||||||
deleteGame: () => void;
|
deleteGame: () => void;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function DeleteModal({
|
export function DeleteModal({
|
||||||
description,
|
|
||||||
onClose,
|
onClose,
|
||||||
title,
|
|
||||||
visible,
|
visible,
|
||||||
deleting,
|
deleting,
|
||||||
deleteGame,
|
deleteGame,
|
||||||
}: DeleteModalProps) {
|
}: DeleteModalProps) {
|
||||||
const { t } = useTranslation("game_details");
|
const { t } = useTranslation("game_details");
|
||||||
|
|
||||||
|
function handleDeleteGame() {
|
||||||
|
deleteGame();
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
visible={visible}
|
||||||
title={title}
|
title={t("delete_modal_title")}
|
||||||
description={description}
|
description={t("delete_modal_description")}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
>
|
>
|
||||||
<div className={styles.deleteActionsButtonsCtn}>
|
<div className={styles.deleteActionsButtonsCtn}>
|
||||||
<Button
|
<Button onClick={handleDeleteGame} theme="outline" disabled={deleting}>
|
||||||
onClick={() => {
|
|
||||||
deleteGame();
|
|
||||||
onClose();
|
|
||||||
}}
|
|
||||||
theme="outline"
|
|
||||||
disabled={deleting}
|
|
||||||
>
|
|
||||||
{t("delete")}
|
{t("delete")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button onClick={onClose} theme="primary" disabled={deleting}>
|
||||||
onClick={() => {
|
|
||||||
onClose();
|
|
||||||
}}
|
|
||||||
theme="primary"
|
|
||||||
disabled={deleting}
|
|
||||||
>
|
|
||||||
{t("cancel")}
|
{t("cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -179,8 +179,6 @@ export function HeroPanel({
|
|||||||
|
|
||||||
<DeleteModal
|
<DeleteModal
|
||||||
visible={showDeleteModal}
|
visible={showDeleteModal}
|
||||||
title={t("delete_modal_title")}
|
|
||||||
description={t("delete_modal_description")}
|
|
||||||
onClose={() => setShowDeleteModal(false)}
|
onClose={() => setShowDeleteModal(false)}
|
||||||
deleting={deleting}
|
deleting={deleting}
|
||||||
deleteGame={() => deleteGame(game.id).then(getGame)}
|
deleteGame={() => deleteGame(game.id).then(getGame)}
|
||||||
|
Loading…
Reference in New Issue
Block a user