import { chakra } from '@chakra-ui/system' import { useAnalyticsGraph } from 'contexts/AnalyticsGraphProvider' import React, { useMemo } from 'react' import { AnswersCount } from 'services/analytics' import { isDefined } from 'utils' import { DropOffBlock } from '../blocks/DropOffBlock' import { DropOffEdge } from './DropOffEdge' import { Edge } from './Edge' type Props = { answersCounts?: AnswersCount[] } export const Edges = ({ answersCounts }: Props) => { const { typebot } = useAnalyticsGraph() const stepIdsWithTarget: string[] = useMemo(() => { if (!typebot) return [] return typebot.steps.allIds.filter((stepId) => isDefined(typebot.steps.byId[stepId].target) ) }, [typebot]) return ( <> {stepIdsWithTarget.map((stepId) => ( ))} {answersCounts?.map((answersCount) => ( ))} {answersCounts?.map((answersCount) => ( ))} ) }