"use client"; import { LoaderCircleIcon, MapPinIcon, RepeatIcon, SendIcon } from "lucide-react"; import { CalendarBadge } from "@/components/admin/CalendarBadge"; import { Button } from "@/components/ui/button"; import { dateBlock, describeWhen, isPast, occurrence, repeatLabel } from "@/lib/event-display"; import type { CalendarEvent } from "@/lib/types"; import { cn } from "@/lib/utils"; /** * One event in the list. The whole row opens the event (a stretched button on * the title, so the row's other button - "Veröffentlichen" - stays a separate, * valid control rather than a button inside a button). */ export function EventListItem({ event, now, publishing, onOpen, onPublish, }: { event: CalendarEvent; now: Date; publishing: boolean; onOpen?: (event: CalendarEvent) => void; onPublish: (event: CalendarEvent) => void; }) { const { start } = occurrence(event, now); const block = dateBlock(start); const repeat = repeatLabel(event.repeatFrequency); const title = event.name || "(ohne Titel)"; return (
  • {block.weekday} {block.day} {block.month}
    {onOpen ? ( ) : ( {title} )}
    {describeWhen(event, now)} {event.location && ( {event.location} )}
    {event.status === "DRAFT" && ( Entwurf )} {event.status === "PRIVATE" && ( Privat )} {repeat && ( {repeat} )} {event.status === "DRAFT" && ( )}
  • ); }