1 import { c } from 'ttag';
3 import { Button } from '@proton/atoms';
4 import { Icon, Tooltip, usePopperAnchor } from '@proton/components';
5 import { normalize } from '@proton/shared/lib/helpers/string';
6 import clsx from '@proton/utils/clsx';
8 import ParticipantDropdown from './ParticipantDropdown';
11 icon: React.ReactNode;
20 isCurrentUser?: boolean;
21 onCreateOrEditContact: () => void;
24 const Participant = ({
35 onCreateOrEditContact,
37 const { anchorRef, isOpen, toggle, close } = usePopperAnchor<HTMLButtonElement>();
38 const hasEmail = !!email;
39 const displayDropdown = hasEmail;
40 const showEmailAddress = !isCurrentUser && hasEmail && normalize(email) !== normalize(name);
45 'participant flex flex-nowrap items-center w-full relative interactive-pseudo interactive--no-background text-left',
48 data-testid="participant-in-popover"
50 <Tooltip title={tooltip}>
51 <div className="participant-display item-icon relative flex shrink-0 items-center justify-center">
52 <div className="item-abbr">{initials}</div>
53 <span className="participant-status">{icon}</span>
56 <div className="ml-4 flex-1" title={title}>
57 <div className="max-w-full participant-text text-ellipsis">{name}</div>
59 <div className="max-w-full text-ellipsis participant-extra-text text-sm m-0">{email}</div>
62 <div className="max-w-full text-ellipsis participant-extra-text color-weak text-sm m-0">
76 title={c('Action').t`More options`}
78 <Icon name="three-dots-vertical" alt={c('Action').t`More options`} />
88 onCreateOrEditContact={onCreateOrEditContact}
95 export default Participant;