"use client"
import type { RefObject } from "react"
import {
ChevronDown,
Forward,
Maximize2,
Minimize2,
Paperclip,
Pencil,
Reply,
ReplyAll,
SquareArrowOutUpRight,
X,
Image as ImageIcon,
} from "lucide-react"
import type { ComposeState } from "@/lib/compose-context"
import type { Email } from "@/lib/email-data"
import { cn } from "@/lib/utils"
import {
MAIL_COMPOSE_DROP_ZONE_CLASS,
MAIL_COMPOSE_TITLEBAR_CLASS,
MAIL_ICON_BTN,
} from "@/lib/mail-chrome-classes"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { COMPOSE_PORTAL_Z } from "./compose-shared"
import type { ComposeRecipientFieldsProps } from "./compose-recipients"
import { ComposeRecipientFields } from "./compose-recipients"
export function ComposeDropOverlay() {
return (
)
}
export interface ComposeInlineRecipientHeaderProps {
compose: ComposeState
threadSourceEmail: Email | null
recipientSummary: string
recipientsFocused: boolean
showReplyAllInMenu: boolean
ThreadKindIcon: typeof Reply
onOpenInlinePreset: (kind: "reply" | "replyAll" | "forward") => void
onOpenDockFromInline: (opts?: { focusSubject?: boolean }) => void
onActivateRecipients: () => void
updateCompose: (id: string, patch: Partial) => void
recipientFieldsProps: ComposeRecipientFieldsProps
fieldsRef: RefObject
inlineRecipientShellRef: RefObject
}
export function ComposeInlineRecipientHeader({
compose,
threadSourceEmail,
recipientSummary,
recipientsFocused,
showReplyAllInMenu,
ThreadKindIcon,
onOpenInlinePreset,
onOpenDockFromInline,
onActivateRecipients,
updateCompose,
recipientFieldsProps,
fieldsRef,
inlineRecipientShellRef,
}: ComposeInlineRecipientHeaderProps) {
return (
e.preventDefault()}
>
onOpenInlinePreset("reply")}
>
Répondre
{showReplyAllInMenu ? (
onOpenInlinePreset("replyAll")}
>
Répondre à tous
) : null}
onOpenInlinePreset("forward")}
>
Transférer
onOpenDockFromInline({ focusSubject: true })}>
Modifier l'objet
onOpenDockFromInline()}>
Ouvrir une fenêtre de réponse
{!recipientsFocused && (!compose.showCc || !compose.showBcc) ? (
{!compose.showCc ? (
) : null}
{!compose.showBcc ? (
) : null}
) : null}
)
}
export function ComposeXsSheetHeader({
titleText,
onClose,
}: {
titleText: string
onClose: () => void
}) {
return (
{titleText}
)
}
export function ComposeDockTitleBar({
titleText,
maximized,
onMinimize,
onMaximize,
onClose,
}: {
titleText: string
maximized: boolean
onMinimize: () => void
onMaximize: () => void
onClose: () => void
}) {
return (
{titleText}
)
}
export function ComposeAttachmentsList({
attachments,
onRemove,
}: {
attachments: ComposeState["attachments"]
onRemove: (attId: string) => void
}) {
if (attachments.length === 0) return null
return (
{attachments.map((att) => (
{att.type.startsWith("image/") ? (
) : (
)}
{att.name}
{att.size < 1024
? `${att.size} o`
: att.size < 1048576
? `${(att.size / 1024).toFixed(1)} Ko`
: `${(att.size / 1048576).toFixed(1)} Mo`}
))}
)
}