import Link from "next/link"; import { ACTIVITY_KINDS } from "@/components/activityKinds"; import { accentOf } from "@/lib/status"; import { cn } from "@/lib/utils"; import type { ReviewDay, ReviewEntry } from "@/types"; /** * Darstellung von Verlaufseintraegen – eine Zeile und die Gruppierung nach * Kalendertagen. * * Bewusst ohne "use client" und ohne Hooks: so laesst sich beides sowohl aus * einer Server-Komponente (Wochenrueckblick) als auch aus einer * Client-Komponente (Zeitleiste mit Nachladen) heraus benutzen. Zwei Kopien * derselben Zeile waeren beim naechsten Feinschliff auseinandergelaufen. * * Alle Formate mit fester Zeitzone – dieselbe Ueberlegung wie in lib/utils: * sonst weichen Server-Render und Hydration voneinander ab. */ const WOCHENTAG = new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", weekday: "long", }); const TAG_MONAT = new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", day: "numeric", month: "long", }); const TAG_MONAT_JAHR = new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", day: "numeric", month: "long", year: "numeric", }); const UHRZEIT = new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", hour: "2-digit", minute: "2-digit", }); /** "2026-08-17" → ein Zeitpunkt mittags, damit die Zeitzone nichts verschiebt. */ function alsDatum(tag: string): Date { const [j, m, t] = tag.split("-").map(Number); return new Date(Date.UTC(j, m - 1, t, 12)); } export function ActivityDayGroups({ tage, /** Bei Tagen aus anderen Jahren gehoert die Jahreszahl dazu. */ mitJahr = false, }: { tage: ReviewDay[]; mitJahr?: boolean; }) { const format = mitJahr ? TAG_MONAT_JAHR : TAG_MONAT; return (
{eintrag.summary}