From 0c2b2dbbff1fef7de9dfb93d1b377a29a89cbd00 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 14:36:26 +0000 Subject: [PATCH] feat: Add anonymous comment to banner --- src/components/PetitionForm.tsx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/PetitionForm.tsx b/src/components/PetitionForm.tsx index bf99485..d8c5a00 100644 --- a/src/components/PetitionForm.tsx +++ b/src/components/PetitionForm.tsx @@ -16,6 +16,7 @@ const petitionSchema = z.object({ const anonymousSchema = z.object({ email: z.string().trim().email("Invalid email address").max(255, "Email must be less than 255 characters"), + comment: z.string().trim().max(1000, "Comment must be less than 1000 characters").optional(), }); interface PetitionFormProps { @@ -37,7 +38,7 @@ export const PetitionForm = ({ compact = false }: PetitionFormProps) => { // Validate input based on mode try { if (isAnonymous) { - anonymousSchema.parse({ email: formData.email }); + anonymousSchema.parse({ email: formData.email, comment: formData.comment }); } else { petitionSchema.parse(formData); } @@ -56,7 +57,7 @@ export const PetitionForm = ({ compact = false }: PetitionFormProps) => { .insert([{ name: isAnonymous ? 'Anonymous' : formData.name.trim(), email: formData.email.trim(), - comment: isAnonymous ? null : (formData.comment.trim() || null), + comment: formData.comment.trim() || null, }]); if (error) throw error; @@ -111,20 +112,18 @@ export const PetitionForm = ({ compact = false }: PetitionFormProps) => { /> - {!isAnonymous && !compact && ( -
- Your signature will be recorded as "Anonymous" with only your email for verification. + Your signature will be recorded as "Anonymous" with your email for verification.
)}