import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; import { Label } from '@/components/ui/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Progress } from '@/components/ui/progress'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { FileText, DollarSign, Code, Users, ChevronRight, ChevronLeft, Check } from 'lucide-react'; interface ProposalWizardProps { onComplete: (proposal: any) => void; onCancel: () => void; } const ProposalWizard: React.FC = ({ onComplete, onCancel }) => { const { t } = useTranslation(); const [currentStep, setCurrentStep] = useState(1); const [selectedTemplate, setSelectedTemplate] = useState(''); const [proposalData, setProposalData] = useState({ title: '', category: '', summary: '', description: '', motivation: '', specification: '', budget: '', timeline: '', milestones: [''], risks: '', team: '', impact: '', metrics: '' }); const templates = [ { id: 'treasury', name: t('proposals.templates.treasury'), icon: DollarSign, description: t('proposals.templates.treasuryDesc'), color: 'bg-green-500' }, { id: 'technical', name: t('proposals.templates.technical'), icon: Code, description: t('proposals.templates.technicalDesc'), color: 'bg-blue-500' }, { id: 'community', name: t('proposals.templates.community'), icon: Users, description: t('proposals.templates.communityDesc'), color: 'bg-purple-500' } ]; const steps = [ { id: 1, name: t('proposals.steps.template') }, { id: 2, name: t('proposals.steps.basics') }, { id: 3, name: t('proposals.steps.details') }, { id: 4, name: t('proposals.steps.impact') }, { id: 5, name: t('proposals.steps.review') } ]; const handleNext = () => { if (currentStep < steps.length) { setCurrentStep(currentStep + 1); } }; const handleBack = () => { if (currentStep > 1) { setCurrentStep(currentStep - 1); } }; const handleSubmit = () => { onComplete({ ...proposalData, template: selectedTemplate }); }; const progress = (currentStep / steps.length) * 100; return (
{/* Progress Bar */}
{steps.map((step) => (
{step.name}
))}
{/* Step Content */} {steps[currentStep - 1].name} {currentStep === 1 && t('proposals.wizard.selectTemplate')} {currentStep === 2 && t('proposals.wizard.enterBasics')} {currentStep === 3 && t('proposals.wizard.provideDetails')} {currentStep === 4 && t('proposals.wizard.defineImpact')} {currentStep === 5 && t('proposals.wizard.reviewSubmit')} {/* Step 1: Template Selection */} {currentStep === 1 && (
{templates.map((template) => { const Icon = template.icon; return ( setSelectedTemplate(template.id)} >

{template.name}

{template.description}

); })}
)} {/* Step 2: Basic Information */} {currentStep === 2 && (
setProposalData({...proposalData, title: e.target.value})} placeholder={t('proposals.placeholders.title')} />