import React, { useState, useEffect, useRef } from 'react'; import { format } from 'date-fns'; import { MessageCircle, Plus, Search, Edit, Trash2, Calendar, Users, Info, MessageSquare, Video, Phone, Building2, MoreHorizontal, Loader2, LayoutDashboard, Check, AlertCircle, PlusCircle, Briefcase, Filter, ChevronDown, CalendarIcon, X } from 'lucide-react'; import { Communication, ProjectApi, CommunicationUpdateRequest, CommunicationCreateRequest } from '../types'; import { getAllCommunications, createCommunication, updateCommunication, deleteCommunication, } from '../services/communicationApi'; // UI Components import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from '@/components/ui/card'; import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table'; import { Badge } from '@/components/ui/badge'; import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert'; import { Label } from '@/components/ui/label'; import { Textarea } from '@/components/ui/textarea'; import CustomDialog from '@/components/CustomDialog'; import Header from '@/components/layout/header'; import Sidebar from '@/components/layout/sidebar'; import { useIsMobile } from '@/hooks/use-mobile'; import { toast } from '@/lib/custom-toast'; import { Select as RadixSelect, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import { projectService } from '@/lib/api'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Calendar as CalendarComponent } from "@/components/ui/calendar"; import { cn } from "@/lib/utils"; import { useLocation, useNavigate } from 'react-router-dom'; import SlateRichTextEditor from "@/components/custom/SlateRichTextEditor"; // Mode icons mapping const getModeIcon = (mode: string) => { switch (mode.toLowerCase()) { case 'in-person': return ; case 'virtual': return