2
0

feat(engine): ️ Add data-block-name prop

This commit is contained in:
Baptiste Arnaud
2022-03-29 11:55:10 +02:00
parent f7d12dc995
commit 023a6f274a
2 changed files with 4 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import { getLastChatStepType } from '../../services/chat'
type ChatBlockProps = {
steps: Step[]
startStepIndex: number
blockTitle: string
onScroll: () => void
onBlockEnd: (
edgeId?: string,
@ -36,6 +37,7 @@ type ChatDisplayChunk = { bubbles: BubbleStep[]; input?: InputStep }
export const ChatBlock = ({
steps,
startStepIndex,
blockTitle,
onScroll,
onBlockEnd,
}: ChatBlockProps) => {
@ -167,7 +169,7 @@ export const ChatBlock = ({
const avatarSrc = typebot.theme.chat.hostAvatar?.url
return (
<div className="flex w-full">
<div className="flex w-full" data-block-name={blockTitle}>
<div className="flex flex-col w-full min-w-0">
{displayedChunks.map((chunk, idx) => (
<ChatChunks

View File

@ -99,6 +99,7 @@ export const ConversationContainer = ({
startStepIndex={displayedBlock.startStepIndex}
onScroll={autoScrollToBottom}
onBlockEnd={displayNextBlock}
blockTitle={displayedBlock.block.title}
/>
))}
{/* We use a block to simulate padding because it makes iOS scroll flicker */}