"use client"; import React, { useState, useEffect } from 'react'; import { MessageCircle, Send, X, Minimize2, Maximize2, Monitor, Terminal, Cpu, HardDrive, ChevronUp, ChevronDown } from 'lucide-react'; import { ResizableHandle, ResizablePanel, ResizablePanelGroup, } from "@/components/ui/resizable"; const Footer = ({ className = "", shortcuts }) => { const [messages, setMessages] = useState([]); const [inputValue, setInputValue] = useState(''); const [isMobile, setIsMobile] = useState(false); const [currentTime, setCurrentTime] = useState(new Date()); const [isMaximized, setIsMaximized] = useState(false); const [isMinimized, setIsMinimized] = useState(false); useEffect(() => { const checkMobile = () => { setIsMobile(window.innerWidth < 768); }; checkMobile(); window.addEventListener('resize', checkMobile); const timer = setInterval(() => { setCurrentTime(new Date()); }, 1000); return () => { window.removeEventListener('resize', checkMobile); clearInterval(timer); }; }, []); const defaultShortcuts = [ [ { key: "F1", label: "Help", action: () => addSystemMessage("F1: Help system activated") }, { key: "F2", label: "Save", action: () => addSystemMessage("F2: Save operation") }, { key: "F3", label: "Search", action: () => addSystemMessage("F3: Search mode") }, { key: "F4", label: "Edit", action: () => addSystemMessage("F4: Edit mode") }, { key: "F5", label: "Refresh", action: () => addSystemMessage("F5: System refresh") }, { key: "F6", label: "Copy", action: () => addSystemMessage("F6: Copy operation") }, { key: "F7", label: "use client", action: () => addSystemMessage("F7: use client operation") }, { key: "F8", label: "Delete", action: () => addSystemMessage("F8: Delete operation") }, { key: "F9", label: "Menu", action: () => addSystemMessage("F9: Menu opened") }, { key: "F10", label: "Exit", action: () => addSystemMessage("F10: Exit requested") }, ], [ { key: "Ctrl+N", label: "New", action: () => addSystemMessage("New file created") }, { key: "Ctrl+O", label: "Open", action: () => addSystemMessage("Open file dialog") }, { key: "Ctrl+S", label: "Save", action: () => addSystemMessage("File saved") }, { key: "Ctrl+P", label: "Print", action: () => addSystemMessage("Print dialog") }, { key: "Ctrl+X", label: "Cut", action: () => addSystemMessage("Cut to clipboard") }, { key: "Ctrl+C", label: "Copy", action: () => addSystemMessage("Copied to clipboard") }, { key: "Ctrl+V", label: "Paste", action: () => addSystemMessage("Pasted from clipboard") }, { key: "Ctrl+Z", label: "Undo", action: () => addSystemMessage("Undo last action") }, { key: "Ctrl+Y", label: "Redo", action: () => addSystemMessage("Redo last action") }, { key: "Ctrl+A", label: "Select", action: () => addSystemMessage("Select all") }, ] ]; const shortcutGroups = shortcuts || defaultShortcuts; const addSystemMessage = (text) => { setMessages(prev => [...prev, { text, sender: 'system', timestamp: new Date() }]); }; const handleSendMessage = () => { if (inputValue.trim() !== '') { const userMessage = { text: inputValue, sender: 'user', timestamp: new Date() }; setMessages(prev => [...prev, userMessage]); setInputValue(''); setTimeout(() => { const responses = [ "SYSTEM: Command processed successfully", "ASSISTANT: Processing your request...", "BOT: I understand your query. How can I assist further?", "SYSTEM: Operation completed. Status: OK", "ASSISTANT: Ready for next command", ]; const randomResponse = responses[Math.floor(Math.random() * responses.length)]; setMessages(prev => [...prev, { text: randomResponse, sender: 'bot', timestamp: new Date() }]); }, 800); } }; const handleKeyPress = (e) => { if (e.key === 'Enter') { handleSendMessage(); } }; const toggleMaximize = () => { if (isMinimized) { setIsMinimized(false); } setIsMaximized(!isMaximized); }; const toggleMinimize = () => { setIsMinimized(!isMinimized); if (isMaximized) { setIsMaximized(false); } }; const formatTime = (date) => { return date.toLocaleTimeString('en-US', { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' }); }; const formatShortcutKey = (key) => { const parts = key.split(/(\+)/); return parts.map((part, index) => { if (part === '+') { return part; } return {part}; }); }; const getContainerHeight = () => { if (isMinimized) return 'h-4'; if (isMaximized) return 'h-screen fixed inset-0 z-50 bg-background'; return isMobile ? 'h-64' : 'h-40'; }; const scrollbarStyles = ` /* Webkit browsers */ ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: 4px; } ::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.3); border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.1); } ::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 128, 0.5); } /* Firefox */ * { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 128, 0.3) rgba(0, 0, 0, 0.1); } `; if (isMobile) { return ( <>