feat: Implement contact page and backend

This commit is contained in:
gpt-engineer-app[bot]
2025-10-28 17:01:57 +00:00
parent e2bd71cf24
commit e5f8ecefeb
11 changed files with 1510 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { z } from 'zod';
export const contactCategories = [
{ value: 'general', label: 'General Inquiry' },
{ value: 'moderation', label: 'Moderation Questions' },
{ value: 'technical', label: 'Technical Support' },
{ value: 'account', label: 'Account Issues' },
{ value: 'partnership', label: 'Partnership/Business' },
{ value: 'report', label: 'Report an Issue' },
{ value: 'other', label: 'Other' },
] as const;
export const contactFormSchema = z.object({
name: z
.string()
.trim()
.min(2, 'Name must be at least 2 characters')
.max(100, 'Name must be less than 100 characters'),
email: z
.string()
.trim()
.email('Invalid email address')
.max(255, 'Email must be less than 255 characters'),
subject: z
.string()
.trim()
.min(5, 'Subject must be at least 5 characters')
.max(200, 'Subject must be less than 200 characters'),
category: z.string()
.refine(
(val) => ['general', 'moderation', 'technical', 'account', 'partnership', 'report', 'other'].includes(val),
{ message: 'Please select a valid category' }
),
message: z
.string()
.trim()
.min(20, 'Message must be at least 20 characters')
.max(2000, 'Message must be less than 2000 characters'),
captchaToken: z.string().min(1, 'Please complete the CAPTCHA'),
});
export type ContactFormData = z.infer<typeof contactFormSchema>;
export interface ContactSubmission extends ContactFormData {
userId?: string;
}