From 17d5f8f473207a516273b92f580b4b77b5df6135 Mon Sep 17 00:00:00 2001 From: Zewed Date: Fri, 26 Jan 2024 23:24:31 -0800 Subject: [PATCH] wip --- .../components/QADisplay/QADisplay.tsx | 1 - .../MessageRow/MessageRow.module.scss | 24 +++++++++ .../components/MessageRow/MessageRow.tsx | 51 +++++++++---------- .../MessageRow/hooks/useMessageRow.ts | 13 ----- 4 files changed, 48 insertions(+), 41 deletions(-) create mode 100644 frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/components/MessageRow/MessageRow.module.scss diff --git a/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/QADisplay.tsx b/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/QADisplay.tsx index c4f2f4ac2f8..2079c87f017 100644 --- a/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/QADisplay.tsx +++ b/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/QADisplay.tsx @@ -23,7 +23,6 @@ export const QADisplay = ({ content }: QADisplayProps): JSX.Element => { speaker={"user"} text={user_message} promptName={prompt_title} - brainName={brain_name} metadata={metadata} // eslint-disable-line @typescript-eslint/no-unsafe-assignment /> ) => { - const { - containerClasses, - containerWrapperClasses, - handleCopy, - isCopied, - isUserSpeaker, - markdownClasses, - } = useMessageRow({ - speaker, - text, - }); + const { handleCopy, isCopied, isUserSpeaker, markdownClasses } = + useMessageRow({ + speaker, + text, + }); const messageContent = text ?? ""; return ( -
-
+
+ {!isUserSpeaker && (
- {/* Left section for the question and prompt */}
- {/* Right section for buttons */}
- {!isUserSpeaker && ( - <> - - - )} + <> + +
- {children ?? ( - - )} -
+ )} + {children ?? ( + + )}
); } diff --git a/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/components/MessageRow/hooks/useMessageRow.ts b/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/components/MessageRow/hooks/useMessageRow.ts index e7dcb907b5c..79dcf41e703 100644 --- a/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/components/MessageRow/hooks/useMessageRow.ts +++ b/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/components/MessageRow/hooks/useMessageRow.ts @@ -23,25 +23,12 @@ export const useMessageRow = ({ speaker, text }: UseMessageRowProps) => { setTimeout(() => setIsCopied(false), 2000); // Reset after 2 seconds }; - const containerClasses = cn( - "py-3 px-5 w-fit", - isUserSpeaker ? "bg-msg-gray bg-opacity-10" : "bg-msg-purple bg-opacity-40", - "dark:bg-gray-800 rounded-3xl flex flex-col overflow-hidden scroll-pb-32" - ); - - const containerWrapperClasses = cn( - "flex flex-col", - isUserSpeaker ? "items-end" : "items-start" - ); - const markdownClasses = cn("prose", "dark:prose-invert"); return { isUserSpeaker, isCopied, handleCopy, - containerClasses, - containerWrapperClasses, markdownClasses, }; };