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 | import React from "react"; import { Delete } from "@mui/icons-material"; import { deleteStep } from "../../../store/features/playbook/playbookSlice.ts"; import { useDispatch } from "react-redux"; import CustomButton from "../../common/CustomButton/index.tsx"; import useCurrentStep from "../../../hooks/playbooks/step/useCurrentStep.ts"; import usePermanentDrawerState from "../../../hooks/common/usePermanentDrawerState.ts"; function DeleteStepButton({ id }) { const [step, currentStepId] = useCurrentStep(id); const dispatch = useDispatch(); const { closeDrawer } = usePermanentDrawerState(); const handleNoAction = ( e: React.MouseEvent<HTMLButtonElement, MouseEvent>, ) => { e.preventDefault(); e.stopPropagation(); }; const handleDelete = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { handleNoAction(e); dispatch(deleteStep(currentStepId)); closeDrawer(); }; Iif (step?.ui_requirement?.stepIndex === 0) return; return ( <CustomButton onClick={handleDelete}> <Delete fontSize="medium" /> </CustomButton> ); } export default DeleteStepButton; |