mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
Merge pull request #217 from documenso/feat/stacked-avatars
feat: stack avatars
This commit is contained in:
6
packages/lib/client-only/recipient-initials.ts
Normal file
6
packages/lib/client-only/recipient-initials.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export const initials = (text: string) =>
|
||||
text
|
||||
?.split(' ')
|
||||
.map((name: string) => name.slice(0, 1).toUpperCase())
|
||||
.slice(0, 2)
|
||||
.join('') ?? 'UK';
|
||||
13
packages/lib/client-only/recipient-type.ts
Normal file
13
packages/lib/client-only/recipient-type.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { Recipient } from '@documenso/prisma/client';
|
||||
|
||||
export const getRecipientType = (recipient: Recipient) => {
|
||||
if (recipient.sendStatus === 'SENT' && recipient.signingStatus === 'SIGNED') {
|
||||
return 'completed';
|
||||
}
|
||||
|
||||
if (recipient.sendStatus === 'SENT' && recipient.signingStatus === 'NOT_SIGNED') {
|
||||
return 'waiting';
|
||||
}
|
||||
|
||||
return 'unsigned';
|
||||
};
|
||||
@ -1,5 +1,6 @@
|
||||
import { prisma } from '@documenso/prisma';
|
||||
import { Document, DocumentStatus, Prisma } from '@documenso/prisma/client';
|
||||
import { DocumentWithReciepient } from '@documenso/prisma/types/document-with-recipient';
|
||||
|
||||
import { FindResultSet } from '../../types/find-result-set';
|
||||
|
||||
@ -22,7 +23,7 @@ export const findDocuments = async ({
|
||||
page = 1,
|
||||
perPage = 10,
|
||||
orderBy,
|
||||
}: FindDocumentsOptions): Promise<FindResultSet<Document>> => {
|
||||
}: FindDocumentsOptions): Promise<FindResultSet<DocumentWithReciepient>> => {
|
||||
const orderByColumn = orderBy?.column ?? 'created';
|
||||
const orderByDirection = orderBy?.direction ?? 'desc';
|
||||
|
||||
@ -48,6 +49,9 @@ export const findDocuments = async ({
|
||||
orderBy: {
|
||||
[orderByColumn]: orderByDirection,
|
||||
},
|
||||
include: {
|
||||
Recipient: true,
|
||||
},
|
||||
}),
|
||||
prisma.document.count({
|
||||
where: {
|
||||
|
||||
@ -143,10 +143,10 @@ model Field {
|
||||
recipientId Int?
|
||||
type FieldType
|
||||
page Int
|
||||
positionX Decimal @default(0)
|
||||
positionY Decimal @default(0)
|
||||
width Decimal @default(-1)
|
||||
height Decimal @default(-1)
|
||||
positionX Decimal @default(0)
|
||||
positionY Decimal @default(0)
|
||||
width Decimal @default(-1)
|
||||
height Decimal @default(-1)
|
||||
customText String
|
||||
inserted Boolean
|
||||
Document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
|
||||
|
||||
5
packages/prisma/types/document-with-recipient.ts
Normal file
5
packages/prisma/types/document-with-recipient.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { Document, Recipient } from '@documenso/prisma/client';
|
||||
|
||||
export type DocumentWithReciepient = Document & {
|
||||
Recipient: Recipient[];
|
||||
};
|
||||
@ -76,6 +76,20 @@ module.exports = {
|
||||
900: '#52514a',
|
||||
950: '#2a2925',
|
||||
},
|
||||
water: {
|
||||
DEFAULT: '#d7e4f3',
|
||||
50: '#f3f6fb',
|
||||
100: '#e3ebf6',
|
||||
200: '#d7e4f3',
|
||||
300: '#abc7e5',
|
||||
400: '#82abd8',
|
||||
500: '#658ecc',
|
||||
600: '#5175bf',
|
||||
700: '#4764ae',
|
||||
800: '#3e538f',
|
||||
900: '#364772',
|
||||
950: '#252d46',
|
||||
},
|
||||
},
|
||||
backgroundImage: {
|
||||
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
||||
|
||||
Reference in New Issue
Block a user