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 | import { useSelector } from "react-redux"; import useIsPrefetched from "../../../hooks/playbooks/useIsPrefetched"; import CustomButton from "../CustomButton"; import { DeleteRounded } from "@mui/icons-material"; import { additionalStateSelector } from "../../../store/features/drawers/selectors"; import useEdgeConditions from "../../../hooks/playbooks/useEdgeConditions"; import { RuleType } from "./types"; type DeleteRuleButtonProps = { ruleIndex: number; ruleType: RuleType; }; function DeleteRuleButton({ ruleIndex, ruleType }: DeleteRuleButtonProps) { const { id } = useSelector(additionalStateSelector); const isPrefetched = useIsPrefetched(); const { handleDeleteRule } = useEdgeConditions(id); const handleDelete = () => { handleDeleteRule(ruleType, ruleIndex); }; Iif (isPrefetched) return; return ( <div className="flex gap-2 flex-wrap"> <CustomButton className="!text-sm !w-fit" onClick={handleDelete}> <DeleteRounded fontSize="inherit" /> </CustomButton> </div> ); } export default DeleteRuleButton; |