santiagr7776 commited on
Commit
a53291d
·
verified ·
1 Parent(s): e0bb169

Upload components/HeliosDashboard.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/HeliosDashboard.jsx +149 -0
components/HeliosDashboard.jsx ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState, useEffect } from 'react';
2
+ import { Activity, TrendingUp, Shield, Globe, Zap, RefreshCw, Clock } from 'lucide-react';
3
+ import Link from 'next/link';
4
+ import axios from 'axios';
5
+
6
+ export default function HeliosDashboard() {
7
+ const [metrics, setMetrics] = useState([
8
+ { id: '1', label: 'Active Verifications', value: '0', change: 0, icon: Activity, color: 'text-primary-600' },
9
+ { id: '2', label: 'Threat Level', value: 'Low', change: -5, icon: Shield, color: 'text-truth-600' },
10
+ { id: '3', label: 'API Status', value: 'Online', change: 0, icon: Zap, color: 'text-warning-600' },
11
+ { id: '4', label: 'Data Sources', value: '12', change: 2, icon: Globe, color: 'text-helios-600' },
12
+ ]);
13
+ const [lastUpdate, setLastUpdate] = useState(new Date());
14
+ const [loading, setLoading] = useState(false);
15
+
16
+ const fetchMetrics = async () => {
17
+ setLoading(true);
18
+ try {
19
+ await axios.get('/api/bls');
20
+ setMetrics(prev => prev.map(m => ({
21
+ ...m,
22
+ value: m.id === '1' ? Math.floor(Math.random() * 1000).toString() : m.value
23
+ })));
24
+ setLastUpdate(new Date());
25
+ } catch (error) {
26
+ console.error('Failed to fetch metrics:', error);
27
+ } finally {
28
+ setLoading(false);
29
+ }
30
+ };
31
+
32
+ useEffect(() => {
33
+ fetchMetrics();
34
+ const interval = setInterval(fetchMetrics, 300000);
35
+ return () => clearInterval(interval);
36
+ }, []);
37
+
38
+ const quickActions = [
39
+ { label: 'New Verification', href: '/verify', color: 'bg-primary-600 hover:bg-primary-700' },
40
+ { label: 'Generate Content', href: '/generate', color: 'bg-helios-600 hover:bg-helios-700' },
41
+ { label: 'View Threats', href: '/shield', color: 'bg-danger-600 hover:bg-danger-700' },
42
+ { label: 'Analytics', href: '/deploy', color: 'bg-truth-600 hover:bg-truth-700' },
43
+ ];
44
+
45
+ return (
46
+ <div className="min-h-screen p-4 sm:p-6 lg:p-8">
47
+ <div className="max-w-7xl mx-auto space-y-6">
48
+ <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
49
+ <div>
50
+ <h1 className="text-3xl font-bold text-slate-900 dark:text-white">Command Center</h1>
51
+ <p className="text-slate-600 dark:text-slate-400">Truth Anchor v11.1 Dashboard</p>
52
+ </div>
53
+ <div className="flex items-center space-x-3">
54
+ <span className="text-sm text-slate-500">Updated: {lastUpdate.toLocaleTimeString()}</span>
55
+ <button
56
+ onClick={fetchMetrics}
57
+ disabled={loading}
58
+ className="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors"
59
+ >
60
+ <RefreshCw className={`w-5 h-5 text-slate-600 dark:text-slate-400 ${loading ? 'animate-spin' : ''}`} />
61
+ </button>
62
+ </div>
63
+ </div>
64
+
65
+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
66
+ {metrics.map((metric, index) => {
67
+ const Icon = metric.icon;
68
+ return (
69
+ <div
70
+ key={metric.id}
71
+ className="card group cursor-pointer animate-fade-in"
72
+ style={{ animationDelay: `${index * 100}ms` }}
73
+ >
74
+ <div className="flex items-center justify-between mb-4">
75
+ <div className={`p-3 rounded-lg bg-slate-100 dark:bg-slate-700 ${metric.color}`}>
76
+ <Icon className="w-6 h-6" />
77
+ </div>
78
+ <span className={`text-sm font-medium ${
79
+ metric.change > 0 ? 'text-truth-600' : metric.change < 0 ? 'text-danger-600' : 'text-slate-500'
80
+ }`}>
81
+ {metric.change > 0 ? '+' : ''}{metric.change}%
82
+ </span>
83
+ </div>
84
+ <h3 className="text-2xl font-bold text-slate-900 dark:text-white">{metric.value}</h3>
85
+ <p className="text-sm text-slate-600 dark:text-slate-400">{metric.label}</p>
86
+ </div>
87
+ );
88
+ })}
89
+ </div>
90
+
91
+ <div className="grid grid-cols-2 lg:grid-cols-4 gap-4 animate-slide-up" style={{ animationDelay: '400ms' }}>
92
+ {quickActions.map((action) => (
93
+ <Link
94
+ key={action.label}
95
+ href={action.href}
96
+ className={`${action.color} text-white p-4 rounded-xl font-medium transform hover:scale-105 transition-all duration-200 shadow-lg hover:shadow-xl text-center`}
97
+ >
98
+ {action.label}
99
+ </Link>
100
+ ))}
101
+ </div>
102
+
103
+ <div className="card animate-slide-up" style={{ animationDelay: '500ms' }}>
104
+ <div className="flex items-center space-x-2 mb-4">
105
+ <Activity className="w-5 h-5 text-primary-600" />
106
+ <h2 className="text-lg font-semibold text-slate-900 dark:text-white">System Status</h2>
107
+ </div>
108
+ <div className="space-y-3">
109
+ {[
110
+ { name: 'BLS Data Feed', status: 'Operational', color: 'bg-truth-500' },
111
+ { name: 'AI Inference APIs', status: 'Operational', color: 'bg-truth-500' },
112
+ { name: 'Web Search (Tavily)', status: 'Operational', color: 'bg-truth-500' },
113
+ { name: 'X/Twitter Stream', status: 'Degraded', color: 'bg-warning-500' },
114
+ ].map((service) => (
115
+ <div
116
+ key={service.name}
117
+ className="flex items-center justify-between p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg"
118
+ >
119
+ <span className="text-slate-700 dark:text-slate-300">{service.name}</span>
120
+ <div className="flex items-center space-x-2">
121
+ <div className={`w-2 h-2 rounded-full ${service.color} animate-pulse`} />
122
+ <span className="text-sm text-slate-600 dark:text-slate-400">{service.status}</span>
123
+ </div>
124
+ </div>
125
+ ))}
126
+ </div>
127
+ </div>
128
+
129
+ <div className="card animate-slide-up" style={{ animationDelay: '600ms' }}>
130
+ <h2 className="text-lg font-semibold text-slate-900 dark:text-white mb-4">Quick Start Guide</h2>
131
+ <div className="grid md:grid-cols-2 gap-4">
132
+ <div className="p-4 bg-primary-50 dark:bg-primary-900/20 rounded-lg">
133
+ <h3 className="font-medium text-primary-700 dark:text-primary-300 mb-2">Verification</h3>
134
+ <p className="text-sm text-slate-600 dark:text-slate-400">
135
+ Verify claims, fact-check information, and analyze content with AI-powered multi-model consensus.
136
+ </p>
137
+ </div>
138
+ <div className="p-4 bg-helios-50 dark:bg-helios-900/20 rounded-lg">
139
+ <h3 className="font-medium text-helios-700 dark:text-helios-300 mb-2">Generation</h3>
140
+ <p className="text-sm text-slate-600 dark:text-slate-400">
141
+ Create content, strategies, and narratives with customizable tone and style options.
142
+ </p>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </div>
148
+ );
149
+ }