mirror of
https://github.com/documenso/documenso.git
synced 2026-07-20 23:13:34 +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.
16 lines
766 B
TypeScript
16 lines
766 B
TypeScript
import { APP_DOCUMENT_UPLOAD_SIZE_LIMIT } from '@documenso/lib/constants/app';
|
|
import { msg } from '@lingui/core/macro';
|
|
import { ErrorCode, type FileRejection } from 'react-dropzone';
|
|
import { match } from 'ts-pattern';
|
|
|
|
export const buildDropzoneRejectionDescription = (fileRejections: FileRejection[]) => {
|
|
const errorCode = fileRejections[0]?.errors[0]?.code;
|
|
|
|
return match(errorCode)
|
|
.with(ErrorCode.FileTooLarge, () => msg`File is larger than ${APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB`)
|
|
.with(ErrorCode.FileInvalidType, () => msg`Only PDF files are allowed`)
|
|
.with(ErrorCode.FileTooSmall, () => msg`File is too small`)
|
|
.with(ErrorCode.TooManyFiles, () => msg`Only one file can be uploaded at a time`)
|
|
.otherwise(() => msg`Unknown error`);
|
|
};
|