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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react';
|
| 2 |
+
import { useRouter } from 'next/router';
|
| 3 |
+
import { motion } from 'framer-motion';
|
| 4 |
+
import { Activity, Shield, Zap, Globe, RefreshCw, Gavel, Search, MessageSquareQuote, TrendingUp, Clock } from 'lucide-react';
|
| 5 |
+
|
| 6 |
+
export default function CommandCenter() {
|
| 7 |
+
const router = useRouter();
|
| 8 |
+
const [metrics, setMetrics] = useState([
|
| 9 |
+
{ id: '1', label: 'Active Sessions', value: '0', change: 0, icon: Activity, color: 'text-primary-600', bgColor: 'bg-primary-100 dark:bg-primary-900/30' },
|
| 10 |
+
{ id: '2', label: 'Threat Level', value: 'Low', change: -5, icon: Shield, color: 'text-truth-600', bgColor: 'bg-truth-100 dark:bg-truth-900/30' },
|
| 11 |
+
{ id: '3', label: 'API Status', value: 'Online', change: 0, icon: Zap, color: 'text-warning-600', bgColor: 'bg-warning-100 dark:bg-warning-900/30' },
|
| 12 |
+
{ id: '4', label: 'Data Sources', value: '12', change: 2, icon: Globe, color: 'text-helios-600', bgColor: 'bg-helios-100 dark:bg-helios-900/30' },
|
| 13 |
+
]);
|
| 14 |
+
const [lastUpdate, setLastUpdate] = useState(new Date());
|
| 15 |
+
const [loading, setLoading] = useState(false);
|
| 16 |
+
|
| 17 |
+
const fetchMetrics = async () => {
|
| 18 |
+
setLoading(true);
|
| 19 |
+
setTimeout(() => {
|
| 20 |
+
setMetrics(prev => prev.map(m => ({
|
| 21 |
+
...m,
|
| 22 |
+
value: m.id === '1' ? Math.floor(Math.random() * 100).toString() : m.value
|
| 23 |
+
})));
|
| 24 |
+
setLastUpdate(new Date());
|
| 25 |
+
setLoading(false);
|
| 26 |
+
}, 500);
|
| 27 |
+
};
|
| 28 |
+
|
| 29 |
+
useEffect(() => {
|
| 30 |
+
fetchMetrics();
|
| 31 |
+
}, []);
|
| 32 |
+
|
| 33 |
+
const quickActions = [
|
| 34 |
+
{ label: 'Strategic Advisor', section: 'advisor', color: 'bg-helios-600 hover:bg-helios-700', icon: Gavel },
|
| 35 |
+
{ label: 'Analyze Data', section: 'analyze', color: 'bg-primary-600 hover:bg-primary-700', icon: MessageSquareQuote },
|
| 36 |
+
{ label: 'Verify Claims', section: 'verify', color: 'bg-truth-600 hover:bg-truth-700', icon: Search },
|
| 37 |
+
];
|
| 38 |
+
|
| 39 |
+
const systemStatus = [
|
| 40 |
+
{ name: 'AI Inference APIs', status: 'Operational', color: 'bg-truth-500' },
|
| 41 |
+
{ name: 'Strategic Engine', status: 'Operational', color: 'bg-truth-500' },
|
| 42 |
+
{ name: 'Data Pipeline', status: 'Operational', color: 'bg-truth-500' },
|
| 43 |
+
{ name: 'External Feeds', status: 'Degraded', color: 'bg-warning-500' },
|
| 44 |
+
];
|
| 45 |
+
|
| 46 |
+
return (
|
| 47 |
+
<div className="max-w-7xl mx-auto space-y-6 pb-12">
|
| 48 |
+
<motion.div
|
| 49 |
+
initial={{ opacity: 0, y: -20 }}
|
| 50 |
+
animate={{ opacity: 1, y: 0 }}
|
| 51 |
+
className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"
|
| 52 |
+
>
|
| 53 |
+
<div>
|
| 54 |
+
<h1 className="text-3xl font-bold text-slate-900 dark:text-white">Command Center</h1>
|
| 55 |
+
<p className="text-slate-600 dark:text-slate-400">Truth Anchor v11.2 Dashboard</p>
|
| 56 |
+
</div>
|
| 57 |
+
<div className="flex items-center space-x-3">
|
| 58 |
+
<Clock className="w-4 h-4 text-slate-400" />
|
| 59 |
+
<span className="text-sm text-slate-500">Updated: {lastUpdate.toLocaleTimeString()}</span>
|
| 60 |
+
<button
|
| 61 |
+
onClick={fetchMetrics}
|
| 62 |
+
disabled={loading}
|
| 63 |
+
className="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors"
|
| 64 |
+
>
|
| 65 |
+
<RefreshCw className={`w-5 h-5 text-slate-600 dark:text-slate-400 ${loading ? 'animate-spin' : ''}`} />
|
| 66 |
+
</button>
|
| 67 |
+
</div>
|
| 68 |
+
</motion.div>
|
| 69 |
+
|
| 70 |
+
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
| 71 |
+
{metrics.map((metric, index) => {
|
| 72 |
+
const Icon = metric.icon;
|
| 73 |
+
return (
|
| 74 |
+
<motion.div
|
| 75 |
+
key={metric.id}
|
| 76 |
+
initial={{ opacity: 0, y: 20 }}
|
| 77 |
+
animate={{ opacity: 1, y: 0 }}
|
| 78 |
+
transition={{ delay: index * 0.1 }}
|
| 79 |
+
className="card group cursor-pointer"
|
| 80 |
+
>
|
| 81 |
+
<div className="flex items-center justify-between mb-4">
|
| 82 |
+
<div className={`p-3 rounded-lg ${metric.bgColor} ${metric.color}`}>
|
| 83 |
+
<Icon className="w-6 h-6" />
|
| 84 |
+
</div>
|
| 85 |
+
<span className={`text-sm font-medium ${
|
| 86 |
+
metric.change > 0 ? 'text-truth-600' : metric.change < 0 ? 'text-danger-600' : 'text-slate-500'
|
| 87 |
+
}`}>
|
| 88 |
+
{metric.change > 0 ? '+' : ''}{metric.change}%
|
| 89 |
+
</span>
|
| 90 |
+
</div>
|
| 91 |
+
<h3 className="text-2xl font-bold text-slate-900 dark:text-white">{metric.value}</h3>
|
| 92 |
+
<p className="text-sm text-slate-600 dark:text-slate-400">{metric.label}</p>
|
| 93 |
+
</motion.div>
|
| 94 |
+
);
|
| 95 |
+
})}
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<motion.div
|
| 99 |
+
initial={{ opacity: 0, y: 20 }}
|
| 100 |
+
animate={{ opacity: 1, y: 0 }}
|
| 101 |
+
transition={{ delay: 0.4 }}
|
| 102 |
+
className="grid grid-cols-1 md:grid-cols-3 gap-4"
|
| 103 |
+
>
|
| 104 |
+
{quickActions.map((action, index) => {
|
| 105 |
+
const Icon = action.icon;
|
| 106 |
+
return (
|
| 107 |
+
<button
|
| 108 |
+
key={action.label}
|
| 109 |
+
onClick={() => router.push(`/?section=${action.section}`)}
|
| 110 |
+
className={`${action.color} text-white p-6 rounded-xl font-medium transform hover:scale-105 transition-all duration-200 shadow-lg hover:shadow-xl text-center flex flex-col items-center gap-3`}
|
| 111 |
+
>
|
| 112 |
+
<Icon className="w-8 h-8" />
|
| 113 |
+
<span className="text-lg">{action.label}</span>
|
| 114 |
+
</button>
|
| 115 |
+
);
|
| 116 |
+
})}
|
| 117 |
+
</motion.div>
|
| 118 |
+
|
| 119 |
+
<motion.div
|
| 120 |
+
initial={{ opacity: 0, y: 20 }}
|
| 121 |
+
animate={{ opacity: 1, y: 0 }}
|
| 122 |
+
transition={{ delay: 0.5 }}
|
| 123 |
+
className="card"
|
| 124 |
+
>
|
| 125 |
+
<div className="flex items-center space-x-2 mb-4">
|
| 126 |
+
<Activity className="w-5 h-5 text-primary-600" />
|
| 127 |
+
<h2 className="text-lg font-semibold text-slate-900 dark:text-white">System Status</h2>
|
| 128 |
+
</div>
|
| 129 |
+
<div className="space-y-3">
|
| 130 |
+
{systemStatus.map((service) => (
|
| 131 |
+
<div
|
| 132 |
+
key={service.name}
|
| 133 |
+
className="flex items-center justify-between p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg"
|
| 134 |
+
>
|
| 135 |
+
<span className="text-slate-700 dark:text-slate-300">{service.name}</span>
|
| 136 |
+
<div className="flex items-center space-x-2">
|
| 137 |
+
<div className={`w-2 h-2 rounded-full ${service.color} animate-pulse`} />
|
| 138 |
+
<span className="text-sm text-slate-600 dark:text-slate-400">{service.status}</span>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
))}
|
| 142 |
+
</div>
|
| 143 |
+
</motion.div>
|
| 144 |
+
|
| 145 |
+
<motion.div
|
| 146 |
+
initial={{ opacity: 0, y: 20 }}
|
| 147 |
+
animate={{ opacity: 1, y: 0 }}
|
| 148 |
+
transition={{ delay: 0.6 }}
|
| 149 |
+
className="card"
|
| 150 |
+
>
|
| 151 |
+
<h2 className="text-lg font-semibold text-slate-900 dark:text-white mb-4">Quick Start Guide</h2>
|
| 152 |
+
<div className="grid md:grid-cols-2 gap-4">
|
| 153 |
+
<div className="p-4 bg-helios-50 dark:bg-helios-900/20 rounded-lg border border-helios-200 dark:border-helios-800">
|
| 154 |
+
<h3 className="font-medium text-helios-700 dark:text-helios-300 mb-2 flex items-center gap-2">
|
| 155 |
+
<Gavel className="w-4 h-4" />
|
| 156 |
+
Strategic Advisor
|
| 157 |
+
</h3>
|
| 158 |
+
<p className="text-sm text-slate-600 dark:text-slate-400">
|
| 159 |
+
Get uncensored, strategic AI counsel for complex situations. Analyze scenarios from multiple angles with actionable strategies.
|
| 160 |
+
</p>
|
| 161 |
+
</div>
|
| 162 |
+
<div className="p-4 bg-primary-50 dark:bg-primary-900/20 rounded-lg border border-primary-200 dark:border-primary-800">
|
| 163 |
+
<h3 className="font-medium text-primary-700 dark:text-primary-300 mb-2 flex items-center gap-2">
|
| 164 |
+
<Search className="w-4 h-4" />
|
| 165 |
+
Verification
|
| 166 |
+
</h3>
|
| 167 |
+
<p className="text-sm text-slate-600 dark:text-slate-400">
|
| 168 |
+
Verify claims, fact-check information, and analyze content with AI-powered multi-model consensus.
|
| 169 |
+
</p>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
</motion.div>
|
| 173 |
+
</div>
|
| 174 |
+
);
|
| 175 |
+
}
|