'use client' import { useState, useEffect } from 'react' import { useParams, useRouter } from 'next/navigation' import Link from 'next/link' import { useLanguage } from '@/lib/LanguageContext' import { WizardStep, FormData, DEFAULT_STEPS } from './_components/types' import { stepIcons } from './_components/StepIcons' import { Step1, Step2, Step3, Step4, Step5, Step6, Step7, Step8 } from './_components/WizardSteps' import { AssistantSidebar } from './_components/AssistantSidebar' export default function FoerderantragWizardPage() { const params = useParams() const router = useRouter() const { t, isRTL } = useLanguage() const applicationId = params.applicationId as string const [currentStep, setCurrentStep] = useState(1) const [steps, setSteps] = useState(DEFAULT_STEPS) const [formData, setFormData] = useState({}) const [isSaving, setIsSaving] = useState(false) const [showAssistant, setShowAssistant] = useState(false) const [assistantMessage, setAssistantMessage] = useState('') const [assistantHistory, setAssistantHistory] = useState<{ role: string; content: string }[]>([]) const [isDemo, setIsDemo] = useState(false) useEffect(() => { if (applicationId.startsWith('demo-')) { setIsDemo(true) } }, [applicationId]) const handleFieldChange = (fieldId: string, value: any) => { setFormData(prev => ({ ...prev, [`step_${currentStep}`]: { ...prev[`step_${currentStep}`], [fieldId]: value, }, })) } const handleSaveStep = async () => { setIsSaving(true) try { setSteps(prev => prev.map(s => s.number === currentStep ? { ...s, is_completed: true } : s )) } finally { setIsSaving(false) } } const handleNextStep = async () => { await handleSaveStep() if (currentStep < 8) { setCurrentStep(prev => prev + 1) } } const handlePrevStep = () => { if (currentStep > 1) { setCurrentStep(prev => prev - 1) } } const handleAskAssistant = async () => { if (!assistantMessage.trim()) return const userMessage = assistantMessage setAssistantMessage('') setAssistantHistory(prev => [...prev, { role: 'user', content: userMessage }]) setTimeout(() => { const response = `${t('fa_assistant_title')}: ${userMessage}` setAssistantHistory(prev => [...prev, { role: 'assistant', content: response }]) }, 1000) } const currentStepData = steps.find(s => s.number === currentStep) const renderStepContent = () => { switch (currentStep) { case 1: return case 2: return case 3: return case 4: return case 5: return case 6: return case 7: return case 8: return default: return null } } return (
{/* Header */}

{t('fa_wizard_header')}

{t('fa_step1_title').split('')[0] && `${currentStep} ${t('fa_wizard_step_of')} ${steps.length}: ${currentStepData ? t(currentStepData.titleKey) : ''}`}

{isDemo && ( {t('fa_demo_mode')} )}
{/* Progress Steps */}
{steps.map((step) => ( ))}
{/* Main Content */}
{/* Form Area */}
{/* Step Header */}
{stepIcons[currentStepData?.icon || 'document-text']}

{currentStepData ? t(currentStepData.titleKey) : ''}

{currentStepData ? t(currentStepData.descKey) : ''}

{/* Step Content */}
{renderStepContent()}
{/* Navigation */}
{/* Assistant Sidebar */} {showAssistant && ( setShowAssistant(false)} /> )}
) }