Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

refactor: change `nonempty` to `min`

Marc Seitz8afac4acc739
diff --git a/components/datarooms/add-dataroom-modal.tsx b/components/datarooms/add-dataroom-modal.tsx
index 9f647588..76dea926 100644
--- a/components/datarooms/add-dataroom-modal.tsx
+++ b/components/datarooms/add-dataroom-modal.tsx
@@ -43,9 +43,9 @@ export function AddDataroomModal({
const { plan } = usePlan();
const analytics = useAnalytics();
const dataroomSchema = z.object({
- name: z
- .string()
- .nonempty("Dataroom name is required. Please enter a valid name."),
+ name: z.string().min(3, {
+ message: "Dataroom name is required. Please enter a valid name.",
+ }),
});
const handleSubmit = async (event: any) => {
diff --git a/components/datarooms/groups/add-group-modal.tsx b/components/datarooms/groups/add-group-modal.tsx
index b5cf4aee..57a82f7d 100644
--- a/components/datarooms/groups/add-group-modal.tsx
+++ b/components/datarooms/groups/add-group-modal.tsx
@@ -40,7 +40,9 @@ export function AddGroupModal({
const addGroupSchema = z.object({
name: z
.string()
- .nonempty("Group name is required. Please enter a valid name."),
+ .min(3, {
+ message: "Group name is required. Please enter a valid name.",
+ }),
});
const handleSubmit = async (event: any) => {
diff --git a/components/domains/add-domain-modal.tsx b/components/domains/add-domain-modal.tsx
index 38d13f87..c3a82d73 100644
--- a/components/domains/add-domain-modal.tsx
+++ b/components/domains/add-domain-modal.tsx
@@ -46,7 +46,7 @@ export function AddDomainModal({
const addDomainSchema = z.object({
name: z
.string()
- .nonempty("Domain is required. Please enter a valid domain.")
+ .min(3, { message: "Domain is required. Please enter a valid domain." })
// Add validation for papermark
.refine((name) => !name.toLowerCase().includes("papermark"), {
message: "Domain cannot contain 'papermark'",
diff --git a/components/folders/add-folder-modal.tsx b/components/folders/add-folder-modal.tsx
index 29af4176..d8d527fb 100644
--- a/components/folders/add-folder-modal.tsx
+++ b/components/folders/add-folder-modal.tsx
@@ -53,9 +53,9 @@ export function AddFolderModal({
/** current folder name */
const currentFolderPath = router.query.name as string[] | undefined;
const addFolderSchema = z.object({
- name: z
- .string()
- .nonempty("Folder name is required. Please enter a valid name."),
+ name: z.string().min(3, {
+ message: "Folder name is required. Please enter a valid name.",
+ }),
});
const handleSubmit = async (event: any) => {
diff --git a/components/folders/edit-folder-modal.tsx b/components/folders/edit-folder-modal.tsx
index 82bf46fd..1812845e 100644
--- a/components/folders/edit-folder-modal.tsx
+++ b/components/folders/edit-folder-modal.tsx
@@ -42,9 +42,9 @@ export function EditFolderModal({
const teamInfo = useTeam();
const editFolderSchema = z.object({
- name: z
- .string()
- .nonempty("Folder name is required. Please enter a valid name."),
+ name: z.string().min(3, {
+ message: "Folder name is required. Please enter a valid name.",
+ }),
});
const handleSubmit = async (event: any) => {
diff --git a/components/teams/add-team-member-modal.tsx b/components/teams/add-team-member-modal.tsx
index f896b0d3..b89d403e 100644
--- a/components/teams/add-team-member-modal.tsx
+++ b/components/teams/add-team-member-modal.tsx
@@ -37,7 +37,7 @@ export function AddTeamMembers({
const analytics = useAnalytics();
const emailSchema = z
.string()
- .nonempty("Email name is required.")
+ .min(3, { message: "Email name is required." })
.email({ message: "Please enter a valid email." });
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {