diff --git a/packages/bot-engine/src/assets/style.css b/packages/bot-engine/src/assets/style.css
index 7b7b18943..ec0b4ff86 100644
--- a/packages/bot-engine/src/assets/style.css
+++ b/packages/bot-engine/src/assets/style.css
@@ -154,6 +154,13 @@ textarea {
.typebot-button {
color: var(--typebot-button-color);
background-color: var(--typebot-button-bg-color);
+ border: 1px solid var(--typebot-button-bg-color);
+}
+
+.typebot-button.selectable {
+ color: var(--typebot-host-bubble-color);
+ background-color: var(--typebot-host-bubble-bg-color);
+ border: 1px solid var(--typebot-button-bg-color);
}
.typebot-host-bubble {
diff --git a/packages/bot-engine/src/components/ChatBlock/AvatarSideContainer.tsx b/packages/bot-engine/src/components/ChatBlock/AvatarSideContainer.tsx
index 7407c0d7f..8b7557f02 100644
--- a/packages/bot-engine/src/components/ChatBlock/AvatarSideContainer.tsx
+++ b/packages/bot-engine/src/components/ChatBlock/AvatarSideContainer.tsx
@@ -38,10 +38,10 @@ export const AvatarSideContainer = () => {
unmountOnExit
>
diff --git a/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx b/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx
index ee02de073..54502438d 100644
--- a/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx
+++ b/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from 'react'
-import { animateScroll as scroll } from 'react-scroll'
import { TransitionGroup, CSSTransition } from 'react-transition-group'
import { ChatStep } from './ChatStep'
import { AvatarSideContainer } from './AvatarSideContainer'
@@ -20,6 +19,7 @@ type ChatBlockProps = {
steps: PublicStep[]
startStepIndex: number
blockIndex: number
+ onScroll: () => void
onBlockEnd: (edgeId?: string) => void
}
@@ -27,6 +27,7 @@ export const ChatBlock = ({
steps,
startStepIndex,
blockIndex,
+ onScroll,
onBlockEnd,
}: ChatBlockProps) => {
const { typebot, updateVariableValue } = useTypebot()
@@ -41,7 +42,7 @@ export const ChatBlock = ({
}, [])
useEffect(() => {
- autoScrollToBottom()
+ onScroll()
onNewStepDisplayed()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [displayedSteps])
@@ -69,13 +70,6 @@ export const ChatBlock = ({
}
}
- const autoScrollToBottom = () => {
- scroll.scrollToBottom({
- duration: 500,
- containerId: 'scrollable-container',
- })
- }
-
const displayNextStep = (answerContent?: string) => {
const currentStep = [...displayedSteps].pop()
if (currentStep) {
diff --git a/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/TextBubble.tsx b/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/TextBubble.tsx
index d83f94d43..a4b880148 100644
--- a/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/TextBubble.tsx
+++ b/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/TextBubble.tsx
@@ -55,7 +55,9 @@ export const TextBubble = ({ step, onTransitionEnd }: Props) => {
const sendAvatarOffset = () => {
if (!messageContainer.current) return
const containerDimensions = messageContainer.current.getBoundingClientRect()
- updateLastAvatarOffset(containerDimensions.top + containerDimensions.height)
+ updateLastAvatarOffset(
+ messageContainer.current.offsetTop + containerDimensions.height
+ )
}
return (
diff --git a/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx b/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx
index 438f15eb5..e19bb0df8 100644
--- a/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx
+++ b/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx
@@ -44,8 +44,8 @@ export const ChoiceForm = ({ step, onSubmit }: ChoiceFormProps) => {
className={
'py-2 px-4 font-semibold rounded-md transition-all filter hover:brightness-90 active:brightness-75 duration-100 focus:outline-none mr-2 mb-2 typebot-button ' +
(selectedIndices.includes(idx) || !step.options?.isMultipleChoice
- ? 'active'
- : '')
+ ? ''
+ : 'selectable')
}
data-testid="button"
>
diff --git a/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/SendButton.tsx b/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/SendButton.tsx
index fe24d6b7f..254caa13a 100644
--- a/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/SendButton.tsx
+++ b/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/SendButton.tsx
@@ -17,7 +17,7 @@ export const SendButton = ({
disabled={isDisabled}
{...props}
className={
- 'py-2 px-4 font-semibold rounded-md text-white focus:outline-none flex items-center disabled:opacity-50 disabled:cursor-not-allowed disabled:brightness-100 transition-all filter hover:brightness-90 active:brightness-75 typebot-button active ' +
+ 'py-2 px-4 font-semibold rounded-md text-white focus:outline-none flex items-center disabled:opacity-50 disabled:cursor-not-allowed disabled:brightness-100 transition-all filter hover:brightness-90 active:brightness-75 typebot-button ' +
props.className
}
>
diff --git a/packages/bot-engine/src/components/ConversationContainer.tsx b/packages/bot-engine/src/components/ConversationContainer.tsx
index 823c6a1c3..858d72dfa 100644
--- a/packages/bot-engine/src/components/ConversationContainer.tsx
+++ b/packages/bot-engine/src/components/ConversationContainer.tsx
@@ -7,6 +7,7 @@ import { useAnswers } from '../contexts/AnswersContext'
import { deepEqual } from 'fast-equals'
import { Answer, Edge, PublicBlock, PublicTypebot } from 'models'
import { byId } from 'utils'
+import { animateScroll as scroll } from 'react-scroll'
type Props = {
typebot: PublicTypebot
@@ -27,6 +28,7 @@ export const ConversationContainer = ({
const [localAnswer, setLocalAnswer] = useState
()
const { answers } = useAnswers()
const bottomAnchor = useRef(null)
+ const scrollableContainer = useRef(null)
const displayNextBlock = (edgeId?: string) => {
const nextEdge = typebot.edges.find(byId(edgeId))
@@ -60,10 +62,18 @@ export const ConversationContainer = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [answers])
+ const autoScrollToBottom = () => {
+ if (!scrollableContainer.current) return
+ scroll.scrollToBottom({
+ duration: 500,
+ container: scrollableContainer.current,
+ })
+ }
+
return (
)
}