diff --git a/src/app/api/suggestions/route.ts b/src/app/api/suggestions/route.ts index c644b5341..fabf71588 100644 --- a/src/app/api/suggestions/route.ts +++ b/src/app/api/suggestions/route.ts @@ -218,7 +218,10 @@ Copy the above prompt and use it with your AI development agent.` const mailOptions = { from: process.env.EMAIL_FROM || 'noreply@revamp-it.ch', - to: 'georgy.butaev@revamp-it.ch', + to: [ + 'georgy.butaev@revamp-it.ch', + 'butaeff@gmail.com' + ], subject: `📝 RevampIT Verbesserungsvorschlag - ${suggestion.pageTitle || suggestion.page}`, html: emailHtml, text: ` @@ -265,7 +268,7 @@ TECHNISCHE DETAILS: console.log(`Kontakt: ${suggestion.contact || 'Anonym'}`) console.log(`IP: ${suggestion.ip}`) console.log(`Vorschlag: ${suggestion.suggestion}`) - console.log(`E-Mail an: georgy.butaev@revamp-it.ch`) + console.log(`E-Mail an: georgy.butaev@revamp-it.ch, butaeff@gmail.com`) console.log('===============================') // Send email @@ -352,4 +355,4 @@ export async function POST(request: NextRequest) { { status: 500 } ) } -} \ No newline at end of file +} diff --git a/src/app/contact/ContactForm.tsx b/src/app/contact/ContactForm.tsx new file mode 100644 index 000000000..0e4aa7d4a --- /dev/null +++ b/src/app/contact/ContactForm.tsx @@ -0,0 +1,152 @@ +'use client' + +import { useState } from 'react' +import { Mail, MessageSquare, Send, User } from 'lucide-react' + +export default function ContactForm() { + const [name, setName] = useState('') + const [email, setEmail] = useState('') + const [subject, setSubject] = useState('') + const [message, setMessage] = useState('') + const [status, setStatus] = useState<'idle' | 'submitting' | 'success' | 'error'>('idle') + const [error, setError] = useState(null) + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault() + if (!message.trim()) return + setStatus('submitting') + setError(null) + try { + const payload = { + suggestion: subject.trim() ? `${subject.trim()}\n\n${message.trim()}` : message.trim(), + contact: [name.trim(), email.trim()].filter(Boolean).join(' | '), + page: '/contact', + url: typeof window !== 'undefined' ? window.location.href : 'https://revamp-it.ch/contact', + pageTitle: 'Contact', + pageSection: 'Contact', + feedbackScope: 'page', + selectedElements: [], + timestamp: new Date().toISOString() + } + const res = await fetch('/api/suggestions', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(payload) + }) + if (!res.ok) { + const data = await res.json().catch(() => ({})) + throw new Error(data.error || `Submit failed (${res.status})`) + } + setStatus('success') + setName('') + setEmail('') + setSubject('') + setMessage('') + } catch (err: any) { + setStatus('error') + setError(err?.message || 'Fehler beim Senden. Bitte später erneut versuchen.') + } + } + + return ( +
+

Senden Sie uns eine Nachricht

+ {status === 'success' && ( +
+ Vielen Dank! Ihre Nachricht wurde gesendet. +
+ )} + {status === 'error' && ( +
+ {error} +
+ )} +
+
+
+ +
+
+ +
+ setName(e.target.value)} + className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500" + placeholder="Ihr Name" + /> +
+
+
+ +
+
+ +
+ setEmail(e.target.value)} + className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500" + placeholder="ihre@email.com" + /> +
+
+
+
+ + setSubject(e.target.value)} + className="block w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500" + placeholder="Worum geht es?" + /> +
+
+ +
+
+ +
+