Spaces:
Running
Running
Upload components/PrivacyDashboard.jsx with huggingface_hub
Browse files- components/PrivacyDashboard.jsx +130 -0
components/PrivacyDashboard.jsx
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react'
|
| 2 |
+
import { Shield, EyeOff, Lock, Activity, AlertTriangle, CheckCircle } from 'lucide-react'
|
| 3 |
+
|
| 4 |
+
export default function PrivacyDashboard() {
|
| 5 |
+
const [securityMetrics, setSecurityMetrics] = useState({
|
| 6 |
+
encryptionLevel: 'AES-256',
|
| 7 |
+
threatsBlocked: 0,
|
| 8 |
+
dataProcessed: 0,
|
| 9 |
+
uptime: '100%'
|
| 10 |
+
})
|
| 11 |
+
|
| 12 |
+
const [recentActivities, setRecentActivities] = useState([])
|
| 13 |
+
|
| 14 |
+
useEffect(() => {
|
| 15 |
+
// Simulate real-time security updates
|
| 16 |
+
const interval = setInterval(() => {
|
| 17 |
+
setSecurityMetrics(prev => ({
|
| 18 |
+
...prev,
|
| 19 |
+
threatsBlocked: prev.threatsBlocked + Math.floor(Math.random() * 3),
|
| 20 |
+
dataProcessed: prev.dataProcessed + Math.floor(Math.random() * 10)
|
| 21 |
+
}))
|
| 22 |
+
|
| 23 |
+
setRecentActivities(prev => {
|
| 24 |
+
const newActivity = {
|
| 25 |
+
id: Date.now(),
|
| 26 |
+
action: ['Threat detected', 'Data encrypted', 'Access logged'][Math.floor(Math.random() * 3)],
|
| 27 |
+
timestamp: new Date().toLocaleTimeString(),
|
| 28 |
+
status: 'secured'
|
| 29 |
+
}
|
| 30 |
+
return [newActivity, ...prev.slice(0, 4)]
|
| 31 |
+
})
|
| 32 |
+
}, 5000)
|
| 33 |
+
|
| 34 |
+
return () => clearInterval(interval)
|
| 35 |
+
}, [])
|
| 36 |
+
|
| 37 |
+
return (
|
| 38 |
+
<div className="card">
|
| 39 |
+
<h2 className="text-2xl font-bold mb-6 flex items-center">
|
| 40 |
+
<Shield className="mr-2 h-6 w-6 text-primary-500" />
|
| 41 |
+
Privacy & Security
|
| 42 |
+
</h2>
|
| 43 |
+
|
| 44 |
+
<div className="grid grid-cols-2 gap-4 mb-6">
|
| 45 |
+
<div className="p-4 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800">
|
| 46 |
+
<div className="flex items-center justify-between mb-1">
|
| 47 |
+
<Lock className="h-4 w-4 text-green-600 dark:text-green-400" />
|
| 48 |
+
<span className="text-xs text-green-700 dark:text-green-300">ACTIVE</span>
|
| 49 |
+
</div>
|
| 50 |
+
<p className="text-lg font-semibold">{securityMetrics.encryptionLevel}</p>
|
| 51 |
+
<p className="text-xs text-green-700 dark:text-green-300">Encryption</p>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div className="p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800">
|
| 55 |
+
<div className="flex items-center justify-between mb-1">
|
| 56 |
+
<EyeOff className="h-4 w-4 text-blue-600 dark:text-blue-400" />
|
| 57 |
+
<span className="text-xs text-blue-700 dark:text-blue-300">LIVE</span>
|
| 58 |
+
</div>
|
| 59 |
+
<p className="text-lg font-semibold">{securityMetrics.uptime}</p>
|
| 60 |
+
<p className="text-xs text-blue-700 dark:text-blue-300">Uptime</p>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<div className="p-4 bg-orange-50 dark:bg-orange-900/20 rounded-lg border border-orange-200 dark:border-orange-800">
|
| 64 |
+
<div className="flex items-center justify-between mb-1">
|
| 65 |
+
<AlertTriangle className="h-4 w-4 text-orange-600 dark:text-orange-400" />
|
| 66 |
+
<span className="text-xs text-orange-700 dark:text-orange-300">BLOCKED</span>
|
| 67 |
+
</div>
|
| 68 |
+
<p className="text-lg font-semibold">{securityMetrics.threatsBlocked}</p>
|
| 69 |
+
<p className="text-xs text-orange-700 dark:text-orange-300">Threats</p>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<div className="p-4 bg-purple-50 dark:bg-purple-900/20 rounded-lg border border-purple-200 dark:border-purple-800">
|
| 73 |
+
<div className="flex items-center justify-between mb-1">
|
| 74 |
+
<Activity className="h-4 w-4 text-purple-600 dark:text-purple-400" />
|
| 75 |
+
<span className="text-xs text-purple-700 dark:text-purple-300">PROCESSED</span>
|
| 76 |
+
</div>
|
| 77 |
+
<p className="text-lg font-semibold">{securityMetrics.dataProcessed}</p>
|
| 78 |
+
<p className="text-xs text-purple-700 dark:text-purple-300">Data Units</p>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
|
| 82 |
+
<div className="border-t border-dark-200 dark:border-dark-700 pt-4">
|
| 83 |
+
<h3 className="font-semibold mb-3 flex items-center">
|
| 84 |
+
<Activity className="h-4 w-4 mr-2" />
|
| 85 |
+
Security Activity
|
| 86 |
+
</h3>
|
| 87 |
+
<div className="space-y-2">
|
| 88 |
+
{recentActivities.length === 0 ? (
|
| 89 |
+
<p className="text-sm text-dark-500 dark:text-dark-400">No recent activity</p>
|
| 90 |
+
) : (
|
| 91 |
+
recentActivities.map((activity) => (
|
| 92 |
+
<div
|
| 93 |
+
key={activity.id}
|
| 94 |
+
className="flex items-center justify-between p-2 bg-dark-50 dark:bg-dark-800 rounded border border-dark-200 dark:border-dark-700"
|
| 95 |
+
>
|
| 96 |
+
<div className="flex items-center space-x-2">
|
| 97 |
+
<CheckCircle className="h-3 w-3 text-green-500" />
|
| 98 |
+
<span className="text-sm">{activity.action}</span>
|
| 99 |
+
</div>
|
| 100 |
+
<span className="text-xs text-dark-500 dark:text-dark-400">{activity.timestamp}</span>
|
| 101 |
+
</div>
|
| 102 |
+
))
|
| 103 |
+
)}
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<div className="mt-6 p-4 bg-dark-50 dark:bg-dark-800 rounded-lg border border-dark-200 dark:border-dark-700">
|
| 108 |
+
<h3 className="font-semibold mb-2 text-sm">Privacy Guarantee</h3>
|
| 109 |
+
<ul className="space-y-1 text-xs text-dark-600 dark:text-dark-400">
|
| 110 |
+
<li className="flex items-center space-x-2">
|
| 111 |
+
<CheckCircle className="h-3 w-3 text-green-500" />
|
| 112 |
+
<span>End-to-end encryption</span>
|
| 113 |
+
</li>
|
| 114 |
+
<li className="flex items-center space-x-2">
|
| 115 |
+
<CheckCircle className="h-3 w-3 text-green-500" />
|
| 116 |
+
<span>Zero data retention</span>
|
| 117 |
+
</li>
|
| 118 |
+
<li className="flex items-center space-x-2">
|
| 119 |
+
<CheckCircle className="h-3 w-3 text-green-500" />
|
| 120 |
+
<span>Local processing priority</span>
|
| 121 |
+
</li>
|
| 122 |
+
<li className="flex items-center space-x-2">
|
| 123 |
+
<CheckCircle className="h-3 w-3 text-green-500" />
|
| 124 |
+
<span>Anonymous usage tracking</span>
|
| 125 |
+
</li>
|
| 126 |
+
</ul>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
)
|
| 130 |
+
}
|