ultisuite-client/components/agenda/agenda-event-chip.tsx
R3D347HR4Y ad1370ea7e
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat: enhance configuration and add new demo layouts
- Introduced turbopack alias for canvas in next.config.mjs.
- Updated package.json scripts for development and branding tasks.
- Added new dependencies for Tiptap extensions.
- Implemented new demo layouts for agenda, contacts, drive, and mail applications.
- Enhanced globals.css for improved theming and splash screen animations.
- Added OAuth callback handling for drive mounts.
- Updated layout components to integrate new demo shells and improve structure.
2026-06-12 19:10:24 +02:00

72 lines
2.1 KiB
TypeScript

"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<HTMLButtonElement>) => 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 (
<button
type="button"
onClick={onClick}
disabled={pending}
className={cn(
"flex w-full min-w-0 items-center gap-1.5 truncate rounded-md px-1.5 py-[1px] text-left text-xs leading-[1.4] transition-[filter] hover:brightness-95 dark:hover:brightness-110",
!solid && !pending && "hover:bg-mail-nav-hover",
pending && "pointer-events-none ring-2 ring-dashed ring-primary/60",
declined && "opacity-50 line-through",
className,
)}
style={style}
title={event.title}
>
{!solid && (
<span
aria-hidden
className="size-2 shrink-0 rounded-full"
style={{ backgroundColor: event.color }}
/>
)}
{!solid && !event.allDay && (
<span className="shrink-0 text-muted-foreground">
{formatEventTime(event.start)}
</span>
)}
<span className="truncate font-medium">{event.title}</span>
</button>
)
}
function isDeclinedForAll(event: AgendaEvent): boolean {
return (
event.attendees.length > 0 &&
event.attendees.every((a) => a.status === "DECLINED")
)
}