From 787a06d06e93cf59a5259c7f01477492f6b4fe09 Mon Sep 17 00:00:00 2001 From: ajaythapliyal Date: Sun, 5 Mar 2023 19:22:03 +0530 Subject: [PATCH] refactors bubble logic --- .../src/conversation/ConversationBubble.tsx | 63 +++++++++---------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 258c0242..8746f5de 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -11,41 +11,36 @@ const ConversationBubble = forwardRef< className?: string; } >(function ConversationBubble({ message, type, className }, ref) { - return ( -
- -
- {type === 'ERROR' && ( - alert - )} -

{message}

+ let bubble; + if (type === 'QUESTION') { + bubble = ( +
+ +
+

{message}

+
-
- ); + ); + } else { + bubble = ( +
+ +
+ {type === 'ERROR' && ( + alert + )} +

{message}

+
+
+ ); + } + return bubble; }); export default ConversationBubble; - -// TODO : split question and answer into two diff JSX