// Permalink-Seite für ein einzelnes Devlog (/devlogs/:id) — teilbar mit // Open-Graph-Vorschau (injiziert der Server ins HTML). import { useEffect, useState } from 'react'; import { Link, useParams } from 'react-router-dom'; import { apiGet } from '../api.js'; import { Markdown } from '../markdown.jsx'; import Lightbox from '../components/Lightbox.jsx'; import { SkeletonCards } from '../components/Skeleton.jsx'; import { splitContent } from './Devlogs.jsx'; const dateFmt = new Intl.DateTimeFormat('de-DE', { weekday: 'long', day: '2-digit', month: 'long', year: 'numeric', }); export default function DevlogDetail() { const { id } = useParams(); const [item, setItem] = useState(null); const [error, setError] = useState(false); const [lightbox, setLightbox] = useState(null); const [copied, setCopied] = useState(false); useEffect(() => { setItem(null); setError(false); apiGet(`/api/devlogs/${id}`).then((d) => setItem(d.item)).catch(() => setError(true)); window.scrollTo(0, 0); }, [id]); async function copyLink() { try { await navigator.clipboard.writeText(window.location.href); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { /* Browser ohne Clipboard-Rechte */ } } const parts = item ? splitContent(item.content) : null; return ( <>
DEVLOG
{error && (

Devlog nicht gefunden — zurück zum Archiv.

)} {!error && !item && } {item && ( <>
← Alle Devlogs
{lightbox !== null && ( setLightbox(null)} /> )} )}
); }