diff --git a/apps/web/src/app/(dashboard)/dashboard/page.tsx b/apps/web/src/app/(dashboard)/dashboard/page.tsx index a59daef00..0d6a56266 100644 --- a/apps/web/src/app/(dashboard)/dashboard/page.tsx +++ b/apps/web/src/app/(dashboard)/dashboard/page.tsx @@ -14,6 +14,12 @@ import { TableHeader, TableRow, } from '@documenso/ui/primitives/table'; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from '@documenso/ui/primitives/tooltip'; import { StackAvatar } from '~/components/(dashboard)/avatar'; import { CardMetric } from '~/components/(dashboard)/metric-card/metric-card'; @@ -60,6 +66,24 @@ const renderStackAvatars = (recipients: Recipient[]) => { }); }; +const renderAvatar = (recipient: Recipient) => { + const initials = + recipient.name + ?.split(' ') + .map((name: string) => name.slice(0, 1).toUpperCase()) + .slice(0, 2) + .join('') ?? 'UK'; + + const type = + recipient.sendStatus === 'SENT' && recipient.signingStatus === 'SIGNED' + ? 'completed' + : recipient.sendStatus === 'SENT' && recipient.signingStatus === 'NOT_SIGNED' + ? 'waiting' + : 'unsigned'; + + return ; +}; + export default async function DashboardPage() { const session = await getRequiredServerComponentSession(); @@ -106,30 +130,107 @@ export default async function DashboardPage() { - {results.data.map((document) => ( - - {document.id} - - - {document.title} - - + {results.data.map((document) => { + const waitingRecipients = document.Recipient.filter( + (recipient) => + recipient.sendStatus === 'SENT' && recipient.signingStatus === 'NOT_SIGNED', + ); - - {renderStackAvatars(document.Recipient)} - + const completedRecipients = document.Recipient.filter( + (recipient) => + recipient.sendStatus === 'SENT' && recipient.signingStatus === 'SIGNED', + ); - - - - - - - - ))} + const uncompletedRecipients = document.Recipient.filter( + (recipient) => + recipient.sendStatus === 'NOT_SENT' && recipient.signingStatus === 'NOT_SIGNED', + ); + + return ( + + {document.id} + + + {document.title} + + + + + + + + {renderStackAvatars(document.Recipient)} + + +
+ {completedRecipients.length > 0 && ( +
+

Completed

+ {completedRecipients.map((recipient: Recipient) => ( +
+ {renderAvatar(recipient)} + + {recipient.email} + +
+ ))} +
+ )} + + {waitingRecipients.length > 0 && ( +
+

Waiting

+ {waitingRecipients.map((recipient: Recipient) => ( +
+ {renderAvatar(recipient)} + + {recipient.email} + +
+ ))} +
+ )} + + {uncompletedRecipients.length > 0 && ( +
+

Uncompleted

+ {uncompletedRecipients.map((recipient: Recipient) => ( +
+ {renderAvatar(recipient)} + + {recipient.email} + +
+ ))} +
+ )} +
+
+
+
+
+ + + + + + + +
+ ); + })} {results.data.length === 0 && ( diff --git a/apps/web/src/components/(dashboard)/avatar/index.tsx b/apps/web/src/components/(dashboard)/avatar/index.tsx index a784cbbff..2a263893a 100644 --- a/apps/web/src/components/(dashboard)/avatar/index.tsx +++ b/apps/web/src/components/(dashboard)/avatar/index.tsx @@ -11,7 +11,7 @@ export const StackAvatar = ({ first, zIndex, fallbackText, type }: StackAvatarPr let classes = ''; switch (type) { case 'unsigned': - classes = 'bg-dawn-400 text-dawn-900'; + classes = 'bg-dawn-200 text-dawn-900'; break; case 'waiting': classes = 'bg-water text-water-700';