"use client"; import ReactMarkdown from "react-markdown"; import { useTranslations } from "next-intl"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/navigation"; import ProjectThumbnail from "@/app/components/ProjectThumbnail"; import { BackArrow, SubpageIntro, btn, card, frame, ghost, monoLabel } from "./subpage"; export type ProjectDetailData = { id: number; slug: string; title: string; description: string; content: string; tags: string[]; featured: boolean; category: string; date?: string; created_at?: string; github?: string | null; github_url?: string | null; live?: string | null; button_live_label?: string | null; button_github_label?: string | null; imageUrl?: string | null; image_url?: string | null; technologies?: string[]; }; export default function ProjectDetailClient({ project, locale, }: { project: ProjectDetailData; locale: string; }) { const tCommon = useTranslations("common"); const tDetail = useTranslations("projects.detail"); const router = useRouter(); const listHref = `/${locale}/projects`; const handleBack = (e: React.MouseEvent) => { // Kommt man von der eigenen Seite, geht es per Browser-Zurück an die exakte Stelle // (Startseite oder Liste). Bei Deep Links, ohne JS oder mit Modifier-Taste gilt der Link selbst. if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return; const fromHere = document.referrer && new URL(document.referrer).origin === window.location.origin; if (fromHere && window.history.length > 1) { e.preventDefault(); router.back(); } }; const liveUrl = project.live && project.live !== "#" ? project.live : null; const githubUrl = project.github && project.github !== "#" ? project.github : null; const rawDate = project.date || project.created_at; const year = rawDate && !Number.isNaN(new Date(rawDate).getFullYear()) ? String(new Date(rawDate).getFullYear()) : null; const stack = project.technologies?.length ? project.technologies : project.tags; return (
{tCommon("back")} } kicker={[project.category, year].filter(Boolean).join(" · ")} title={project.title} >

{project.description}

{project.imageUrl ? ( {project.title} ) : ( )}
{project.content ? (
{project.content}
) : (

{project.description}

)}
); }