'use client' import { useState } from 'react' import { X, MessageSquare, Bug, Lightbulb, Send, CheckCircle } from 'lucide-react' import { FeedbackType } from '@/lib/companion/types' interface FeedbackModalProps { isOpen: boolean onClose: () => void onSubmit: (type: FeedbackType, title: string, description: string) => Promise } const feedbackTypes: { id: FeedbackType; label: string; icon: typeof Bug; color: string }[] = [ { id: 'bug', label: 'Bug melden', icon: Bug, color: 'text-red-600 bg-red-50' }, { id: 'feature', label: 'Feature-Wunsch', icon: Lightbulb, color: 'text-amber-600 bg-amber-50' }, { id: 'feedback', label: 'Allgemeines Feedback', icon: MessageSquare, color: 'text-blue-600 bg-blue-50' }, ] export function FeedbackModal({ isOpen, onClose, onSubmit }: FeedbackModalProps) { const [type, setType] = useState('feedback') const [title, setTitle] = useState('') const [description, setDescription] = useState('') const [isSubmitting, setIsSubmitting] = useState(false) const [isSuccess, setIsSuccess] = useState(false) if (!isOpen) return null const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() if (!title.trim() || !description.trim()) return setIsSubmitting(true) try { await onSubmit(type, title.trim(), description.trim()) setIsSuccess(true) setTimeout(() => { setIsSuccess(false) setTitle('') setDescription('') setType('feedback') onClose() }, 2000) } catch (error) { console.error('Failed to submit feedback:', error) } finally { setIsSubmitting(false) } } return (
{/* Backdrop */}
{/* Modal */}
{/* Header */}

Feedback senden

{/* Success State */} {isSuccess ? (

Vielen Dank!

Ihr Feedback wurde erfolgreich gesendet.

) : (
{/* Content */}
{/* Feedback Type */}
{feedbackTypes.map((ft) => ( ))}
{/* Title */}
setTitle(e.target.value)} placeholder={ type === 'bug' ? 'z.B. Timer stoppt nach Pause nicht mehr' : type === 'feature' ? 'z.B. Materialien an Stunde anhaengen' : 'z.B. Super nuetzliches Tool!' } className="w-full px-4 py-3 border border-slate-200 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required />
{/* Description */}