import React, { useState } from 'react'; import { Modal, Tabs, Progress, Tag, List, Avatar, Badge, Space, Button, Statistic, Row, Col, Timeline, Input, Form, DatePicker, Select } from 'antd'; import { CalendarOutlined, TeamOutlined, CheckCircleOutlined, ClockCircleOutlined, FlagOutlined, ExclamationCircleOutlined, EditOutlined, SaveOutlined, CloseOutlined } from '@ant-design/icons'; import { PhaseModalData, ProjectPhase, PhaseTask, PhaseMilestone } from '../../types/project-roadmap.types'; import { useAppSelector } from '../../hooks/useAppSelector'; import { themeWiseColor } from '../../utils/themeWiseColor'; import dayjs from 'dayjs'; const { TabPane } = Tabs; const { TextArea } = Input; interface PhaseModalProps { visible: boolean; phase: PhaseModalData | null; onClose: () => void; onUpdate?: (updates: Partial) => void; } const PhaseModal: React.FC = ({ visible, phase, onClose, onUpdate, }) => { const [isEditing, setIsEditing] = useState(false); const [form] = Form.useForm(); // Theme support const themeMode = useAppSelector(state => state.themeReducer.mode); const isDarkMode = themeMode === 'dark'; if (!phase) return null; const handleEdit = () => { setIsEditing(true); form.setFieldsValue({ name: phase.name, description: phase.description, startDate: dayjs(phase.startDate), endDate: dayjs(phase.endDate), status: phase.status, }); }; const handleSave = async () => { try { const values = await form.validateFields(); const updates: Partial = { name: values.name, description: values.description, startDate: values.startDate.toDate(), endDate: values.endDate.toDate(), status: values.status, }; onUpdate?.(updates); setIsEditing(false); } catch (error) { console.error('Validation failed:', error); } }; const handleCancel = () => { setIsEditing(false); form.resetFields(); }; const getStatusColor = (status: string) => { switch (status) { case 'completed': return 'success'; case 'in-progress': return 'processing'; case 'on-hold': return 'warning'; default: return 'default'; } }; const getPriorityColor = (priority: string) => { switch (priority) { case 'high': return 'red'; case 'medium': return 'orange'; case 'low': return 'green'; default: return 'default'; } }; const getTaskStatusIcon = (status: string) => { switch (status) { case 'done': return ; case 'in-progress': return ; default: return ; } }; return ( {isEditing ? ( ) : (

{phase.name}

)}
{isEditing ? ( <> ) : ( )} } open={visible} onCancel={onClose} width={800} footer={null} className="dark:bg-gray-800" >
{isEditing ? ( Description}>