'use client' import Link from 'next/link' import { MarkdownContent } from './MarkdownContent' interface ProjectDetailProps { project: { id: string name: string nameEn?: string | null slug: string description: string descriptionEn?: string | null content?: string | null contentEn?: string | null source?: string | null createdAt: Date tags: Array<{ id: string name: string nameEn?: string | null slug: string }> links: Array<{ id: string type: string url: string title?: string | null }> } locale: string } // Helper function to format date function formatDate(date: Date | string, locale: string): string { const dateObj = typeof date === 'string' ? new Date(date) : date const options: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'short', day: 'numeric' } return dateObj.toLocaleDateString(locale === 'en' ? 'en-US' : 'zh-CN', options) } export function ProjectDetail({ project, locale }: ProjectDetailProps) { const displayName = locale === 'en' && project.nameEn ? project.nameEn : project.name const displayDescription = locale === 'en' && project.descriptionEn ? project.descriptionEn : project.description const displayContent = locale === 'en' && project.contentEn ? project.contentEn : project.content // Get category from first tag const category = project.tags[0]?.name || 'AI Agent' const categoryEn = project.tags[0]?.nameEn || project.tags[0]?.name || 'AI Agent' const displayCategory = locale === 'en' ? categoryEn : category const handleShare = () => { if (typeof window !== 'undefined') { const url = encodeURIComponent(window.location.href) const text = encodeURIComponent(`Check out ${displayName} on Agent Park`) window.open(`https://twitter.com/intent/tweet?url=${url}&text=${text}`, '_blank') } } const handleCopyLink = () => { if (typeof window !== 'undefined') { navigator.clipboard.writeText(window.location.href) } } return ( <> {/* Header Section */}
{/* Decorative shape */}

{displayName}

{/* Metadata */}
calendar_today Added {formatDate(project.createdAt, locale)}
|
category {displayCategory}
|
code Open Source
{/* Tags */}
{project.tags.map((tag) => ( {tag.name} ))}
{/* Featured Image/Video Placeholder */}
{project.source ? (