import Image from "next/image"; import Link from "next/link"; import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { ArrowLeft, Building2, Calendar, Clock, ExternalLink, Tag } from "lucide-react"; import { marked } from "marked"; import { getProjectBySlug, listProjects } from "@/lib/data"; import { buildMetadata } from "@/lib/seo"; import { Gallery } from "@/components/gallery"; export async function generateMetadata({ params, }: { params: Promise<{ slug: string }>; }): Promise { const { slug } = await params; const project = await getProjectBySlug(slug); if (!project) return { title: "Proje bulunamadı" }; return buildMetadata(`/projeler/${slug}`, { title: project.title, description: project.description.slice(0, 160), openGraph: { title: project.title, description: project.description.slice(0, 160), images: project.image_url ? [{ url: project.image_url }] : undefined, type: "article", }, }); } export default async function ProjectDetailPage({ params, }: { params: Promise<{ slug: string }>; }) { const { slug } = await params; const project = await getProjectBySlug(slug); if (!project) notFound(); const html = project.content ? (marked.parse(project.content, { async: false }) as string) : ""; const meta: { icon: React.ReactNode; label: string; value: string }[] = []; if (project.client_name) meta.push({ icon: , label: "Müşteri", value: project.client_name }); if (project.industry) meta.push({ icon: , label: "Sektör", value: project.industry }); if (project.duration) meta.push({ icon: , label: "Süre", value: project.duration }); if (project.year) meta.push({ icon: , label: "Yıl", value: String(project.year) }); const relatedProjects = ( await listProjects({ limit: 4 }) ).filter((p) => p.$id !== project.$id).slice(0, 3); return ( <>
Tüm projeler
{project.category && ( {project.category} )}

{project.title}

{project.description}

{project.live_url && ( Projeyi canlı görüntüle )} {project.technologies && project.technologies.length > 0 && (

Teknolojiler

{project.technologies.map((t) => ( {t} ))}
)}
{meta.length > 0 && (
{meta.map((m) => (
{m.icon} {m.label}
{m.value}
))}
)}
{project.image_url && (
{project.title}
)}
{html && (
)} {project.gallery && project.gallery.length > 0 && (

Galeri

Görsellerin üzerine tıklayarak büyütebilirsiniz.

)}
{relatedProjects.length > 0 && (

Diğer projeler

{relatedProjects.map((p) => (
{p.image_url ? ( {p.title} ) : (
{p.title.charAt(0)}
)}

{p.title}

{p.category}

))}
)} ); }