"use client"; import { motion } from "framer-motion"; import { ExternalLink, Calendar, ArrowLeft, Github as GithubIcon, Share2 } from "lucide-react"; import Link from "next/link"; import { useEffect } from "react"; import ReactMarkdown from "react-markdown"; export type ProjectDetailData = { id: number; slug: string; title: string; description: string; content: string; tags: string[]; featured: boolean; category: string; date: string; github?: string | null; live?: string | null; imageUrl?: string | null; }; export default function ProjectDetailClient({ project, locale, }: { project: ProjectDetailData; locale: string; }) { // Track page view (non-blocking) useEffect(() => { try { navigator.sendBeacon?.( "/api/analytics/track", new Blob( [ JSON.stringify({ type: "pageview", projectId: project.id.toString(), page: `/${locale}/projects/${project.slug}`, }), ], { type: "application/json" }, ), ); } catch { // ignore } }, [project.id, project.slug, locale]); return (
{/* Navigation */} Back to Projects {/* Header & Meta */}

{project.title}

{project.featured && ( Featured )} {project.category}

{project.description}

{new Date(project.date).toLocaleDateString(undefined, { year: "numeric", month: "long", day: "numeric", })}
{project.tags.map((tag) => ( #{tag} ))}
{/* Featured Image / Fallback */} {project.imageUrl ? ( // eslint-disable-next-line @next/next/no-img-element {project.title} ) : (
{project.title.charAt(0)}
)}
{/* Content & Sidebar Layout */}
{/* Main Content */}
(

{children}

), h2: ({ children }) => (

{children}

), p: ({ children }) =>

{children}

, li: ({ children }) =>
  • {children}
  • , code: ({ children }) => ( {children} ), pre: ({ children }) => (
                          {children}
                        
    ), }} > {project.content}
    {/* Sidebar / Actions */}

    Project Links

    {project.live && project.live.trim() && project.live !== "#" ? ( Live Demo ) : (
    Live demo not available
    )} {project.github && project.github.trim() && project.github !== "#" ? ( View Source ) : null}

    Tech Stack

    {project.tags.map((tag) => ( {tag} ))}
    ); }