"use client" import { ArrowLeft, Download, Pencil, Star, Trash2, Mail, Phone, Building2, MapPin, Cake, FileText, MessageSquare, Video, } from "lucide-react" import { Button } from "@/components/ui/button" import { useContactsStore } from "@/lib/contacts/contacts-store" import { useContactsList } from "@/lib/contacts/use-contacts-list" import { useDeleteContact } from "@/lib/api/hooks/use-contact-mutations" import { fullContactDisplayName } from "@/lib/contacts/types" import { avatarColor, senderInitial } from "@/lib/sender-display" import { useNavStore } from "@/lib/stores/nav-store" import { downloadContactVCard } from "@/lib/contacts/export-contacts" import { CONTACTS_HEADING_TEXT, CONTACTS_MUTED_TEXT, CONTACTS_PAGE_ICON_BTN_CLASS, CONTACTS_PAGE_TAG_CLASS, CONTACTS_PANEL_DIVIDER_CLASS, CONTACTS_PANEL_MUTED_ICON_CLASS, CONTACTS_PANEL_PRIMARY_ACTION_CLASS, CONTACTS_PANEL_SECONDARY_ICON_BTN_CLASS, } from "@/lib/contacts-chrome-classes" import { cn } from "@/lib/utils" const FRENCH_MONTHS = [ "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre", ] function formatBirthday(b: { day?: number; month?: number; year?: number }): string { const parts: string[] = [] if (b.day) parts.push(String(b.day)) if (b.month) parts.push(FRENCH_MONTHS[b.month - 1] ?? "") if (b.year) parts.push(String(b.year)) return parts.join(" ") } interface ContactDetailPageProps { contactId: string onBack: () => void onEdit: (id: string) => void } export function ContactDetailPage({ contactId, onBack, onEdit }: ContactDetailPageProps) { const { contacts } = useContactsList() const softDeleteContact = useContactsStore((s) => s.softDeleteContact) const deleteContactMutation = useDeleteContact() const labelRows = useNavStore((s) => s.labelRows) const contact = contacts.find((c) => c.id === contactId) if (!contact) { return (
{contact.jobTitle ? `${contact.jobTitle} — ` : ""} {contact.company}
)} {contact.labels && contact.labels.length > 0 && ({e.value}
{e.label}
{p.value}
{p.label}
{contact.company}
{contact.department && ({contact.department}
)} {contact.jobTitle && ({contact.jobTitle}
)}{[addr.street, [addr.postalCode, addr.city].filter(Boolean).join(" "), addr.region, addr.country] .filter(Boolean) .join(", ")}
{addr.label}
{formatBirthday(contact.birthday)}
)} {contact.notes && ({contact.notes}
)}