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 (