mirror of
https://github.com/documenso/documenso.git
synced 2025-11-18 18:51:37 +10:00
feat: recipient expired on dashboard
This commit is contained in:
@ -43,6 +43,10 @@ export const StackAvatar = ({ first, zIndex, fallbackText = '', type }: StackAva
|
|||||||
case RecipientStatusType.REJECTED:
|
case RecipientStatusType.REJECTED:
|
||||||
classes = 'bg-red-200 text-red-800';
|
classes = 'bg-red-200 text-red-800';
|
||||||
break;
|
break;
|
||||||
|
case RecipientStatusType.EXPIRED:
|
||||||
|
classes = 'bg-gray-200 text-gray-700';
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,10 @@ export const StackAvatarsWithTooltip = ({
|
|||||||
(recipient) => getRecipientType(recipient) === RecipientStatusType.REJECTED,
|
(recipient) => getRecipientType(recipient) === RecipientStatusType.REJECTED,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const expiredRecipients = recipients.filter(
|
||||||
|
(recipient) => getRecipientType(recipient) === RecipientStatusType.EXPIRED,
|
||||||
|
);
|
||||||
|
|
||||||
const sortedRecipients = useMemo(() => {
|
const sortedRecipients = useMemo(() => {
|
||||||
const otherRecipients = recipients.filter(
|
const otherRecipients = recipients.filter(
|
||||||
(recipient) => getRecipientType(recipient) !== RecipientStatusType.REJECTED,
|
(recipient) => getRecipientType(recipient) !== RecipientStatusType.REJECTED,
|
||||||
@ -119,6 +123,30 @@ export const StackAvatarsWithTooltip = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{expiredRecipients.length > 0 && (
|
||||||
|
<div>
|
||||||
|
<h1 className="text-base font-medium">
|
||||||
|
<Trans>Expired</Trans>
|
||||||
|
</h1>
|
||||||
|
{expiredRecipients.map((recipient: Recipient) => (
|
||||||
|
<div key={recipient.id} className="my-1 flex items-center gap-2">
|
||||||
|
<StackAvatar
|
||||||
|
first={true}
|
||||||
|
key={recipient.id}
|
||||||
|
type={getRecipientType(recipient)}
|
||||||
|
fallbackText={recipientAbbreviation(recipient)}
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<p className="text-muted-foreground text-sm">{recipient.email}</p>
|
||||||
|
<p className="text-muted-foreground/70 text-xs">
|
||||||
|
{_(RECIPIENT_ROLES_DESCRIPTION[recipient.role].roleName)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{waitingRecipients.length > 0 && (
|
{waitingRecipients.length > 0 && (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-base font-medium">
|
<h1 className="text-base font-medium">
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export enum RecipientStatusType {
|
|||||||
WAITING = 'waiting',
|
WAITING = 'waiting',
|
||||||
UNSIGNED = 'unsigned',
|
UNSIGNED = 'unsigned',
|
||||||
REJECTED = 'rejected',
|
REJECTED = 'rejected',
|
||||||
|
EXPIRED = 'expired',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getRecipientType = (recipient: Recipient) => {
|
export const getRecipientType = (recipient: Recipient) => {
|
||||||
@ -36,6 +37,10 @@ export const getRecipientType = (recipient: Recipient) => {
|
|||||||
return RecipientStatusType.WAITING;
|
return RecipientStatusType.WAITING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recipient.signingStatus === SigningStatus.EXPIRED) {
|
||||||
|
return RecipientStatusType.EXPIRED;
|
||||||
|
}
|
||||||
|
|
||||||
return RecipientStatusType.UNSIGNED;
|
return RecipientStatusType.UNSIGNED;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,5 +59,9 @@ export const getExtraRecipientsType = (extraRecipients: Recipient[]) => {
|
|||||||
return RecipientStatusType.WAITING;
|
return RecipientStatusType.WAITING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (types.includes(RecipientStatusType.EXPIRED)) {
|
||||||
|
return RecipientStatusType.EXPIRED;
|
||||||
|
}
|
||||||
|
|
||||||
return RecipientStatusType.COMPLETED;
|
return RecipientStatusType.COMPLETED;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,8 +8,8 @@ import {
|
|||||||
RecipientRole,
|
RecipientRole,
|
||||||
SendStatus,
|
SendStatus,
|
||||||
SigningStatus,
|
SigningStatus,
|
||||||
|
WebhookTriggerEvents,
|
||||||
} from '@documenso/prisma/client';
|
} from '@documenso/prisma/client';
|
||||||
import { WebhookTriggerEvents } from '@documenso/prisma/client';
|
|
||||||
|
|
||||||
import { jobs } from '../../jobs/client';
|
import { jobs } from '../../jobs/client';
|
||||||
import type { TRecipientActionAuth } from '../../types/document-auth';
|
import type { TRecipientActionAuth } from '../../types/document-auth';
|
||||||
|
|||||||
Reference in New Issue
Block a user