"use client";
import { CalendarX2Icon, SearchXIcon } from "lucide-react";
import { Fragment } from "react";
import { EventListItem } from "@/components/admin/EventListItem";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { formatDay } from "@/lib/dates";
import { groupByMonth, type Range, type Sort } from "@/lib/filter";
import type { CalendarEvent } from "@/lib/types";
/**
* The list itself: grouped by month when sorted by start (what people scan
* for), flat when sorted by creation date (where month headings would repeat
* and mislead).
*/
export function EventList({
events,
now,
sort,
range,
query,
loading,
noCalendars,
publishingId,
todayMarker,
onOpen,
onPublish,
onClearQuery,
}: {
events: CalendarEvent[];
now: Date;
sort: Sort;
range: Range;
query: string;
loading: boolean;
noCalendars: boolean;
publishingId: number | null;
/** Index into `events` to show the "Heute" marker in front of (`events.length` = after the last); null for none. */
todayMarker: number | null;
onOpen?: (event: CalendarEvent) => void;
onPublish: (event: CalendarEvent) => void;
onClearQuery: () => void;
}) {
if (noCalendars) {
return
{title}
{text}
{action &&