T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.quebec/private_html/src/components/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/private_html/src/components/TeamPrivateChat.tsx
import React, { useState, useEffect } from 'react';
import { X, Send, User } from 'lucide-react';

interface TeamPrivateChatProps {
  member: {
    id: string;
    user: {
      id: string;
      name: string;
      email: string;
      role: string;
    };
  };
  currentUser: {
    id: string;
    name: string;
    email: string;
  };
  onClose: () => void;
}

interface Message {
  id: string;
  content: string;
  senderId: string;
  senderName: string;
  timestamp: Date;
}

const TeamPrivateChat: React.FC<TeamPrivateChatProps> = ({ member, currentUser, onClose }) => {
  const [messages, setMessages] = useState<Message[]>([]);
  const [newMessage, setNewMessage] = useState('');
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    // Load initial messages
    loadMessages();
  }, [member.user.id, currentUser.id]);

  const loadMessages = async () => {
    try {
      // In a real app, this would fetch messages between current user and team member
      // For now, we'll simulate some messages
      const mockMessages: Message[] = [
        {
          id: '1',
          content: `Hi ${currentUser.name}, regarding the Bordeaux case - do you have the updated witness statements?
          senderId: member.user.id,
          senderName: member.user.name,
          timestamp: new Date(Date.now() - 60000 * 30) // 30 minutes ago
        },
        {
          id: '2',
          content: 'Yes, I have them. I\'ll send them over shortly.',
          senderId: currentUser.id,
          senderName: currentUser.name,
          timestamp: new Date(Date.now() - 60000 * 15) // 15 minutes ago
        }
      ];
      setMessages(mockMessages);
    } catch (error) {
      } finally {
      setLoading(false);
    }
  };

  const sendMessage = async () => {
    if (!newMessage.trim()) return;

    const message: Message = {
      id: Date.now().toString(),
      content: newMessage,
      senderId: currentUser.id,
      senderName: currentUser.name,
      timestamp: new Date()
    };

    setMessages(prev => [...prev, message]);
    setNewMessage('');

    // In a real app, this would send the message to the backend
    try {
      // await fetch('/api/messages/send', { ... });
    } catch (error) {
      }
  };

  return (
    <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50">
      <div className="bg-white rounded-lg shadow-xl w-full max-w-md h-96 flex flex-col">
        {/* Header */}
        <div className="p-4 border-b border-gray-200 flex items-center justify-between">
          <div className="flex items-center space-x-3">
            <div className="w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center">
              <User className="h-4 w-4 text-white" />
            </div>
            <div>
              <h3 className="font-medium text-gray-900">{member.user.name}</h3>
              <p className="text-xs text-gray-500">{member.user.role}</p>
            </div>
          </div>
          <button
            onClick={onClose}
            className="text-gray-400 hover:text-gray-600"
          >
            <X className="h-5 w-5" />
          </button>
        </div>

        {/* Messages */}
        <div className="flex-1 p-4 overflow-y-auto space-y-3">
          {loading ? (
            <div className="text-center text-gray-500">Loading messages...</div>
          ) : messages.length === 0 ? (
            <div className="text-center text-gray-500">No messages yet</div>
          ) : (
            messages.map((message) => (
              <div
                key={message.id}
                className={`flex ${message.senderId === currentUser.id ? 'justify-end' : 'justify-start'}
              >
                <div
                  className={
                    message.senderId === currentUser.id
                      ? 'bg-blue-600 text-white'
                      : 'bg-gray-100 text-gray-900'
                  }
                >
                  <p className="text-sm">{message.content}</p>
                  <p className={
                    message.senderId === currentUser.id ? 'text-blue-200' : 'text-gray-500'
                  }
                    {message.timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
                  </p>
                </div>
              </div>
            ))
          )}
        </div>

        {/* Message Input */}
        <div className="p-4 border-t border-gray-200">
          <div className="flex space-x-2">
            <input
              type="text"
              value={newMessage}
              onChange={(e) => setNewMessage(e.target.value)}
              onKeyPress={(e) => e.key === 'Enter' && sendMessage()}
              placeholder="Type a message..."
              className="flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
            />
            <button
              onClick={sendMessage}
              disabled={!newMessage.trim()}
              className="bg-blue-600 text-white p-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"
            >
              <Send className="h-4 w-4" />
            </button>
          </div>
        </div>
      </div>
    </div>
  );
};

export default TeamPrivateChat; 

CasperSecurity Mini