'use client' import { useTheme } from '@/lib/ThemeContext' import { calendarApi } from '@/lib/schulkalender/api' import type { PublicEvent, SchoolEvent } from '@/app/schulkalender/types' import { EVENT_TYPE_COLOR, EVENT_TYPE_LABEL } from '@/app/schulkalender/types' import { NotificationStatus } from './NotificationStatus' interface DayDetailProps { iso: string holidays: PublicEvent[] events: SchoolEvent[] onClose: () => void onDeleted: () => void } export function DayDetail({ iso, holidays, events, onClose, onDeleted }: DayDetailProps) { const { isDark } = useTheme() const handleDelete = async (id: string) => { if (!confirm('Termin wirklich loeschen?')) return try { await calendarApi.deleteEvent(id) onDeleted() } catch { // best-effort } } const cardClass = isDark ? 'bg-slate-900/95 border-white/20 text-white' : 'bg-white border-black/10 text-slate-900' const dayHolidays = holidays.filter(h => iso >= h.start_date && iso <= h.end_date) const dayEvents = events.filter(e => iso >= e.start_date && iso <= e.end_date) const formattedDate = new Date(iso).toLocaleDateString('de-DE', { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric', }) return (
Keine Eintraege fuer diesen Tag.
)} {dayHolidays.length > 0 && (