"use client"; import { ExternalLink, ArrowLeft, Github as GithubIcon } from "lucide-react"; import { useEffect, useState } from "react"; import ReactMarkdown from "react-markdown"; import { useTranslations } from "next-intl"; import Image from "next/image"; import { useRouter } from "next/navigation"; 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 [canGoBack, setCanGoBack] = useState(false); useEffect(() => { // Prüfen, ob wir eine History haben (von Home gekommen) if (typeof window !== 'undefined' && window.history.length > 1) { setCanGoBack(true); } }, []); const handleBack = (e: React.MouseEvent) => { e.preventDefault(); // Wenn wir direkt auf die Seite gekommen sind (Deep Link), gehen wir zur Projektliste // Ansonsten nutzen wir den Browser-Back, um an die exakte Stelle der Home oder Liste zurückzukehren if (canGoBack) { router.back(); } else { router.push(`/${locale}/projects`); } }; return (
{project.description}