Skip to content

Commit 550e1a2

Browse files
Merge pull request #38 from devweekends/fix-testimonial-form
fix: Set testimonial form
2 parents f59ed75 + 6be8ce8 commit 550e1a2

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

app/api/testimonials/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function POST(request: Request) {
2424
const data = await request.json();
2525

2626
// Basic validation
27-
if (!data.name || !data.role || !data.email || !data.content) {
27+
if (!data.name || !data.role || !data.content || !data.cta) {
2828
return NextResponse.json(
2929
{ error: 'Missing required fields' },
3030
{ status: 400 }

components/submit-testimonial-modal.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,10 @@ export function SubmitTestimonialModal() {
155155
</div>
156156

157157
<div className="space-y-2">
158-
<Label htmlFor="email">Email *</Label>
158+
<Label htmlFor="email">Email (Optional)</Label>
159159
<Input
160160
id="email"
161161
type="email"
162-
required
163162
value={formData.email}
164163
onChange={(e) => setFormData({...formData, email: e.target.value})}
165164
/>
@@ -202,6 +201,19 @@ export function SubmitTestimonialModal() {
202201
/>
203202
</div>
204203

204+
<div className="space-y-2">
205+
<Label htmlFor="cta">Message to Readers *</Label>
206+
<Input
207+
id="cta"
208+
type="text"
209+
placeholder="Join Dev Weekends to level up your skills"
210+
required
211+
value={formData.cta}
212+
onChange={(e) => setFormData({...formData, cta: e.target.value})}
213+
/>
214+
<p className="text-xs text-muted-foreground">Short call-to-action or closing thought.</p>
215+
</div>
216+
205217
<div className="space-y-2">
206218
<Label htmlFor="videoUrl">Video URL (Optional)</Label>
207219
<Input
@@ -214,18 +226,6 @@ export function SubmitTestimonialModal() {
214226
<p className="text-xs text-muted-foreground">Link to a YouTube video or similar.</p>
215227
</div>
216228

217-
<div className="space-y-2">
218-
<Label htmlFor="cta">CTA / Message to Readers (Optional)</Label>
219-
<Input
220-
id="cta"
221-
type="text"
222-
placeholder="Join Dev Weekends to level up your skills"
223-
value={formData.cta}
224-
onChange={(e) => setFormData({...formData, cta: e.target.value})}
225-
/>
226-
<p className="text-xs text-muted-foreground">Short call-to-action or closing thought.</p>
227-
</div>
228-
229229
<DialogFooter>
230230
<Button type="submit" disabled={loading} className="w-full">
231231
{loading && <Loader2 className="w-4 h-4 mr-2 animate-spin" />}

models/Testimonial.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const TestimonialSchema = new Schema<ITestimonial>(
2828
},
2929
email: {
3030
type: String,
31-
required: [true, 'Email is required'], // For internal contact/verification
3231
trim: true,
3332
},
3433
content: {

0 commit comments

Comments
 (0)