1 import { c } from 'ttag';
3 import { CircleLoader } from '@proton/atoms';
4 import Table from '@proton/components/components/table/Table';
5 import TableBody from '@proton/components/components/table/TableBody';
6 import TableHeader from '@proton/components/components/table/TableHeader';
7 import TableRow from '@proton/components/components/table/TableRow';
10 CachedOrganizationKey,
14 } from '@proton/shared/lib/interfaces';
16 import AddressActions from './AddressActions';
17 import AddressStatus from './AddressStatus';
18 import { getPermissions, getStatus } from './helper';
20 interface AddressesTableProps {
25 memberAddressesMap?: { [key: string]: (Address | PartialMemberAddress)[] | undefined };
26 organizationKey?: CachedOrganizationKey;
27 allowAddressDeletion: boolean;
30 const AddressesTable = ({
38 }: AddressesTableProps) => {
40 <Table responsive="cards" hasActions>
43 c('Header for addresses table').t`Address`,
44 hasUsername ? c('Header for addresses table').t`Username` : null,
45 c('Header for addresses table').t`Status`,
46 c('Header for addresses table').t`Actions`,
49 <TableBody colSpan={hasUsername ? 4 : 3} loading={loading}>
50 {members.flatMap((member) => {
51 const memberAddresses = memberAddressesMap?.[member.ID] || [];
52 return memberAddresses.map((address, i) => {
54 <div className="text-ellipsis" title={address.Email}>
58 const nameCell = hasUsername && member.Name;
60 // Partial address getting loaded
61 if (!('Keys' in address)) {
68 <div className="visibility-hidden">
69 <AddressStatus isActive />
83 <AddressStatus {...getStatus(address, i)} />,
88 permissions={getPermissions({
92 addresses: memberAddresses,
96 allowAddressDeletion={allowAddressDeletion}
108 export default AddressesTable;