Skip to content

The Open Source DocuSign Alternative.

Merge branch 'main' into feat/visible-fields

David Nguyena97ffa97a487
diff --cc apps/web/src/app/(signing)/sign/[token]/page.tsx
index 95c9b6512,bd46898af..b066193e6
--- a/apps/web/src/app/(signing)/sign/[token]/page.tsx
+++ b/apps/web/src/app/(signing)/sign/[token]/page.tsx
@@@ -46,10 -45,14 +46,15 @@@ export default async function SigningPa
}).catch(() => null),
getFieldsForToken({ token }),
getRecipientByToken({ token }).catch(() => null),
+ getCompletedFieldsForToken({ token }),
]);
- if (!document || !document.documentData || !recipient) {
+ if (
+ !document ||
+ !document.documentData ||
+ !recipient ||
+ document.status === DocumentStatus.DRAFT
+ ) {
return notFound();
}
diff --cc apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx
index b6a13b911,7a269d036..6bc8cf9af
--- a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx
+++ b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx
@@@ -3,8 -3,10 +3,8 @@@
import { getRecipientType } from '@documenso/lib/client-only/recipient-type';
import { RECIPIENT_ROLES_DESCRIPTION } from '@documenso/lib/constants/recipient-roles';
import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter';
- import type { Recipient } from '@documenso/prisma/client';
+ import type { DocumentStatus, Recipient } from '@documenso/prisma/client';
-import { Popover, PopoverContent, PopoverTrigger } from '@documenso/ui/primitives/popover';
+import { PopoverHover } from '@documenso/ui/primitives/popover';
import { AvatarWithRecipient } from './avatar-with-recipient';
import { StackAvatar } from './stack-avatar';
@@@ -37,62 -46,117 +39,74 @@@ export const StackAvatarsWithTooltip =
(recipient) => getRecipientType(recipient) === 'unsigned',
);
- const onMouseEnter = () => {
- if (isMouseOverTimeout.current) {
- clearTimeout(isMouseOverTimeout.current);
- }
-
- if (isControlled.current) {
- return;
- }
-
- isMouseOverTimeout.current = setTimeout(() => {
- setOpen((o) => (!o ? true : o));
- }, 200);
- };
-
- const onMouseLeave = () => {
- if (isMouseOverTimeout.current) {
- clearTimeout(isMouseOverTimeout.current);
- }
-
- if (isControlled.current) {
- return;
- }
-
- setTimeout(() => {
- setOpen((o) => (o ? false : o));
- }, 200);
- };
-
- const onOpenChange = (newOpen: boolean) => {
- isControlled.current = newOpen;
-
- setOpen(newOpen);
- };
-
return (
- <Popover open={open} onOpenChange={onOpenChange}>
- <PopoverTrigger
- className="flex cursor-pointer"
- onMouseEnter={onMouseEnter}
- onMouseLeave={onMouseLeave}
- >
- {children || <StackAvatars recipients={recipients} />}
- </PopoverTrigger>
-
- <PopoverContent
- side={position}
- onMouseEnter={onMouseEnter}
- onMouseLeave={onMouseLeave}
- className="flex flex-col gap-y-5 py-2"
- >
- {completedRecipients.length > 0 && (
- <div>
- <h1 className="text-base font-medium">Completed</h1>
- {completedRecipients.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 className="">
- <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 && (
- <div>
- <h1 className="text-base font-medium">Waiting</h1>
- {waitingRecipients.map((recipient: Recipient) => (
- <AvatarWithRecipient
- key={recipient.id}
- recipient={recipient}
- documentStatus={documentStatus}
- />
- ))}
- </div>
- )}
-
- {openedRecipients.length > 0 && (
- <div>
- <h1 className="text-base font-medium">Opened</h1>
- {openedRecipients.map((recipient: Recipient) => (
- <AvatarWithRecipient
+ <PopoverHover
+ trigger={children || <StackAvatars recipients={recipients} />}
+ contentProps={{
+ className: 'flex flex-col gap-y-5 py-2',
+ side: position,
+ }}
+ >
+ {completedRecipients.length > 0 && (
+ <div>
+ <h1 className="text-base font-medium">Completed</h1>
+ {completedRecipients.map((recipient: Recipient) => (
+ <div key={recipient.id} className="my-1 flex items-center gap-2">
+ <StackAvatar
+ first={true}
key={recipient.id}
- recipient={recipient}
- documentStatus={documentStatus}
+ type={getRecipientType(recipient)}
+ fallbackText={recipientAbbreviation(recipient)}
/>
- ))}
- </div>
- )}
-
- {uncompletedRecipients.length > 0 && (
- <div>
- <h1 className="text-base font-medium">Uncompleted</h1>
- {uncompletedRecipients.map((recipient: Recipient) => (
- <AvatarWithRecipient
- key={recipient.id}
- recipient={recipient}
- documentStatus={documentStatus}
- />
- ))}
- </div>
- )}
- </PopoverContent>
- </Popover>
+ <div className="">
+ <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 && (
+ <div>
+ <h1 className="text-base font-medium">Waiting</h1>
+ {waitingRecipients.map((recipient: Recipient) => (
- <AvatarWithRecipient key={recipient.id} recipient={recipient} />
++ <AvatarWithRecipient
++ key={recipient.id}
++ recipient={recipient}
++ documentStatus={documentStatus}
++ />
+ ))}
+ </div>
+ )}
+
+ {openedRecipients.length > 0 && (
+ <div>
+ <h1 className="text-base font-medium">Opened</h1>
+ {openedRecipients.map((recipient: Recipient) => (
- <AvatarWithRecipient key={recipient.id} recipient={recipient} />
++ <AvatarWithRecipient
++ key={recipient.id}
++ recipient={recipient}
++ documentStatus={documentStatus}
++ />
+ ))}
+ </div>
+ )}
+
+ {uncompletedRecipients.length > 0 && (
+ <div>
+ <h1 className="text-base font-medium">Uncompleted</h1>
+ {uncompletedRecipients.map((recipient: Recipient) => (
- <AvatarWithRecipient key={recipient.id} recipient={recipient} />
++ <AvatarWithRecipient
++ key={recipient.id}
++ recipient={recipient}
++ documentStatus={documentStatus}
++ />
+ ))}
+ </div>
+ )}
+ </PopoverHover>
);
};