1 import type { RefObject } from 'react';
2 import React from 'react';
4 import { c } from 'ttag';
6 import { Dropdown, DropdownMenu, DropdownMenuButton, Icon, useNotifications } from '@proton/components';
7 import { textToClipboard } from '@proton/shared/lib/helpers/browser';
14 anchorRef: RefObject<HTMLButtonElement>;
16 onCreateOrEditContact: () => void;
19 const ParticipantDropdown = ({ email, isContact, anchorRef, isOpen, close, onCreateOrEditContact }: Props) => {
20 const { createNotification } = useNotifications();
22 const handleCopy = () => {
23 textToClipboard(email);
26 text: c('Success').t`Email address copied to clipboard`,
31 <Dropdown isOpen={isOpen} anchorRef={anchorRef} onClose={close} originalPlacement="bottom-start">
34 <DropdownMenuButton className="text-left" onClick={handleCopy}>
35 <Icon name="squares" className="mr-2" />
36 <span className="flex-1 my-auto">{c('Action').t`Copy email address`}</span>
39 <DropdownMenuButton className="text-left" onClick={onCreateOrEditContact}>
40 <Icon name={isContact ? 'user' : 'user-plus'} className="mr-2" />
41 <span className="flex-1 my-auto">
42 {isContact ? c('Action').t`View contact details` : c('Action').t`Create new contact`}
50 export default ParticipantDropdown;