diff --git a/apps/app/src/components/comments/CommentItem.tsx b/apps/app/src/components/comments/CommentItem.tsx index 25f4d2b5d..9d0cb60d0 100644 --- a/apps/app/src/components/comments/CommentItem.tsx +++ b/apps/app/src/components/comments/CommentItem.tsx @@ -39,6 +39,27 @@ type PendingAttachment = { signedUrl: string; }; +function renderContentWithLinks(text: string): React.ReactNode[] { + const regex = /(https?:\/\/[^\s]+|www\.[^\s]+|(? { + if (/^(https?:\/\/[^\s]+|www\.[^\s]+|(? + {part} + + ); + } + return part; + }); +} + export function CommentItem({ comment }: { comment: CommentWithAuthor }) { const [isEditing, setIsEditing] = useState(false); const [editedContent, setEditedContent] = useState(comment.content); @@ -279,7 +300,9 @@ export function CommentItem({ comment }: { comment: CommentWithAuthor }) { {!isEditing ? ( -

{comment.content}

+

+ {renderContentWithLinks(comment.content)} +

) : (