theNorms commited on
Commit
910968b
·
verified ·
1 Parent(s): fef0a96

Upload project files

Browse files
src/components/consciousness-gauge.tsx ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import { motion } from "framer-motion";
4
+
5
+ interface ConsciousnessGaugeProps {
6
+ value: number; // 0-1
7
+ label: string;
8
+ color: string;
9
+ size?: number;
10
+ }
11
+
12
+ export function ConsciousnessGauge({
13
+ value,
14
+ label,
15
+ color,
16
+ size = 72,
17
+ }: ConsciousnessGaugeProps) {
18
+ const strokeWidth = 4;
19
+ const radius = (size - strokeWidth) / 2;
20
+ const circumference = 2 * Math.PI * radius;
21
+ const offset = circumference * (1 - Math.min(Math.max(value, 0), 1));
22
+ const center = size / 2;
23
+
24
+ return (
25
+ <div className="flex flex-col items-center gap-1">
26
+ <div className="relative" style={{ width: size, height: size }}>
27
+ <svg
28
+ width={size}
29
+ height={size}
30
+ className="-rotate-90"
31
+ viewBox={`0 0 ${size} ${size}`}
32
+ >
33
+ {/* Background circle */}
34
+ <circle
35
+ cx={center}
36
+ cy={center}
37
+ r={radius}
38
+ fill="none"
39
+ stroke="currentColor"
40
+ strokeWidth={strokeWidth}
41
+ className="text-muted/30"
42
+ />
43
+ {/* Progress circle */}
44
+ <motion.circle
45
+ cx={center}
46
+ cy={center}
47
+ r={radius}
48
+ fill="none"
49
+ stroke={color}
50
+ strokeWidth={strokeWidth}
51
+ strokeLinecap="round"
52
+ strokeDasharray={circumference}
53
+ initial={{ strokeDashoffset: circumference }}
54
+ animate={{ strokeDashoffset: offset }}
55
+ transition={{ duration: 1, ease: "easeOut" }}
56
+ style={{
57
+ filter: `drop-shadow(0 0 4px ${color}80)`,
58
+ }}
59
+ />
60
+ </svg>
61
+ {/* Center value */}
62
+ <div className="absolute inset-0 flex items-center justify-center">
63
+ <span className="text-[10px] font-mono font-bold" style={{ color }}>
64
+ {Math.round(value * 100)}
65
+ </span>
66
+ </div>
67
+ </div>
68
+ <span className="text-[9px] text-muted-foreground font-medium text-center leading-tight max-w-[72px] truncate">
69
+ {label}
70
+ </span>
71
+ </div>
72
+ );
73
+ }