"use client" import type { CSSProperties, MouseEvent } from "react" import { formatEventTime } from "@/lib/agenda/agenda-date" import { readableTextColor } from "@/lib/agenda/agenda-colors" import type { AgendaEvent } from "@/lib/agenda/agenda-types" import { cn } from "@/lib/utils" /** Chip compact (vue mois / rangée journée entière). */ export function AgendaEventChip({ event, filled, pending, onClick, className, }: { event: AgendaEvent /** Fond plein (journée entière / multi-jours) vs point coloré + heure. */ filled?: boolean /** Brouillon en cours d'édition — style fantôme. */ pending?: boolean onClick?: (e: MouseEvent) => void className?: string }) { const solid = filled ?? event.allDay const style: CSSProperties = solid ? { backgroundColor: pending ? `${event.color}99` : event.color, color: readableTextColor(event.color), } : {} const declined = isDeclinedForAll(event) return ( ) } function isDeclinedForAll(event: AgendaEvent): boolean { return ( event.attendees.length > 0 && event.attendees.every((a) => a.status === "DECLINED") ) }