'use client'; import React, { useMemo } from 'react'; import { X, ChevronRight, Image as ImageIcon, Video as VideoIcon, FileText, Mic, Bell, Star, Clock, Ban, ThumbsDown, Trash2 } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; import { formatPhone, getMediaUrl } from '../utils/inboxUtils'; import Avatar from './ui/Avatar'; import { Message } from '../types/inboxTypes'; interface ContactProfileProps { isOpen: boolean; chat: any; messages: Message[]; onClose: () => void; } const ContactProfile: React.FC = ({ isOpen, chat, messages, onClose, }) => { // Filter media messages const mediaMessages = useMemo(() => { return messages.filter(m => m.type === 'image' || m.type === 'video' || m.type === 'document' || m.type === 'audio'); }, [messages]); const photoVideos = mediaMessages.filter(m => m.type === 'image' || m.type === 'video'); const documents = mediaMessages.filter(m => m.type === 'document'); const audios = mediaMessages.filter(m => m.type === 'audio'); if (!chat) return null; return ( {isOpen && ( {/* Header */}

Dados do contato

{/* Content */}
{/* Profile Section */}
{/* Profile Photo */}

{chat.lead_name || chat.subject || formatPhone(chat.phone, chat.remote_jid)}

{formatPhone(chat.phone, chat.remote_jid)}

{chat.bio && (

{chat.bio}

)}
{/* Status (Bio) */}

Recado

{chat.bio || 'Sem recado disponível'}

{/* Media Section */}
{mediaMessages.length > 0 ? (
{photoVideos.slice(0, 3).map((m, i) => (
{ const url = getMediaUrl(m.media_url); if (url) window.open(url, '_blank'); }} >
{m.type === 'video' ? : }
))} {mediaMessages.length > 3 && (
+{mediaMessages.length - 3}
)}
) : (

Nenhuma mídia compartilhada

)}
{/* Actions Section */}
{[ { icon: Bell, label: 'Silenciar notificações', color: '#111b21' }, { icon: Star, label: 'Mensagens favoritas', color: '#111b21' }, { icon: Clock, label: 'Mensagens temporárias', sub: 'Desativadas', color: '#111b21' }, ].map((item, idx) => ( ))}
{[ { icon: Ban, label: `Bloquear ${chat.lead_name || 'Contato'}`, color: '#ea0038' }, { icon: ThumbsDown, label: `Denunciar ${chat.lead_name || 'Contato'}`, color: '#ea0038' }, { icon: Trash2, label: 'Apagar conversa', color: '#ea0038' } ].map((item, idx) => ( ))}
)}
); }; export default ContactProfile;