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 | import { useSelector } from "react-redux"; import { currentPlaybookSelector } from "../../../store/features/playbook/playbookSlice.ts"; import { StepRelation, StepRelationContract } from "../../../types/index.ts"; import useCurrentStep from "./useCurrentStep.ts"; function useHasChildren(id: string) { const currentPlaybook = useSelector(currentPlaybookSelector); const [step] = useCurrentStep(id); const relations: (StepRelation | StepRelationContract)[] = currentPlaybook?.step_relations ?? []; const child = relations.findIndex((r) => { Iif (typeof r.parent === "string") { return r.parent === step?.id; } return r.parent.reference_id === step?.reference_id; }); return child !== -1; } export default useHasChildren; |