diff --git a/src/assets/index.css b/src/assets/index.css index 34ce4a4d7..9ca868b5a 100644 --- a/src/assets/index.css +++ b/src/assets/index.css @@ -82,42 +82,23 @@ pre { transition: opacity 400ms ease-in 200ms; } -.bubble-typing { - transition: - width 400ms ease-out, - height 400ms ease-out; -} - -.bubble1, -.bubble2, -.bubble3 { - background-color: var(--chatbot-host-bubble-color); - opacity: 0.5; -} - -.bubble1 { - animation: chatBubbles 1s ease-in-out infinite; -} - -.bubble2 { - animation: chatBubbles 1s ease-in-out infinite; - animation-delay: 0.3s; -} - -.bubble3 { - animation: chatBubbles 1s ease-in-out infinite; - animation-delay: 0.5s; -} + .typing-dot { + background-color: var(--chatbot-host-bubble-color); + opacity: 0.2; + animation: typingBlink 1.2s infinite ease-in-out; + animation-fill-mode: both; + will-change: opacity; + } -@keyframes chatBubbles { +@keyframes typingBlink { 0% { - transform: translateY(0); + opacity: 0.2; } 50% { - transform: translateY(-5px); + opacity: 1; } 100% { - transform: translateY(0); + opacity: 0.2; } } @@ -208,12 +189,6 @@ textarea { white-space: normal; } -.chatbot-host-bubble > .bubble-typing { - background-color: #f7f8ff; - border: var(--chatbot-host-bubble-border); - border-radius: 6px; -} - .chatbot-host-bubble img, .chatbot-host-bubble iframe, .chatbot-host-bubble video { diff --git a/src/components/Bot.tsx b/src/components/Bot.tsx index ca42113d0..19b50d4a3 100644 --- a/src/components/Bot.tsx +++ b/src/components/Bot.tsx @@ -478,6 +478,13 @@ export const Bot = (botProps: BotProps & { class?: string }) => { const [isMessageStopping, setIsMessageStopping] = createSignal(false); const [starterPrompts, setStarterPrompts] = createSignal([], { equals: false }); const [chatFeedbackStatus, setChatFeedbackStatus] = createSignal(false); + const showTypingBubble = createMemo(() => { + if (!loading()) return false; + const msgs = messages(); + const last = msgs[msgs.length - 1]; + if (!last) return false; + return last.type === 'userMessage' || (last.type === 'apiMessage' && last.message === ''); + }); const [fullFileUpload, setFullFileUpload] = createSignal(false); const [uploadsConfig, setUploadsConfig] = createSignal(); const [leadsConfig, setLeadsConfig] = createSignal(); @@ -1876,12 +1883,13 @@ export const Bot = (botProps: BotProps & { class?: string }) => { setLeadEmail={setLeadEmail} /> )} - {message.type === 'userMessage' && loading() && index() === messages().length - 1 && } - {message.type === 'apiMessage' && message.message === '' && loading() && index() === messages().length - 1 && } ); }} +
+ +
0}> diff --git a/src/components/TypingBubble.tsx b/src/components/TypingBubble.tsx index 833278fa9..4beb831c8 100644 --- a/src/components/TypingBubble.tsx +++ b/src/components/TypingBubble.tsx @@ -1,7 +1,7 @@ export const TypingBubble = () => (
-
-
-
+
+
+
); diff --git a/src/components/inputs/textInput/components/ShortTextInput.tsx b/src/components/inputs/textInput/components/ShortTextInput.tsx index 029b3a1a5..168de9f34 100644 --- a/src/components/inputs/textInput/components/ShortTextInput.tsx +++ b/src/components/inputs/textInput/components/ShortTextInput.tsx @@ -21,7 +21,7 @@ export const ShortTextInput = (props: ShortTextInputProps) => { // reset height when value is empty setHeight(DEFAULT_HEIGHT); } else { - setHeight(e.currentTarget.scrollHeight - 24); + setHeight(Math.min(Math.max(e.currentTarget.scrollHeight, DEFAULT_HEIGHT), 128)); } e.currentTarget.scrollTo(0, e.currentTarget.scrollHeight); local.onInput(e.currentTarget.value);