mirror of
https://github.com/documenso/documenso.git
synced 2026-07-13 06:25:01 +10:00
138d663c25
Merge origin/main into feat/external-2fa-codes. Resolve formatting conflicts caused by biome rollout; preserve both feature streams: PR's external 2FA token + signing-session 2FA proof additions plus main's RateLimit/RecipientExpired/signingReminders/date-auto-insert. In complete-document-with-token.ts, drop the duplicate early field-fetching block introduced when main moved that logic later with date auto-insert support; keep the EXTERNAL_TWO_FACTOR_AUTH check using derivedRecipientActionAuth.
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { getExtraRecipientsType, getRecipientType } from '@documenso/lib/client-only/recipient-type';
|
|
import type { TRecipientLite } from '@documenso/lib/types/recipient';
|
|
import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter';
|
|
|
|
import { StackAvatar } from './stack-avatar';
|
|
|
|
export function StackAvatars({ recipients }: { recipients: TRecipientLite[] }) {
|
|
const renderStackAvatars = (recipients: TRecipientLite[]) => {
|
|
const zIndex = 50;
|
|
const itemsToRender = recipients.slice(0, 5);
|
|
const remainingItems = recipients.length - itemsToRender.length;
|
|
|
|
return itemsToRender.map((recipient, index: number) => {
|
|
const first = index === 0;
|
|
|
|
if (index === 4 && remainingItems > 0) {
|
|
return (
|
|
<StackAvatar
|
|
key="extra-recipient"
|
|
first={first}
|
|
zIndex={String(zIndex - index * 10)}
|
|
type={getExtraRecipientsType(recipients.slice(4))}
|
|
fallbackText={`+${remainingItems + 1}`}
|
|
/>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<StackAvatar
|
|
key={recipient.id}
|
|
first={first}
|
|
zIndex={String(zIndex - index * 10)}
|
|
type={getRecipientType(recipient)}
|
|
fallbackText={recipientAbbreviation(recipient)}
|
|
/>
|
|
);
|
|
});
|
|
};
|
|
|
|
return <>{renderStackAvatars(recipients)}</>;
|
|
}
|