import Link from 'next/link' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' import { Badge, Card, CardContent, CardHeader, CardTitle } from 'ui' import { getThreadRepliesById } from '~/data/contribute' import type { ThreadRow } from '~/types/contribute' import { HelpOnPlatformButton } from './HelpOnPlatformButton' import { ChannelIcon } from './Icons' import { markdownComponents } from './markdownComponents' import { RepliesList } from './RepliesList' import { SimilarSolvedThreads } from './SimilarSolvedThreads' export async function Conversation({ thread }: { thread: ThreadRow }) { const { question, replies } = await getThreadRepliesById(thread.thread_key) if (!question && replies.length === 0) { return null } const validReplies = replies.filter((reply: { content: string | null }) => reply.content) const productAreas = thread.product_areas.filter((a: string) => a !== 'Other') const stackItems = thread.stack.filter((t: string) => t !== 'Other') const hasMetadata = productAreas.length > 0 || stackItems.length > 0 return (
{/* Title, Question, and First Reply Section */} {question && question.content && (
{/* Platform, Date, Author, Title */}
{/* Platform, Date, Author - logo spans both rows; platform/date and author link out */}
{thread.channelDisplayName} · {thread.posted} {thread.user}

{thread.title}

{/* Product areas and stack */} {hasMetadata && (
{productAreas.map((area: string) => ( {area} ))} {productAreas.length > 0 && stackItems.length > 0 && ( · )} {stackItems.map((tech: string) => ( {tech} ))}
)}
{/* Question */}
{question.content}
)} {/* Summary Section */} {thread.summary && ( How to help
{thread.summary}
{/* CTA Button */}
)} {/* Similar Solved Threads */} {thread.similar_solved_threads && thread.similar_solved_threads.length > 0 && ( )} {/* Remaining Replies Section */} {validReplies.length > 0 && ( )}
) }