import React, { useState } from 'react'; import { ArrowLeft, ChevronRight, Sparkles, EyeOff, CheckCircle2 } from 'lucide-react'; import { ViewMode, Step, InventoryMode, Scenario } from '../types'; import { SetupStep } from './engagement/SetupStep'; import { InventoryStep } from './engagement/InventoryStep'; import { ContextStep } from './engagement/ContextStep'; import { ValueStep } from './engagement/ValueStep'; import { DeliveryStep } from './engagement/DeliveryStep'; import { scenarioData as initialScenarioData } from '../data/mockData'; interface EngagementViewProps { currentStep: Step; setCurrentStep: (step: Step) => void; setCurrentView: (view: ViewMode) => void; isPresentationMode: boolean; setIsPresentationMode: (mode: boolean) => void; } export const EngagementView: React.FC = ({ currentStep, setCurrentStep, setCurrentView, isPresentationMode, setIsPresentationMode, }) => { const [inventoryMode, setInventoryMode] = useState('selection'); // Initialize with scenarios that are marked as selected in mock data const [selectedScenarios, setSelectedScenarios] = useState( initialScenarioData.filter(s => s.selected).map(s => ({ ...s })) ); // Toggle scenario selection const toggleScenarioSelection = (scenarioId: number) => { setSelectedScenarios(prev => { const isSelected = prev.some(s => s.id === scenarioId); if (isSelected) { // Remove from selection return prev.filter(s => s.id !== scenarioId); } else { // Add to selection - get full scenario data from initial data const scenario = initialScenarioData.find(s => s.id === scenarioId); if (!scenario) return prev; return [...prev, { ...scenario, selected: true }]; } }); }; // Stepper Configuration const steps = [ { id: 'setup', label: '1. 项目配置' }, { id: 'inventory', label: '2. 数据盘点' }, { id: 'context', label: '3. 背景调研' }, { id: 'value', label: '4. 价值挖掘' }, { id: 'delivery', label: '5. 成果交付' }, ]; const currentStepIndex = steps.findIndex(s => s.id === currentStep); return (
{/* Project Header */} {!isPresentationMode && (
{/* Back to Project List Navigation */}
setCurrentView('projects')}> 返回项目列表
PM
DA
+2
)} {/* Stepper */}
{steps.map((step, idx) => { const isActive = step.id === currentStep; const isCompleted = idx < currentStepIndex; return (
{ setCurrentStep(step.id as Step); // Reset inventory mode if returning to that step if (step.id === 'inventory' && inventoryMode === 'results') { // keep results } else if (step.id === 'inventory') { setInventoryMode('selection'); } }} className={`flex items-center cursor-pointer group ${idx === steps.length - 1 ? 'flex-none' : 'w-full'}`} >
{isCompleted ? : idx + 1}
{step.label} {idx !== steps.length - 1 && (
)}
); })}
{/* 演示模式退出按钮 */} {isPresentationMode && ( )} {/* Main Workspace Area */}
{currentStep === 'setup' && ( )} {currentStep === 'inventory' && ( )} {currentStep === 'context' && ( )} {currentStep === 'value' && ( )} {currentStep === 'delivery' && ( )}
); };