1 import type { FC, ReactNode } from 'react';
3 import Avatar from '@proton/atoms/Avatar/Avatar';
4 import { Icon } from '@proton/components';
5 import { UpgradeButton } from '@proton/pass/components/Layout/Button/UpgradeButton';
6 import { UpsellRef } from '@proton/pass/constants';
7 import { isPaidPlan } from '@proton/pass/lib/user/user.predicates';
8 import { UserPassPlan } from '@proton/pass/types/api/plan';
9 import clsx from '@proton/utils/clsx';
15 organization?: string;
20 export const UserPanel: FC<Props> = ({ actions, email, name, organization, plan, planName }) => {
21 const emailOnly = planName !== undefined;
22 const avatar = (name || email)?.toUpperCase()?.[0];
25 <div className={clsx('flex flex-nowrap gap-2 items-center text-sm', plan && isPaidPlan(plan) && 'ui-orange')}>
26 <Avatar className="shrink-0">{avatar}</Avatar>
27 <div className="text-left flex-1">
28 <span className="color-norm block text-ellipsis">{emailOnly ? email : name}</span>
29 {!emailOnly && <span className="color-weak block text-ellipsis">{email}</span>}
33 className="flex flex-nowrap gap-1 items-center text-sm text-ellipsis"
34 style={{ color: 'var(--interaction-norm)' }}
36 <Icon name="star" className="shrink-0" size={3} color="var(--interaction-norm)" />
37 <span className="text-ellipsis">
39 {organization && ` · ${organization}`}
41 {plan === UserPassPlan.FREE && (
45 upsellRef={UpsellRef.MENU}
48 style={{ pointerEvents: 'auto' }}
56 {actions && <div className="shrink-0">{actions}</div>}