From e0eace825b3d97610ec51097c816387efca95e98 Mon Sep 17 00:00:00 2001 From: Suraj Mahto Date: Thu, 31 Oct 2024 00:33:03 +0530 Subject: [PATCH 1/2] feat : added condition for name to have only letters and numbers --- src/app/create-brand/page.tsx | 4 ++-- src/app/create-collection/page.tsx | 4 ++-- src/app/create-phygital/page.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/create-brand/page.tsx b/src/app/create-brand/page.tsx index 77e87e8..43b1f48 100644 --- a/src/app/create-brand/page.tsx +++ b/src/app/create-brand/page.tsx @@ -41,8 +41,8 @@ const formSchema = z.object({ .min(2, { message: 'Brand name must be at least 2 characters', }) - .regex(/^[a-zA-Z\s]*$/, { - message: 'Brand name must only contain letters', + .regex(/^[a-zA-Z0-9\s]*$/, { + message: 'Brand name must only contain letters and numbers', }), slogan: z.string().min(2, { message: 'Slogan name must be at least 2 characters', diff --git a/src/app/create-collection/page.tsx b/src/app/create-collection/page.tsx index cbe908c..15625a7 100644 --- a/src/app/create-collection/page.tsx +++ b/src/app/create-collection/page.tsx @@ -39,8 +39,8 @@ const client = new NFTStorage({ token: API_KEY }) const formSchema = z.object({ name: z.string().min(2, { message: 'Collection name must be at least 2 characters', - }).regex(/^[a-zA-Z\s]*$/, { - message: 'Collection name must only contain letters', + }).regex(/^[a-zA-Z0-9\s]*$/, { + message: 'Brand name must only contain letters and numbers', }), description: z .string() diff --git a/src/app/create-phygital/page.tsx b/src/app/create-phygital/page.tsx index 2a5566e..41a6b4a 100644 --- a/src/app/create-phygital/page.tsx +++ b/src/app/create-phygital/page.tsx @@ -32,8 +32,8 @@ const client = new NFTStorage({ token: API_KEY }) const formSchema = z.object({ name: z.string().min(2, { message: 'Phygital name must be at least 2 characters', - }).regex(/^[a-zA-Z\s]*$/, { - message: 'Phygital name must only contain letters', + }).regex(/^[a-zA-Z0-9\s]*$/, { + message: 'Brand name must only contain letters and numbers', }), category: z .array(z.string()), From 410c6c78bd57b4f4ac6e89dba81e88afaf98d137 Mon Sep 17 00:00:00 2001 From: Suraj Mahto Date: Thu, 31 Oct 2024 00:35:18 +0530 Subject: [PATCH 2/2] fixed names --- src/app/create-collection/page.tsx | 2 +- src/app/create-phygital/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/create-collection/page.tsx b/src/app/create-collection/page.tsx index 15625a7..8e15974 100644 --- a/src/app/create-collection/page.tsx +++ b/src/app/create-collection/page.tsx @@ -40,7 +40,7 @@ const formSchema = z.object({ name: z.string().min(2, { message: 'Collection name must be at least 2 characters', }).regex(/^[a-zA-Z0-9\s]*$/, { - message: 'Brand name must only contain letters and numbers', + message: 'Collection name must only contain letters and numbers', }), description: z .string() diff --git a/src/app/create-phygital/page.tsx b/src/app/create-phygital/page.tsx index 41a6b4a..ad5d89f 100644 --- a/src/app/create-phygital/page.tsx +++ b/src/app/create-phygital/page.tsx @@ -33,7 +33,7 @@ const formSchema = z.object({ name: z.string().min(2, { message: 'Phygital name must be at least 2 characters', }).regex(/^[a-zA-Z0-9\s]*$/, { - message: 'Brand name must only contain letters and numbers', + message: 'Phygital name must only contain letters and numbers', }), category: z .array(z.string()),