mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 15:11:12 -05:00
Fix: Make thread_id nullable
This commit is contained in:
@@ -244,11 +244,11 @@ export function ContactForm() {
|
||||
|
||||
{/* Message */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="message">Message *</Label>
|
||||
<Label htmlFor="message">Message * (minimum 20 characters)</Label>
|
||||
<Textarea
|
||||
id="message"
|
||||
{...register('message')}
|
||||
placeholder="Please provide details about your inquiry..."
|
||||
placeholder="Please provide details about your inquiry (minimum 20 characters)..."
|
||||
rows={6}
|
||||
disabled={isSubmitting}
|
||||
className={errors.message ? 'border-destructive' : ''}
|
||||
@@ -257,8 +257,15 @@ export function ContactForm() {
|
||||
{errors.message && (
|
||||
<p className="text-sm text-destructive">{errors.message.message}</p>
|
||||
)}
|
||||
<p className="text-sm text-muted-foreground ml-auto">
|
||||
<p className={`text-sm ml-auto ${
|
||||
(watch('message')?.length || 0) < 20
|
||||
? 'text-destructive font-medium'
|
||||
: 'text-muted-foreground'
|
||||
}`}>
|
||||
{watch('message')?.length || 0} / 2000
|
||||
{(watch('message')?.length || 0) < 20 &&
|
||||
` (${20 - (watch('message')?.length || 0)} more needed)`
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -284,8 +291,15 @@ export function ContactForm() {
|
||||
<Button
|
||||
type="submit"
|
||||
size="lg"
|
||||
disabled={isSubmitting || !captchaToken}
|
||||
disabled={isSubmitting || !captchaToken || (watch('message')?.length || 0) < 20}
|
||||
className="w-full"
|
||||
title={
|
||||
!captchaToken
|
||||
? 'Please complete the CAPTCHA'
|
||||
: (watch('message')?.length || 0) < 20
|
||||
? `Message must be at least 20 characters (currently ${watch('message')?.length || 0})`
|
||||
: ''
|
||||
}
|
||||
>
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
|
||||
@@ -538,7 +538,7 @@ export type Database = {
|
||||
response_count: number | null
|
||||
status: string
|
||||
subject: string
|
||||
thread_id: string
|
||||
thread_id: string | null
|
||||
updated_at: string
|
||||
user_agent: string | null
|
||||
user_id: string | null
|
||||
@@ -559,7 +559,7 @@ export type Database = {
|
||||
response_count?: number | null
|
||||
status?: string
|
||||
subject: string
|
||||
thread_id: string
|
||||
thread_id?: string | null
|
||||
updated_at?: string
|
||||
user_agent?: string | null
|
||||
user_id?: string | null
|
||||
@@ -580,7 +580,7 @@ export type Database = {
|
||||
response_count?: number | null
|
||||
status?: string
|
||||
subject?: string
|
||||
thread_id?: string
|
||||
thread_id?: string | null
|
||||
updated_at?: string
|
||||
user_agent?: string | null
|
||||
user_id?: string | null
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Make thread_id nullable in contact_submissions table
|
||||
-- Contact submissions don't have a thread until an admin replies
|
||||
ALTER TABLE public.contact_submissions
|
||||
ALTER COLUMN thread_id DROP NOT NULL;
|
||||
Reference in New Issue
Block a user