Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | /* eslint-disable react-hooks/exhaustive-deps */ import { useEffect } from "react"; import { useDeletePlaybookMutation } from "../../store/features/playbook/api/index.ts"; import Overlay from "../Overlay/index.js"; import styles from "./index.module.css"; import { CircularProgress } from "@mui/material"; const PlaybookActionOverlay = ({ playbook, isOpen, toggleOverlay, refreshTable, }) => { const [deletePlaybook, { isLoading, isSuccess, status }] = useDeletePlaybookMutation(); const handleSuccess = () => { deletePlaybook(playbook.id); }; useEffect(() => { Iif (isSuccess) { toggleOverlay(); refreshTable(); } }, [status]); return ( <> {isOpen && ( <Overlay close={toggleOverlay} visible={isOpen}> <div className={styles["actionOverlay"]}> <header className="text-gray-500">Delete {playbook.name}?</header> <div className={styles.actions}> <button className={styles["submitButton"]} onClick={toggleOverlay}> Cancel </button> <button className={styles["submitButtonRight"]} onClick={handleSuccess}> Yes </button> {isLoading && ( <CircularProgress style={{ marginLeft: "12px", }} size={20} /> )} </div> </div> </Overlay> )} </> ); }; export default PlaybookActionOverlay; |