🐛 (editor) Fix AB test items not connectable
This commit is contained in:
@ -6,9 +6,10 @@ import { defaultAbTestOptions } from '@typebot.io/schemas/features/blocks/logic/
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
block: AbTestBlock
|
block: AbTestBlock
|
||||||
|
groupId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AbTestNodeBody = ({ block }: Props) => {
|
export const AbTestNodeBody = ({ block, groupId }: Props) => {
|
||||||
const borderColor = useColorModeValue('gray.200', 'gray.700')
|
const borderColor = useColorModeValue('gray.200', 'gray.700')
|
||||||
const bg = useColorModeValue('white', undefined)
|
const bg = useColorModeValue('white', undefined)
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ export const AbTestNodeBody = ({ block }: Props) => {
|
|||||||
blockId: block.id,
|
blockId: block.id,
|
||||||
itemId: block.items[0].id,
|
itemId: block.items[0].id,
|
||||||
}}
|
}}
|
||||||
|
groupId={groupId}
|
||||||
pos="absolute"
|
pos="absolute"
|
||||||
right="-49px"
|
right="-49px"
|
||||||
pointerEvents="all"
|
pointerEvents="all"
|
||||||
@ -59,6 +61,7 @@ export const AbTestNodeBody = ({ block }: Props) => {
|
|||||||
blockId: block.id,
|
blockId: block.id,
|
||||||
itemId: block.items[1].id,
|
itemId: block.items[1].id,
|
||||||
}}
|
}}
|
||||||
|
groupId={groupId}
|
||||||
pos="absolute"
|
pos="absolute"
|
||||||
right="-49px"
|
right="-49px"
|
||||||
pointerEvents="all"
|
pointerEvents="all"
|
||||||
|
@ -25,7 +25,7 @@ export const BlockSourceEndpoint = ({
|
|||||||
...props
|
...props
|
||||||
}: BoxProps & {
|
}: BoxProps & {
|
||||||
source: BlockSource
|
source: BlockSource
|
||||||
groupId?: string
|
groupId: string
|
||||||
isHidden?: boolean
|
isHidden?: boolean
|
||||||
}) => {
|
}) => {
|
||||||
const id = source.itemId ?? source.blockId
|
const id = source.itemId ?? source.blockId
|
||||||
|
@ -239,7 +239,13 @@ export const BlockNode = ({
|
|||||||
mt="1"
|
mt="1"
|
||||||
data-testid={`${block.id}-icon`}
|
data-testid={`${block.id}-icon`}
|
||||||
/>
|
/>
|
||||||
<BlockNodeContent block={block} indices={indices} />
|
{typebot?.groups[indices.groupIndex].id && (
|
||||||
|
<BlockNodeContent
|
||||||
|
block={block}
|
||||||
|
indices={indices}
|
||||||
|
groupId={typebot.groups[indices.groupIndex].id}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{(hasIcomingEdge || isDefined(connectingIds)) && (
|
{(hasIcomingEdge || isDefined(connectingIds)) && (
|
||||||
<TargetEndpoint
|
<TargetEndpoint
|
||||||
pos="absolute"
|
pos="absolute"
|
||||||
@ -252,6 +258,7 @@ export const BlockNode = ({
|
|||||||
{(isConnectable ||
|
{(isConnectable ||
|
||||||
(pathname.endsWith('analytics') && isInputBlock(block))) &&
|
(pathname.endsWith('analytics') && isInputBlock(block))) &&
|
||||||
hasDefaultConnector(block) &&
|
hasDefaultConnector(block) &&
|
||||||
|
groupId &&
|
||||||
block.type !== LogicBlockType.JUMP && (
|
block.type !== LogicBlockType.JUMP && (
|
||||||
<BlockSourceEndpoint
|
<BlockSourceEndpoint
|
||||||
source={{
|
source={{
|
||||||
|
@ -41,9 +41,14 @@ import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integr
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
block: BlockV6
|
block: BlockV6
|
||||||
|
groupId: string
|
||||||
indices: BlockIndices
|
indices: BlockIndices
|
||||||
}
|
}
|
||||||
export const BlockNodeContent = ({ block, indices }: Props): JSX.Element => {
|
export const BlockNodeContent = ({
|
||||||
|
block,
|
||||||
|
indices,
|
||||||
|
groupId,
|
||||||
|
}: Props): JSX.Element => {
|
||||||
switch (block.type) {
|
switch (block.type) {
|
||||||
case BubbleBlockType.TEXT: {
|
case BubbleBlockType.TEXT: {
|
||||||
return <TextBubbleContent block={block} />
|
return <TextBubbleContent block={block} />
|
||||||
@ -109,7 +114,7 @@ export const BlockNodeContent = ({ block, indices }: Props): JSX.Element => {
|
|||||||
return <JumpNodeBody options={block.options} />
|
return <JumpNodeBody options={block.options} />
|
||||||
}
|
}
|
||||||
case LogicBlockType.AB_TEST: {
|
case LogicBlockType.AB_TEST: {
|
||||||
return <AbTestNodeBody block={block} />
|
return <AbTestNodeBody block={block} groupId={groupId} />
|
||||||
}
|
}
|
||||||
case LogicBlockType.TYPEBOT_LINK:
|
case LogicBlockType.TYPEBOT_LINK:
|
||||||
return <TypebotLinkNode block={block} />
|
return <TypebotLinkNode block={block} />
|
||||||
|
@ -22,7 +22,7 @@ export const BlockNodeOverlay = ({
|
|||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<BlockIcon type={block.type} />
|
<BlockIcon type={block.type} />
|
||||||
<BlockNodeContent block={block} indices={indices} />
|
<BlockNodeContent block={block} indices={indices} groupId="" />
|
||||||
</HStack>
|
</HStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user