diff --git a/components/email/recipient-popover.tsx b/components/email/recipient-popover.tsx index 32b39b39..bb0915d5 100644 --- a/components/email/recipient-popover.tsx +++ b/components/email/recipient-popover.tsx @@ -2,11 +2,14 @@ import { useState, useRef, useEffect } from "react"; import { createPortal } from "react-dom"; +import { useRouter } from "next/navigation"; import { Mail, Phone, Building, ExternalLink, Copy, Send, UserPlus } from "lucide-react"; import { Avatar } from "@/components/ui/avatar"; import { cn } from "@/lib/utils"; import { useContactStore, getContactDisplayName } from "@/stores/contact-store"; import { toast } from "@/stores/toast-store"; +import { savePendingMailto, notifyPendingMailto } from "@/lib/protocol-handlers/session"; +import { formatRecipient } from "@/lib/email-composer-utils"; import type { ContactCard } from "@/lib/jmap/types"; interface RecipientPopoverProps { @@ -125,6 +128,21 @@ export function RecipientPopover({ name, email, displayLabel, onViewContact, cla } }; + const router = useRouter(); + + const handleCompose = () => { + savePendingMailto({ + to: [formatRecipient(contactName, email)], + cc: [], + bcc: [], + subject: "", + body: "", + }); + notifyPendingMailto(); + router.push("/"); + handleClose(); + }; + return ( <> - Email - + {onViewContact && (