Spaces:
Build error
Build error
| import { useState, useEffect } from 'react' | |
| import { motion } from 'framer-motion' | |
| import { | |
| FaCode, FaDatabase, FaCloud, FaShieldAlt, FaChartLine, | |
| FaProjectDiagram, FaBug, FaRocket, FaUsers, FaClock, | |
| FaCheckCircle, FaExclamationTriangle, FaInfoCircle, | |
| FaArrowUp, FaArrowDown, FaMinus, FaTrendingUp, FaTrendingDown, | |
| FaFire, FaBolt, FaStar, FaHeart, FaThumbsUp, FaEye, | |
| FaDownload, FaUpload, FaSync, FaCog, FaBell, FaEnvelope, | |
| FaCalendar, FaMapMarkerAlt, FaGlobe, FaLink, FaShare, | |
| FaBookmark, FaFlag, FaTag, FaComments, FaMessage, | |
| FaRobot, FaBrain, FaMicrochip, FaMemory, FaServer, | |
| FaNetworkWired, FaWifi, FaEthernet, FaUsb, FaBluetooth, | |
| FaSatellite, FaSignal, FaRadio, FaBroadcastTower, FaPodcast | |
| } from 'react-icons/fa' | |
| export default function Dashboard({ language, theme }) { | |
| const [stats, setStats] = useState({ | |
| projects: 12, | |
| activeUsers: 245, | |
| codeLines: 125000, | |
| bugsFixed: 89, | |
| deployments: 34, | |
| uptime: 99.9 | |
| }) | |
| const [activities, setActivities] = useState([ | |
| { id: 1, type: 'deploy', message: 'Deployed to production', time: '2 min ago', icon: FaRocket }, | |
| { id: 2, type: 'bug', message: 'Fixed critical bug in auth module', time: '15 min ago', icon: FaBug }, | |
| { id: 3, type: 'code', message: 'Pushed 245 lines of code', time: '1 hour ago', icon: FaCode }, | |
| { id: 4, type: 'merge', message: 'Merged feature branch', time: '2 hours ago', icon: FaProjectDiagram }, | |
| { id: 5, type: 'test', message: 'All tests passed', time: '3 hours ago', icon: FaCheckCircle } | |
| ]) | |
| const [performance, setPerformance] = useState({ | |
| cpu: 45, | |
| memory: 62, | |
| disk: 38, | |
| network: 71 | |
| }) | |
| useEffect(() => { | |
| // Simulate real-time updates | |
| const interval = setInterval(() => { | |
| setPerformance(prev => ({ | |
| cpu: Math.max(0, Math.min(100, prev.cpu + (Math.random() - 0.5) * 10)), | |
| memory: Math.max(0, Math.min(100, prev.memory + (Math.random() - 0.5) * 8)), | |
| disk: Math.max(0, Math.min(100, prev.disk + (Math.random() - 0.5) * 5)), | |
| network: Math.max(0, Math.min(100, prev.network + (Math.random() - 0.5) * 15)) | |
| })) | |
| }, 3000) | |
| return () => clearInterval(interval) | |
| }, []) | |
| const getStatIcon = (key) => { | |
| const icons = { | |
| projects: FaProjectDiagram, | |
| activeUsers: FaUsers, | |
| codeLines: FaCode, | |
| bugsFixed: FaBug, | |
| deployments: FaRocket, | |
| uptime: FaCheckCircle | |
| } | |
| return icons[key] || FaChartLine | |
| } | |
| const getStatColor = (key) => { | |
| const colors = { | |
| projects: 'text-blue-400', | |
| activeUsers: 'text-green-400', | |
| codeLines: 'text-purple-400', | |
| bugsFixed: 'text-red-400', | |
| deployments: 'text-yellow-400', | |
| uptime: 'text-emerald-400' | |
| } | |
| return colors[key] || 'text-gray-400' | |
| } | |
| const getActivityIcon = (type) => { | |
| const icons = { | |
| deploy: FaRocket, | |
| bug: Fa |