Spaces:
Build error
Build error
Mehdi commited on
Upload components/Dashboard.jsx with huggingface_hub
Browse files- components/Dashboard.jsx +83 -0
components/Dashboard.jsx
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react'
|
| 2 |
+
import { motion } from 'framer-motion'
|
| 3 |
+
import {
|
| 4 |
+
FaCode, FaDatabase, FaCloud, FaShieldAlt, FaChartLine,
|
| 5 |
+
FaProjectDiagram, FaBug, FaRocket, FaUsers, FaClock,
|
| 6 |
+
FaCheckCircle, FaExclamationTriangle, FaInfoCircle,
|
| 7 |
+
FaArrowUp, FaArrowDown, FaMinus, FaTrendingUp, FaTrendingDown,
|
| 8 |
+
FaFire, FaBolt, FaStar, FaHeart, FaThumbsUp, FaEye,
|
| 9 |
+
FaDownload, FaUpload, FaSync, FaCog, FaBell, FaEnvelope,
|
| 10 |
+
FaCalendar, FaMapMarkerAlt, FaGlobe, FaLink, FaShare,
|
| 11 |
+
FaBookmark, FaFlag, FaTag, FaComments, FaMessage,
|
| 12 |
+
FaRobot, FaBrain, FaMicrochip, FaMemory, FaServer,
|
| 13 |
+
FaNetworkWired, FaWifi, FaEthernet, FaUsb, FaBluetooth,
|
| 14 |
+
FaSatellite, FaSignal, FaRadio, FaBroadcastTower, FaPodcast
|
| 15 |
+
} from 'react-icons/fa'
|
| 16 |
+
|
| 17 |
+
export default function Dashboard({ language, theme }) {
|
| 18 |
+
const [stats, setStats] = useState({
|
| 19 |
+
projects: 12,
|
| 20 |
+
activeUsers: 245,
|
| 21 |
+
codeLines: 125000,
|
| 22 |
+
bugsFixed: 89,
|
| 23 |
+
deployments: 34,
|
| 24 |
+
uptime: 99.9
|
| 25 |
+
})
|
| 26 |
+
|
| 27 |
+
const [activities, setActivities] = useState([
|
| 28 |
+
{ id: 1, type: 'deploy', message: 'Deployed to production', time: '2 min ago', icon: FaRocket },
|
| 29 |
+
{ id: 2, type: 'bug', message: 'Fixed critical bug in auth module', time: '15 min ago', icon: FaBug },
|
| 30 |
+
{ id: 3, type: 'code', message: 'Pushed 245 lines of code', time: '1 hour ago', icon: FaCode },
|
| 31 |
+
{ id: 4, type: 'merge', message: 'Merged feature branch', time: '2 hours ago', icon: FaProjectDiagram },
|
| 32 |
+
{ id: 5, type: 'test', message: 'All tests passed', time: '3 hours ago', icon: FaCheckCircle }
|
| 33 |
+
])
|
| 34 |
+
|
| 35 |
+
const [performance, setPerformance] = useState({
|
| 36 |
+
cpu: 45,
|
| 37 |
+
memory: 62,
|
| 38 |
+
disk: 38,
|
| 39 |
+
network: 71
|
| 40 |
+
})
|
| 41 |
+
|
| 42 |
+
useEffect(() => {
|
| 43 |
+
// Simulate real-time updates
|
| 44 |
+
const interval = setInterval(() => {
|
| 45 |
+
setPerformance(prev => ({
|
| 46 |
+
cpu: Math.max(0, Math.min(100, prev.cpu + (Math.random() - 0.5) * 10)),
|
| 47 |
+
memory: Math.max(0, Math.min(100, prev.memory + (Math.random() - 0.5) * 8)),
|
| 48 |
+
disk: Math.max(0, Math.min(100, prev.disk + (Math.random() - 0.5) * 5)),
|
| 49 |
+
network: Math.max(0, Math.min(100, prev.network + (Math.random() - 0.5) * 15))
|
| 50 |
+
}))
|
| 51 |
+
}, 3000)
|
| 52 |
+
|
| 53 |
+
return () => clearInterval(interval)
|
| 54 |
+
}, [])
|
| 55 |
+
|
| 56 |
+
const getStatIcon = (key) => {
|
| 57 |
+
const icons = {
|
| 58 |
+
projects: FaProjectDiagram,
|
| 59 |
+
activeUsers: FaUsers,
|
| 60 |
+
codeLines: FaCode,
|
| 61 |
+
bugsFixed: FaBug,
|
| 62 |
+
deployments: FaRocket,
|
| 63 |
+
uptime: FaCheckCircle
|
| 64 |
+
}
|
| 65 |
+
return icons[key] || FaChartLine
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
const getStatColor = (key) => {
|
| 69 |
+
const colors = {
|
| 70 |
+
projects: 'text-blue-400',
|
| 71 |
+
activeUsers: 'text-green-400',
|
| 72 |
+
codeLines: 'text-purple-400',
|
| 73 |
+
bugsFixed: 'text-red-400',
|
| 74 |
+
deployments: 'text-yellow-400',
|
| 75 |
+
uptime: 'text-emerald-400'
|
| 76 |
+
}
|
| 77 |
+
return colors[key] || 'text-gray-400'
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
const getActivityIcon = (type) => {
|
| 81 |
+
const icons = {
|
| 82 |
+
deploy: FaRocket,
|
| 83 |
+
bug: Fa
|