"use client" import { useMemo, useState } from "react" import { format } from "date-fns" import { InvitationTimeChipText } from "@/components/gmail/invitation-time-chip-text" import { AgendaMark } from "@/components/suite/agenda-mark" import { Icon } from "@iconify/react" import { ThumbsDown, ThumbsUp, Users, MoreVertical } from "lucide-react" import { VIDEO_CONFERENCE_LOGOS, formatInvitationAttendeeLine, type ParsedCalendarInvitation, } from "@/lib/calendar-invitation" import { ensureVcLogosCollection } from "@/lib/register-vc-logos" import { cn } from "@/lib/utils" import { MAIL_INVITATION_CARD_CLASS } from "@/lib/mail-chrome-classes" function attendeeDisplayList(inv: ParsedCalendarInvitation): { organizerLine?: string othersLine?: string } { const orgEmail = inv.organizer?.email const organizerLine = orgEmail || inv.organizer?.name ? `${orgEmail ?? inv.organizer?.name} – Organisateur` : undefined const others = inv.attendees.filter((a) => { const e = a.email?.toLowerCase() return e && e !== orgEmail?.toLowerCase() }) const line = formatInvitationAttendeeLine( others.length > 0 ? others : inv.attendees, 4 ) return { organizerLine, othersLine: line || undefined, } } const RSVP_BTN = "rounded-full bg-[#1a73e8] px-4 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-[#1557b0]" const RSVP_SECONDARY = "rounded-full border border-border bg-mail-surface px-4 py-2 text-sm font-medium text-primary transition-colors hover:bg-accent" export function CalendarInvitationPreview({ invitation, className, calendarAppName = "Agenda", }: { invitation: ParsedCalendarInvitation className?: string /** Nom de l'app calendrier affiché dans le bouton « Ouvrir dans … ». */ calendarAppName?: string }) { ensureVcLogosCollection() const { organizerLine, othersLine } = useMemo( () => attendeeDisplayList(invitation), [invitation] ) const confIcon = VIDEO_CONFERENCE_LOGOS[invitation.conferenceProvider] const [rsvp, setRsvp] = useState(null) return (

{invitation.summary}

{organizerLine && (

{organizerLine}

)} {othersLine && (

{othersLine}

)}

Dans votre agenda

Aucun autre événement à cette date

{(["Oui", "Non", "Peut-être"] as const).map((label) => ( ))} Ouvrir dans {calendarAppName}
D’après cet e-mail
Correct ?
) }