Skip to content

Commit

Permalink
feat : added condition for name to have only letters
Browse files Browse the repository at this point in the history
  • Loading branch information
surajhub255 committed Oct 30, 2024
1 parent 0ff0c29 commit 2e10cda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/app/create-brand/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ const API_KEY = process.env.NEXT_PUBLIC_STORAGE_API!
const client = new NFTStorage({ token: API_KEY })

const formSchema = z.object({
name: z.string().min(2, {
message: 'Brand name must be at least 2 characters',
}),
name: z.string()
.min(2, {
message: 'Brand name must be at least 2 characters',
})
.regex(/^[a-zA-Z\s]*$/, {
message: 'Brand name must only contain letters',
}),
slogan: z.string().min(2, {
message: 'Slogan name must be at least 2 characters',
}),
Expand Down
8 changes: 5 additions & 3 deletions src/app/create-collection/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ const client = new NFTStorage({ token: API_KEY })

const formSchema = z.object({
name: z.string().min(2, {
message: 'Brand name must be at least 2 characters',
message: 'Collection name must be at least 2 characters',
}).regex(/^[a-zA-Z\s]*$/, {
message: 'Collection name must only contain letters',
}),
description: z
.string()
.min(2, { message: 'Brand description must be at least 2 characters' })
.min(2, { message: 'Collection description must be at least 2 characters' })
.max(1000, {
message: 'Brand description should be less than 1000 words',
message: 'Collection description should be less than 1000 words',
}),
logo_image: z.string(),
cover_image: z.string(),
Expand Down
4 changes: 3 additions & 1 deletion src/app/create-phygital/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +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',
}),
category: z
.array(z.string()),
Expand All @@ -43,7 +45,7 @@ const formSchema = z.object({
.string()
.min(2, { message: 'Description must be at least 2 characters' })
.max(1000, {
message: 'Brand description should be less than 1000 words',
message: 'Phygital description should be less than 1000 words',
}),
price: z.string().min(1, { message: 'Price must be provided' }),
quantity: z.string().min(1, { message: 'Quantity must be provided' }),
Expand Down

0 comments on commit 2e10cda

Please sign in to comment.