'use client' import { useState, useEffect } from 'react' import { Star, Save, CheckCircle } from 'lucide-react' import { LessonReflection } from '@/lib/companion/types' interface ReflectionSectionProps { reflection?: LessonReflection onSave: (rating: number, notes: string, nextSteps: string) => void } export function ReflectionSection({ reflection, onSave }: ReflectionSectionProps) { const [rating, setRating] = useState(reflection?.rating || 0) const [notes, setNotes] = useState(reflection?.notes || '') const [nextSteps, setNextSteps] = useState(reflection?.nextSteps || '') const [hoverRating, setHoverRating] = useState(0) const [saved, setSaved] = useState(false) useEffect(() => { if (reflection) { setRating(reflection.rating) setNotes(reflection.notes) setNextSteps(reflection.nextSteps) } }, [reflection]) const handleSave = () => { if (rating === 0) return onSave(rating, notes, nextSteps) setSaved(true) setTimeout(() => setSaved(false), 2000) } const ratingLabels = [ '', // 0 'Verbesserungsbedarf', 'Okay', 'Gut', 'Sehr gut', 'Ausgezeichnet', ] return (
{/* Star Rating */}
{[1, 2, 3, 4, 5].map((star) => { const isFilled = star <= (hoverRating || rating) return ( ) })} {(hoverRating || rating) > 0 && ( {ratingLabels[hoverRating || rating]} )}
{/* Notes */}