2
0
Files
bot/apps/builder/components/shared/Graph/GraphContent.tsx

32 lines
892 B
TypeScript
Raw Normal View History

import { useTypebot } from 'contexts/TypebotContext'
2022-06-11 07:27:38 +02:00
import { Group } from 'models'
import React from 'react'
import { AnswersCount } from 'services/analytics'
import { Edges } from './Edges'
2022-06-11 07:27:38 +02:00
import { GroupNode } from './Nodes/GroupNode'
type Props = {
answersCounts?: AnswersCount[]
onUnlockProPlanClick?: () => void
}
const MyComponent = ({ answersCounts, onUnlockProPlanClick }: Props) => {
const { typebot } = useTypebot()
return (
<>
<Edges
edges={typebot?.edges ?? []}
answersCounts={answersCounts}
onUnlockProPlanClick={onUnlockProPlanClick}
/>
2022-06-11 07:27:38 +02:00
{typebot?.groups.map((group, idx) => (
<GroupNode group={group as Group} groupIndex={idx} key={group.id} />
))}
</>
)
}
// Performance hack, never rerender when graph (parent) is panned
const areEqual = () => true
export default React.memo(MyComponent, areEqual)