"use client" import { Info, HardDrive, File, FileText, Image as ImageIcon, } from "lucide-react" import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip" import { cn } from "@/lib/utils" import type { EmailAttachment, EmailAttachmentKind } from "@/lib/email-data" import { attachmentPreviewTooltip, resolveAttachmentKind, shouldUseAttachmentPillsInPreview, } from "@/lib/attachment-display" import { MAIL_TOOLTIP_CONTENT_CLASS } from "@/lib/mail-chrome-classes" function MessageAttachmentCard({ name, kind }: { name: string; kind: EmailAttachmentKind }) { return ( <>
{kind === "image" ? ( ) : kind === "pdf" ? (
PDF
) : ( )}
{kind === "pdf" ? ( ) : kind === "image" ? ( ) : ( )} {name}
) } function MessageAttachmentPill({ name, kind, sizeBytes, }: { name: string kind: EmailAttachmentKind sizeBytes?: number }) { const tip = attachmentPreviewTooltip(name, sizeBytes) return ( {tip} ) } export function MessageAttachmentsSection({ attachments }: { attachments: EmailAttachment[] }) { const n = attachments.length if (n === 0) return null const summary = n === 1 ? "Une pièce jointe" : `${n} pièces jointes` const asPills = shouldUseAttachmentPillsInPreview(attachments) return (
{summary} · Analysé par VirusTotal VirusTotal analyse les pièces jointes et les compare à une base de signatures pour repérer les virus et logiciels malveillants.
{attachments.map((att, index) => { const kind = resolveAttachmentKind(att.name, att.kind) const tip = attachmentPreviewTooltip(att.name, att.sizeBytes) if (asPills) { return (
) } return (
{tip}
) })}
) }