mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 21:11:22 -05:00
Refactor code structure and remove redundant changes
This commit is contained in:
46
src-old/lib/contactValidation.ts
Normal file
46
src-old/lib/contactValidation.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user