SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Refactor UserMessage Component for Improved Structure and Documentation
Salman-Ahamed2546de0f2de7
diff --git a/packages/app/src/react/features/ai-chat/components/user-message.tsx b/packages/app/src/react/features/ai-chat/components/user-message.tsxindex e00ae9f7..26ce0c64 100644--- a/packages/app/src/react/features/ai-chat/components/user-message.tsx+++ b/packages/app/src/react/features/ai-chat/components/user-message.tsx@@ -1,22 +1,32 @@import { FileItemPreview } from '@react/features/ai-chat/components';-import { FileWithMetadata } from '@react/shared/types/chat.types';import { FC } from 'react';+import { FileWithMetadata } from '../types/chat.types';+/**+ * User Message Component Properties+ */interface IUserMessage {message: string;files?: FileWithMetadata[];- hideMessage?: boolean;}-export const UserMessage: FC<IUserMessage> = ({ message, files, hideMessage = false }) => {+/**+ * User Message Component+ * Displays user's message with optional file attachments+ * Message bubble automatically hidden if message is empty+ */+export const UserMessage: FC<IUserMessage> = ({ message, files }) => {+ const hasFiles = files && files.length > 0;+return (<div className="break-all flex flex-col items-end">- {files && files.length > 0 && (+ {/* File Attachments */}+ {hasFiles && (<div className="flex flex-nowrap gap-2 mb-2 overflow-x-auto">{files.map((fileWithKey, index) => (<FileItemPreviewisReadOnly- key={index}+ key={fileWithKey.id || index}file={fileWithKey}fileKey={fileWithKey.metadata.key}inChatBubble={true}@@ -24,7 +34,9 @@ export const UserMessage: FC<IUserMessage> = ({ message, files, hideMessage = fa))}</div>)}- {!hideMessage && message && (++ {/* Message Bubble - automatically hidden if empty */}+ {message && (<div className="rounded-[18px] bg-[#f4f4f4] text-[#2b2b2b] p-3 px-4 w-fit whitespace-pre-wrap text-wrap max-w-[535px]">{message}</div>