import { DiscordIcon, GitHubIcon, RedditIcon } from '~/components/Contribute/Icons' import { getUserActivity } from '~/data/contribute' import type { ThreadRow } from '~/types/contribute' import Link from 'next/link' import { notFound } from 'next/navigation' import { Badge, Button } from 'ui' function ThreadCard({ thread }: { thread: ThreadRow }) { return (
{thread.channel === 'discord' && } {thread.channel === 'reddit' && } {thread.channel === 'github' && } {thread.channelDisplayName} • {thread.posted}

{thread.title}

{thread.summary && (

{thread.summary}

)} {thread.product_areas.filter((area) => area !== 'Other').length > 0 && (
{thread.product_areas .filter((area) => area !== 'Other') .slice(0, 3) .map((area) => ( {area} ))} {thread.product_areas.filter((area) => area !== 'Other').length > 3 && ( +{thread.product_areas.filter((area) => area !== 'Other').length - 3} )}
)}
) } interface Reply { id: string author: string | null content: string | null ts: string | null external_activity_url: string | null thread_key: string | null } function ReplyCard({ reply, thread }: { reply: Reply; thread?: ThreadRow }) { const platformName = thread?.channelDisplayName ?? 'platform' return (
{thread && ( Reply to: {thread.title} )}

{reply.content}

{reply.ts && ( {new Date(reply.ts).toLocaleString()} )} {reply.external_activity_url && ( )}
) } export async function UserProfile({ username }: { username: string }) { const { threads, replies, replyThreads, stats } = await getUserActivity(username) if (threads.length === 0 && replies.length === 0) { notFound() } return (
{/* Header */}

{username}

{stats.threadCount} {stats.threadCount === 1 ? 'thread' : 'threads'}
/
{stats.replyCount} {stats.replyCount === 1 ? 'reply' : 'replies'}
{/* Threads Section */} {threads.length > 0 && (

Threads created

{threads.map((thread) => ( ))}
)} {/* Replies Section */} {replies.length > 0 && (

Recent replies

{replies.map((reply) => { const thread = replyThreads.find((t) => t.thread_key === reply.thread_key) return })}
)}
) }