'use client' import { useState } from 'react' import { motion } from 'framer-motion' import { Calendar, CheckCircle } from 'lucide-react' export default function TimelineContributionSection() { const [name, setName] = useState('') const [story, setStory] = useState('') const [addToTimeline, setAddToTimeline] = useState(false) const [year, setYear] = useState('') const [month, setMonth] = useState('') const [day, setDay] = useState('') const [title, setTitle] = useState('') const [submitting, setSubmitting] = useState(false) const [success, setSuccess] = useState(false) const [error, setError] = useState('') const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() // No required fields - allow empty submissions setSubmitting(true) setError('') try { const res = await fetch('/api/timeline-contributions', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: name.trim() || 'Anonym', year: addToTimeline ? (year.trim() || null) : null, month: addToTimeline ? (month.trim() || null) : null, day: addToTimeline ? (day.trim() || null) : null, title: addToTimeline ? (title.trim() || 'Erinnerung') : 'Erinnerung', story: story.trim() || '', }), }) if (res.ok) { setSuccess(true) setName('') setYear('') setMonth('') setDay('') setTitle('') setStory('') setAddToTimeline(false) setTimeout(() => setSuccess(false), 5000) } else { const data = await res.json() setError(data.error || 'Fehler beim Senden') } } catch (err) { setError('Netzwerkfehler. Bitte versuche es erneut.') } finally { setSubmitting(false) } } return (

Teile deine Erinnerung

Hast du eine besondere Erinnerung an Oma? Teile deine Geschichte mit uns. Alle Beiträge werden von Dennis geprüft.

{success && (

Vielen Dank für deine Erinnerung!

Dein Beitrag wird geprüft und erscheint bald auf der Seite.

)} {error && (

{error}

)}
{/* Name */}
setName(e.target.value)} placeholder="z.B. Maria Schmidt" className="w-full px-4 py-3 rounded-xl border border-warm-border bg-white text-warm-brown placeholder-warm-brown-light/30 focus:outline-none focus:ring-2 focus:ring-warm-gold/30 font-lora text-sm" />
{/* Story */}