fix: toggle recipient popover when clicking name again
This commit is contained in:
@@ -39,7 +39,11 @@ export function RecipientPopover({ name, email, displayLabel, onViewContact, cla
|
|||||||
const phones = contact?.phones ? Object.values(contact.phones) : [];
|
const phones = contact?.phones ? Object.values(contact.phones) : [];
|
||||||
const orgs = contact?.organizations ? Object.values(contact.organizations) : [];
|
const orgs = contact?.organizations ? Object.values(contact.organizations) : [];
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleToggle = () => {
|
||||||
|
if (isOpen) {
|
||||||
|
handleClose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!triggerRef.current) return;
|
if (!triggerRef.current) return;
|
||||||
const rect = triggerRef.current.getBoundingClientRect();
|
const rect = triggerRef.current.getBoundingClientRect();
|
||||||
const popoverWidth = 300;
|
const popoverWidth = 300;
|
||||||
@@ -125,7 +129,7 @@ export function RecipientPopover({ name, email, displayLabel, onViewContact, cla
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
ref={triggerRef}
|
ref={triggerRef}
|
||||||
onClick={handleOpen}
|
onClick={handleToggle}
|
||||||
className={cn(
|
className={cn(
|
||||||
"text-foreground hover:text-primary hover:underline cursor-pointer transition-colors min-w-0 break-words",
|
"text-foreground hover:text-primary hover:underline cursor-pointer transition-colors min-w-0 break-words",
|
||||||
className
|
className
|
||||||
|
|||||||
Reference in New Issue
Block a user