2
0
Files
bot/apps/builder/components/analytics/graph/Edges/DropOffEdge.tsx

20 lines
604 B
TypeScript
Raw Normal View History

2022-01-03 17:39:59 +01:00
import { useAnalyticsGraph } from 'contexts/AnalyticsGraphProvider'
import React, { useMemo } from 'react'
import { computeDropOffPath } from 'services/graph'
type Props = {
blockId: string
}
export const DropOffEdge = ({ blockId }: Props) => {
const { typebot } = useAnalyticsGraph()
2022-01-06 09:40:56 +01:00
2022-01-03 17:39:59 +01:00
const path = useMemo(() => {
if (!typebot) return
2022-01-06 09:40:56 +01:00
const block = typebot.blocks.byId[blockId]
2022-01-03 17:39:59 +01:00
if (!block) return ''
2022-01-06 09:40:56 +01:00
return computeDropOffPath(block.graphCoordinates, block.stepIds.length - 1)
2022-01-03 17:39:59 +01:00
}, [blockId, typebot])
return <path d={path} stroke={'#E53E3E'} strokeWidth="2px" fill="none" />
}