import React, { useRef, useMemo } from 'react'; import LinkPreview from './LinkPreview'; import { extractUrls } from '../utils/urlUtils'; import MarkdownContent from './MarkdownContent'; import { Message, getTextContent } from '../types/message'; import MessageCopyLink from './MessageCopyLink'; import { formatMessageTimestamp } from '../utils/timeUtils'; interface UserMessageProps { message: Message; } export default function UserMessage({ message }: UserMessageProps) { const contentRef = useRef(null); // Extract text content from the message const textContent = getTextContent(message); // Memoize the timestamp const timestamp = useMemo(() => formatMessageTimestamp(message.created), [message.created]); // Extract URLs which explicitly contain the http:// or https:// protocol const urls = extractUrls(textContent, []); return (
{timestamp}
{/* TODO(alexhancock): Re-enable link previews once styled well again */} {false && urls.length > 0 && (
{urls.map((url, index) => ( ))}
)}
); }