Compare commits

..

2 Commits

Author SHA1 Message Date
Mythie
3eebd52dd1 fix: improve types 2023-04-19 23:52:37 +10:00
Saurav Gurhale
f8f4c07d11 add toast error for invalid email 2023-04-19 23:48:21 +10:00
7 changed files with 4960 additions and 1076 deletions

4
apps/web/.babelrc Normal file
View File

@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": []
}

View File

@@ -1,8 +1,3 @@
{ {
"extends": [ "extends": ["next/babel", "next/core-web-vitals"]
"next/core-web-vitals"
],
"rules": {
"react/no-unescaped-entities": "off"
}
} }

View File

@@ -16,16 +16,27 @@
"@headlessui/react": "^1.7.4", "@headlessui/react": "^1.7.4",
"@heroicons/react": "^2.0.13", "@heroicons/react": "^2.0.13",
"@pdf-lib/fontkit": "^1.1.1", "@pdf-lib/fontkit": "^1.1.1",
"@tailwindcss/forms": "^0.5.3",
"@types/bcryptjs": "^2.4.2",
"@types/filesystem": "^0.0.32",
"@types/react-dom": "18.0.9",
"avatar-from-initials": "^1.0.3", "avatar-from-initials": "^1.0.3",
"base64-arraybuffer": "^1.0.2", "base64-arraybuffer": "^1.0.2",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"dotenv": "^16.0.3",
"eslint": "8.27.0",
"eslint-config-next": "13.0.3",
"file-loader": "^6.2.0",
"formidable": "^3.2.5", "formidable": "^3.2.5",
"next": "13.2.4", "install": "^0.13.0",
"next-auth": "^4.22.0", "next": "13.0.3",
"next-auth": ">=4.20.1",
"next-transpile-modules": "^10.0.0",
"node-forge": "^1.3.1", "node-forge": "^1.3.1",
"node-signpdf": "^1.5.0", "node-signpdf": "^1.5.0",
"nodemailer": "^6.9.0", "nodemailer": "^6.9.0",
"nodemailer-sendgrid": "^1.0.3", "nodemailer-sendgrid": "^1.0.3",
"npm": "^9.1.3",
"pdf-lib": "^1.17.1", "pdf-lib": "^1.17.1",
"placeholder-loading": "^0.6.0", "placeholder-loading": "^0.6.0",
"react": "18.2.0", "react": "18.2.0",
@@ -35,14 +46,12 @@
"react-pdf": "^6.2.2", "react-pdf": "^6.2.2",
"react-resizable": "^3.0.4", "react-resizable": "^3.0.4",
"react-tooltip": "^5.7.2", "react-tooltip": "^5.7.2",
"sass": "^1.57.1",
"short-uuid": "^4.2.2", "short-uuid": "^4.2.2",
"string-to-color": "^2.2.2" "string-to-color": "^2.2.2",
"typescript": "4.8.4"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@types/bcryptjs": "^2.4.2",
"@types/filesystem": "^0.0.32",
"@types/react-dom": "18.0.9",
"@types/formidable": "^2.0.5", "@types/formidable": "^2.0.5",
"@types/node": "^18.11.18", "@types/node": "^18.11.18",
"@types/nodemailer": "^6.4.7", "@types/nodemailer": "^6.4.7",
@@ -50,14 +59,7 @@
"@types/react-pdf": "^6.2.0", "@types/react-pdf": "^6.2.0",
"@types/react-resizable": "^3.0.3", "@types/react-resizable": "^3.0.3",
"autoprefixer": "^10.4.13", "autoprefixer": "^10.4.13",
"dotenv": "^16.0.3",
"eslint": "8.27.0",
"eslint-config-next": "13.0.3",
"file-loader": "^6.2.0",
"next-transpile-modules": "^10.0.0",
"postcss": "^8.4.19", "postcss": "^8.4.19",
"sass": "^1.57.1", "tailwindcss": "^3.2.4"
"tailwindcss": "^3.2.4",
"typescript": "4.8.4"
} }
} }

View File

@@ -18,11 +18,12 @@ import {
UserPlusIcon, UserPlusIcon,
XMarkIcon, XMarkIcon,
} from "@heroicons/react/24/outline"; } from "@heroicons/react/24/outline";
import { DocumentStatus, Document as PrismaDocument } from "@prisma/client"; import { DocumentStatus, Document as PrismaDocument, Recipient } from "@prisma/client";
import { FormProvider, useFieldArray, useForm, useWatch } from "react-hook-form"; import { FormProvider, useFieldArray, useForm, useWatch } from "react-hook-form";
import { toast } from "react-hot-toast";
export type FormValues = { export type FormValues = {
signers: { id: number; email: string; name: string }[]; signers: Array<Pick<Recipient, 'id' | 'email' | 'name' | 'sendStatus'>>;
}; };
const RecipientsPage: NextPageWithLayout = (props: any) => { const RecipientsPage: NextPageWithLayout = (props: any) => {
@@ -108,12 +109,14 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
color="primary" color="primary"
icon={PaperAirplaneIcon} icon={PaperAirplaneIcon}
onClick={() => { onClick={() => {
setOpen(true); formValues.some((r) => r.email && hasEmailError(r))
? toast.error("Please enter a valid email address.", { id: "invalid email" })
: setOpen(true);
}} }}
disabled={ disabled={
(formValues.length || 0) === 0 || (formValues.length || 0) === 0 ||
!formValues.some( !formValues.some(
(r: any) => r.email && !hasEmailError(r) && r.sendStatus === "NOT_SENT" (r) => r.email && !hasEmailError(r) && r.sendStatus === "NOT_SENT"
) || ) ||
loading loading
}> }>

5930
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -26,31 +26,33 @@
"@documenso/prisma": "*", "@documenso/prisma": "*",
"@headlessui/react": "^1.7.4", "@headlessui/react": "^1.7.4",
"@heroicons/react": "^2.0.13", "@heroicons/react": "^2.0.13",
"@tailwindcss/forms": "^0.5.3",
"@types/bcryptjs": "^2.4.2",
"@types/node": "18.11.9",
"@types/react-dom": "18.0.9",
"@types/react-signature-canvas": "^1.0.2",
"avatar-from-initials": "^1.0.3", "avatar-from-initials": "^1.0.3",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"next": "13.2.4", "dotenv": "^16.0.3",
"eslint": "8.27.0",
"eslint-config-next": "13.0.3",
"install": "^0.13.0",
"next": "13.0.3",
"next-auth": ">=4.20.1", "next-auth": ">=4.20.1",
"next-transpile-modules": "^10.0.0",
"npm": "^9.1.3",
"pdf-lib": "^1.17.1", "pdf-lib": "^1.17.1",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-hook-form": "^7.41.5", "react-hook-form": "^7.41.5",
"react-hot-toast": "^2.4.0", "react-hot-toast": "^2.4.0",
"react-signature-canvas": "^1.0.6" "react-signature-canvas": "^1.0.6",
"typescript": "4.8.4"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@trivago/prettier-plugin-sort-imports": "^4.1.1", "@trivago/prettier-plugin-sort-imports": "^4.1.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"@types/bcryptjs": "^2.4.2",
"@types/node": "18.11.9",
"@types/react-dom": "18.0.9",
"@types/react-signature-canvas": "^1.0.2",
"dotenv": "^16.0.3",
"eslint": "8.27.0",
"eslint-config-next": "13.0.3",
"next-transpile-modules": "^10.0.0",
"prettier": "^2.8.7", "prettier": "^2.8.7",
"prettier-plugin-tailwindcss": "^0.2.5", "prettier-plugin-tailwindcss": "^0.2.5"
"typescript": "4.8.4"
} }
} }

View File

@@ -3,19 +3,19 @@
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"main": "index.ts", "main": "index.ts",
"scripts": {
"db-studio": "prisma studio",
"db-seed": "prisma db seed"
},
"dependencies": {
"@prisma/client": "^4.8.1",
"prisma": "^4.8.1"
},
"devDependencies": { "devDependencies": {
"@types/node": "^18.11.18", "@types/node": "^18.11.18",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "4.8.4" "typescript": "4.8.4"
}, },
"dependencies": {
"@prisma/client": "^4.8.1",
"prisma": "^4.8.1"
},
"scripts": {
"db-studio": "prisma studio",
"db-seed": "prisma db seed"
},
"prisma": { "prisma": {
"seed": "ts-node --transpile-only ./seed.ts" "seed": "ts-node --transpile-only ./seed.ts"
} }