shieldcortex 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/hooks/clawdbot/cortex-memory/HOOK.md +2 -2
- package/package.json +32 -9
- package/dashboard/components.json +0 -22
- package/dashboard/eslint.config.mjs +0 -42
- package/dashboard/next.config.ts +0 -7
- package/dashboard/package-lock.json +0 -8053
- package/dashboard/package.json +0 -44
- package/dashboard/postcss.config.mjs +0 -7
- package/dashboard/public/file.svg +0 -1
- package/dashboard/public/globe.svg +0 -1
- package/dashboard/public/next.svg +0 -1
- package/dashboard/public/vercel.svg +0 -1
- package/dashboard/public/window.svg +0 -1
- package/dashboard/scripts/ensure-api.mjs +0 -76
- package/dashboard/src/app/error.tsx +0 -49
- package/dashboard/src/app/favicon.ico +0 -0
- package/dashboard/src/app/globals.css +0 -130
- package/dashboard/src/app/layout.tsx +0 -35
- package/dashboard/src/app/page.tsx +0 -364
- package/dashboard/src/components/Providers.tsx +0 -27
- package/dashboard/src/components/brain/ActivityPulseSystem.tsx +0 -229
- package/dashboard/src/components/brain/BrainMesh.tsx +0 -133
- package/dashboard/src/components/brain/BrainRegions.tsx +0 -254
- package/dashboard/src/components/brain/BrainScene.tsx +0 -255
- package/dashboard/src/components/brain/CategoryLabels.tsx +0 -103
- package/dashboard/src/components/brain/CoreSphere.tsx +0 -215
- package/dashboard/src/components/brain/DataFlowParticles.tsx +0 -123
- package/dashboard/src/components/brain/DataStreamRings.tsx +0 -161
- package/dashboard/src/components/brain/ElectronFlow.tsx +0 -323
- package/dashboard/src/components/brain/HolographicGrid.tsx +0 -235
- package/dashboard/src/components/brain/MemoryLinks.tsx +0 -271
- package/dashboard/src/components/brain/MemoryNode.tsx +0 -245
- package/dashboard/src/components/brain/NeuralPathways.tsx +0 -441
- package/dashboard/src/components/brain/SynapseNodes.tsx +0 -312
- package/dashboard/src/components/brain/TimelineControls.tsx +0 -205
- package/dashboard/src/components/chip/ChipScene.tsx +0 -497
- package/dashboard/src/components/chip/ChipSubstrate.tsx +0 -238
- package/dashboard/src/components/chip/CortexCore.tsx +0 -210
- package/dashboard/src/components/chip/DataBus.tsx +0 -416
- package/dashboard/src/components/chip/MemoryCell.tsx +0 -225
- package/dashboard/src/components/chip/MemoryGrid.tsx +0 -328
- package/dashboard/src/components/chip/QuantumCell.tsx +0 -316
- package/dashboard/src/components/chip/SectionLabel.tsx +0 -113
- package/dashboard/src/components/chip/index.ts +0 -14
- package/dashboard/src/components/controls/ControlPanel.tsx +0 -106
- package/dashboard/src/components/controls/VersionPanel.tsx +0 -185
- package/dashboard/src/components/dashboard/StatsPanel.tsx +0 -164
- package/dashboard/src/components/debug/ActivityLog.tsx +0 -250
- package/dashboard/src/components/debug/DebugPanel.tsx +0 -101
- package/dashboard/src/components/debug/QueryTester.tsx +0 -192
- package/dashboard/src/components/debug/RelationshipGraph.tsx +0 -403
- package/dashboard/src/components/debug/SqlConsole.tsx +0 -319
- package/dashboard/src/components/graph/KnowledgeGraph.tsx +0 -230
- package/dashboard/src/components/graph/OntologyGraph.tsx +0 -631
- package/dashboard/src/components/insights/ActivityHeatmap.tsx +0 -131
- package/dashboard/src/components/insights/InsightsView.tsx +0 -46
- package/dashboard/src/components/insights/KnowledgeMapPanel.tsx +0 -80
- package/dashboard/src/components/insights/QualityPanel.tsx +0 -116
- package/dashboard/src/components/memories/MemoriesView.tsx +0 -150
- package/dashboard/src/components/memories/MemoryCard.tsx +0 -103
- package/dashboard/src/components/memory/MemoryDetail.tsx +0 -325
- package/dashboard/src/components/nav/NavRail.tsx +0 -54
- package/dashboard/src/components/ui/button.tsx +0 -62
- package/dashboard/src/components/ui/card.tsx +0 -92
- package/dashboard/src/components/ui/input.tsx +0 -21
- package/dashboard/src/hooks/useDebouncedValue.ts +0 -24
- package/dashboard/src/hooks/useMemories.ts +0 -458
- package/dashboard/src/hooks/useSuggestions.ts +0 -46
- package/dashboard/src/lib/category-colors.ts +0 -84
- package/dashboard/src/lib/position-algorithm.ts +0 -177
- package/dashboard/src/lib/simplex-noise.ts +0 -217
- package/dashboard/src/lib/store.ts +0 -88
- package/dashboard/src/lib/utils.ts +0 -6
- package/dashboard/src/lib/websocket.ts +0 -249
- package/dashboard/src/types/memory.ts +0 -73
- package/dashboard/tsconfig.json +0 -34
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Memory Detail
|
|
5
|
-
* Shows detailed information about a selected memory
|
|
6
|
-
* including related memories and decay visualization
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { useMemo } from 'react';
|
|
10
|
-
import { Memory, MemoryLink } from '@/types/memory';
|
|
11
|
-
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
12
|
-
import { Button } from '@/components/ui/button';
|
|
13
|
-
import { getCategoryColor, getTypeColor } from '@/lib/category-colors';
|
|
14
|
-
import { calculateDecayFactor } from '@/lib/position-algorithm';
|
|
15
|
-
|
|
16
|
-
interface MemoryDetailProps {
|
|
17
|
-
memory: Memory;
|
|
18
|
-
links?: MemoryLink[];
|
|
19
|
-
memories?: Memory[];
|
|
20
|
-
onClose: () => void;
|
|
21
|
-
onReinforce?: (id: number) => void;
|
|
22
|
-
onSelectMemory?: (id: number) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Relationship styling
|
|
26
|
-
const RELATIONSHIP_STYLES: Record<string, { color: string; label: string; icon: string }> = {
|
|
27
|
-
references: { color: '#60a5fa', label: 'References', icon: '→' },
|
|
28
|
-
extends: { color: '#34d399', label: 'Extends', icon: '⊃' },
|
|
29
|
-
contradicts: { color: '#f87171', label: 'Contradicts', icon: '⊗' },
|
|
30
|
-
related: { color: '#a78bfa', label: 'Related', icon: '~' },
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Get health status based on decay
|
|
34
|
-
function getHealthStatus(decayFactor: number): { label: string; color: string; bgColor: string } {
|
|
35
|
-
if (decayFactor > 0.7) {
|
|
36
|
-
return { label: 'Healthy', color: '#22C55E', bgColor: 'rgba(34, 197, 94, 0.15)' };
|
|
37
|
-
}
|
|
38
|
-
if (decayFactor > 0.4) {
|
|
39
|
-
return { label: 'Fading', color: '#EAB308', bgColor: 'rgba(234, 179, 8, 0.15)' };
|
|
40
|
-
}
|
|
41
|
-
return { label: 'Critical', color: '#EF4444', bgColor: 'rgba(239, 68, 68, 0.15)' };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function MemoryDetail({
|
|
45
|
-
memory,
|
|
46
|
-
links = [],
|
|
47
|
-
memories = [],
|
|
48
|
-
onClose,
|
|
49
|
-
onReinforce,
|
|
50
|
-
onSelectMemory,
|
|
51
|
-
}: MemoryDetailProps) {
|
|
52
|
-
const decayFactor = calculateDecayFactor(memory);
|
|
53
|
-
const categoryColor = getCategoryColor(memory.category);
|
|
54
|
-
const typeColor = getTypeColor(memory.type);
|
|
55
|
-
const healthStatus = getHealthStatus(decayFactor);
|
|
56
|
-
|
|
57
|
-
// Find related memories through links
|
|
58
|
-
const relatedMemories = useMemo(() => {
|
|
59
|
-
const related: Array<{
|
|
60
|
-
memory: Memory;
|
|
61
|
-
relationship: string;
|
|
62
|
-
strength: number;
|
|
63
|
-
direction: 'from' | 'to';
|
|
64
|
-
}> = [];
|
|
65
|
-
|
|
66
|
-
for (const link of links) {
|
|
67
|
-
if (link.source_id === memory.id) {
|
|
68
|
-
const target = memories.find(m => m.id === link.target_id);
|
|
69
|
-
if (target) {
|
|
70
|
-
related.push({
|
|
71
|
-
memory: target,
|
|
72
|
-
relationship: link.relationship,
|
|
73
|
-
strength: link.strength,
|
|
74
|
-
direction: 'to',
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
} else if (link.target_id === memory.id) {
|
|
78
|
-
const source = memories.find(m => m.id === link.source_id);
|
|
79
|
-
if (source) {
|
|
80
|
-
related.push({
|
|
81
|
-
memory: source,
|
|
82
|
-
relationship: link.relationship,
|
|
83
|
-
strength: link.strength,
|
|
84
|
-
direction: 'from',
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Sort by strength
|
|
91
|
-
return related.sort((a, b) => b.strength - a.strength);
|
|
92
|
-
}, [memory.id, links, memories]);
|
|
93
|
-
|
|
94
|
-
const formatDate = (dateStr: string) => {
|
|
95
|
-
const date = new Date(dateStr);
|
|
96
|
-
return date.toLocaleString();
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const timeSince = (dateStr: string) => {
|
|
100
|
-
const date = new Date(dateStr);
|
|
101
|
-
const now = new Date();
|
|
102
|
-
const hours = Math.floor((now.getTime() - date.getTime()) / (1000 * 60 * 60));
|
|
103
|
-
|
|
104
|
-
if (hours < 1) return 'Just now';
|
|
105
|
-
if (hours < 24) return `${hours}h ago`;
|
|
106
|
-
const days = Math.floor(hours / 24);
|
|
107
|
-
if (days < 7) return `${days}d ago`;
|
|
108
|
-
return `${Math.floor(days / 7)}w ago`;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<Card className="bg-slate-900 border-slate-700 h-full overflow-auto">
|
|
113
|
-
<CardHeader className="border-b border-slate-700 pb-3">
|
|
114
|
-
<div className="flex items-start justify-between gap-2">
|
|
115
|
-
<CardTitle className="text-lg font-semibold text-white leading-tight">
|
|
116
|
-
{memory.title}
|
|
117
|
-
</CardTitle>
|
|
118
|
-
<Button
|
|
119
|
-
variant="ghost"
|
|
120
|
-
size="sm"
|
|
121
|
-
onClick={onClose}
|
|
122
|
-
className="text-slate-400 hover:text-white -mt-1"
|
|
123
|
-
>
|
|
124
|
-
✕
|
|
125
|
-
</Button>
|
|
126
|
-
</div>
|
|
127
|
-
<div className="flex items-center gap-2 mt-2">
|
|
128
|
-
<span
|
|
129
|
-
className="px-2 py-0.5 rounded text-xs font-medium"
|
|
130
|
-
style={{
|
|
131
|
-
backgroundColor: categoryColor + '20',
|
|
132
|
-
color: categoryColor,
|
|
133
|
-
}}
|
|
134
|
-
>
|
|
135
|
-
{memory.category}
|
|
136
|
-
</span>
|
|
137
|
-
<span
|
|
138
|
-
className="px-2 py-0.5 rounded text-xs font-medium"
|
|
139
|
-
style={{
|
|
140
|
-
backgroundColor: typeColor + '20',
|
|
141
|
-
color: typeColor,
|
|
142
|
-
}}
|
|
143
|
-
>
|
|
144
|
-
{memory.type.replace('_', '-')}
|
|
145
|
-
</span>
|
|
146
|
-
</div>
|
|
147
|
-
</CardHeader>
|
|
148
|
-
|
|
149
|
-
<CardContent className="p-4 space-y-4">
|
|
150
|
-
{/* Content */}
|
|
151
|
-
<div>
|
|
152
|
-
<h4 className="text-xs font-medium text-slate-400 mb-1">Content</h4>
|
|
153
|
-
<p className="text-sm text-slate-200 whitespace-pre-wrap leading-relaxed">
|
|
154
|
-
{memory.content}
|
|
155
|
-
</p>
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
{/* Health Status Banner */}
|
|
159
|
-
<div
|
|
160
|
-
className="rounded-lg p-3 flex items-center gap-3"
|
|
161
|
-
style={{ backgroundColor: healthStatus.bgColor }}
|
|
162
|
-
>
|
|
163
|
-
<div
|
|
164
|
-
className="w-3 h-3 rounded-full animate-pulse"
|
|
165
|
-
style={{ backgroundColor: healthStatus.color }}
|
|
166
|
-
/>
|
|
167
|
-
<div>
|
|
168
|
-
<div className="text-sm font-medium" style={{ color: healthStatus.color }}>
|
|
169
|
-
{healthStatus.label}
|
|
170
|
-
</div>
|
|
171
|
-
<div className="text-xs text-slate-400">
|
|
172
|
-
{decayFactor > 0.7
|
|
173
|
-
? 'Memory is strong and stable'
|
|
174
|
-
: decayFactor > 0.4
|
|
175
|
-
? 'Memory is fading - reinforce to preserve'
|
|
176
|
-
: 'Memory at risk of deletion - reinforce now'}
|
|
177
|
-
</div>
|
|
178
|
-
</div>
|
|
179
|
-
</div>
|
|
180
|
-
|
|
181
|
-
{/* Metrics */}
|
|
182
|
-
<div className="grid grid-cols-2 gap-3">
|
|
183
|
-
<div className="bg-slate-800 rounded-lg p-3">
|
|
184
|
-
<div className="text-xs text-slate-400">Salience</div>
|
|
185
|
-
<div className="text-lg font-bold text-white">
|
|
186
|
-
{(memory.salience * 100).toFixed(0)}%
|
|
187
|
-
</div>
|
|
188
|
-
<div className="mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden">
|
|
189
|
-
<div
|
|
190
|
-
className="h-full bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 rounded-full transition-all"
|
|
191
|
-
style={{ width: `${memory.salience * 100}%` }}
|
|
192
|
-
/>
|
|
193
|
-
</div>
|
|
194
|
-
</div>
|
|
195
|
-
|
|
196
|
-
<div className="bg-slate-800 rounded-lg p-3">
|
|
197
|
-
<div className="text-xs text-slate-400">Decay Factor</div>
|
|
198
|
-
<div className="text-lg font-bold text-white">
|
|
199
|
-
{(decayFactor * 100).toFixed(0)}%
|
|
200
|
-
</div>
|
|
201
|
-
<div className="mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden">
|
|
202
|
-
<div
|
|
203
|
-
className="h-full rounded-full transition-all"
|
|
204
|
-
style={{
|
|
205
|
-
width: `${decayFactor * 100}%`,
|
|
206
|
-
backgroundColor: healthStatus.color,
|
|
207
|
-
}}
|
|
208
|
-
/>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
</div>
|
|
212
|
-
|
|
213
|
-
{/* Access info */}
|
|
214
|
-
<div className="bg-slate-800 rounded-lg p-3 space-y-2">
|
|
215
|
-
<div className="flex justify-between items-center">
|
|
216
|
-
<span className="text-xs text-slate-400">Access Count</span>
|
|
217
|
-
<span className="text-sm font-medium text-white">
|
|
218
|
-
{memory.accessCount} times
|
|
219
|
-
</span>
|
|
220
|
-
</div>
|
|
221
|
-
<div className="flex justify-between items-center">
|
|
222
|
-
<span className="text-xs text-slate-400">Last Accessed</span>
|
|
223
|
-
<span className="text-sm text-white">
|
|
224
|
-
{timeSince(memory.lastAccessed)}
|
|
225
|
-
</span>
|
|
226
|
-
</div>
|
|
227
|
-
<div className="flex justify-between items-center">
|
|
228
|
-
<span className="text-xs text-slate-400">Created</span>
|
|
229
|
-
<span className="text-sm text-white">
|
|
230
|
-
{formatDate(memory.createdAt)}
|
|
231
|
-
</span>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
|
|
235
|
-
{/* Related Memories */}
|
|
236
|
-
{relatedMemories.length > 0 && (
|
|
237
|
-
<div>
|
|
238
|
-
<h4 className="text-xs font-medium text-slate-400 mb-2 flex items-center gap-2">
|
|
239
|
-
<span className="inline-block w-4 h-4">🔗</span>
|
|
240
|
-
Related Memories ({relatedMemories.length})
|
|
241
|
-
</h4>
|
|
242
|
-
<div className="space-y-2 max-h-48 overflow-y-auto">
|
|
243
|
-
{relatedMemories.map(({ memory: related, relationship, strength, direction }) => {
|
|
244
|
-
const style = RELATIONSHIP_STYLES[relationship] || RELATIONSHIP_STYLES.related;
|
|
245
|
-
const relatedCategoryColor = getCategoryColor(related.category);
|
|
246
|
-
|
|
247
|
-
return (
|
|
248
|
-
<button
|
|
249
|
-
key={`${related.id}-${direction}`}
|
|
250
|
-
onClick={() => onSelectMemory?.(related.id)}
|
|
251
|
-
className="w-full text-left p-2 bg-slate-800 hover:bg-slate-750 rounded-lg transition-colors group"
|
|
252
|
-
>
|
|
253
|
-
<div className="flex items-center gap-2 mb-1">
|
|
254
|
-
<span
|
|
255
|
-
className="w-1.5 h-1.5 rounded-full"
|
|
256
|
-
style={{ backgroundColor: style.color }}
|
|
257
|
-
/>
|
|
258
|
-
<span
|
|
259
|
-
className="text-[10px] font-medium"
|
|
260
|
-
style={{ color: style.color }}
|
|
261
|
-
>
|
|
262
|
-
{direction === 'to' ? `${style.icon} ${style.label}` : `${style.label} ${style.icon}`}
|
|
263
|
-
</span>
|
|
264
|
-
<span className="text-[10px] text-slate-500 ml-auto">
|
|
265
|
-
{(strength * 100).toFixed(0)}%
|
|
266
|
-
</span>
|
|
267
|
-
</div>
|
|
268
|
-
<div className="text-sm text-white truncate group-hover:text-blue-400 transition-colors">
|
|
269
|
-
{related.title}
|
|
270
|
-
</div>
|
|
271
|
-
<div className="flex items-center gap-2 mt-1">
|
|
272
|
-
<span
|
|
273
|
-
className="px-1.5 py-0.5 rounded text-[10px]"
|
|
274
|
-
style={{
|
|
275
|
-
backgroundColor: relatedCategoryColor + '20',
|
|
276
|
-
color: relatedCategoryColor,
|
|
277
|
-
}}
|
|
278
|
-
>
|
|
279
|
-
{related.category}
|
|
280
|
-
</span>
|
|
281
|
-
<span className="text-[10px] text-slate-500">
|
|
282
|
-
{(related.salience * 100).toFixed(0)}% salience
|
|
283
|
-
</span>
|
|
284
|
-
</div>
|
|
285
|
-
</button>
|
|
286
|
-
);
|
|
287
|
-
})}
|
|
288
|
-
</div>
|
|
289
|
-
</div>
|
|
290
|
-
)}
|
|
291
|
-
|
|
292
|
-
{/* Tags */}
|
|
293
|
-
{memory.tags && memory.tags.length > 0 && (
|
|
294
|
-
<div>
|
|
295
|
-
<h4 className="text-xs font-medium text-slate-400 mb-2">Tags</h4>
|
|
296
|
-
<div className="flex flex-wrap gap-1">
|
|
297
|
-
{memory.tags.map((tag, i) => (
|
|
298
|
-
<span
|
|
299
|
-
key={i}
|
|
300
|
-
className="px-2 py-0.5 bg-slate-700 text-slate-300 rounded text-xs"
|
|
301
|
-
>
|
|
302
|
-
{tag}
|
|
303
|
-
</span>
|
|
304
|
-
))}
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
)}
|
|
308
|
-
|
|
309
|
-
{/* Actions */}
|
|
310
|
-
<div className="flex gap-2 pt-2">
|
|
311
|
-
{onReinforce && (
|
|
312
|
-
<Button
|
|
313
|
-
variant="default"
|
|
314
|
-
size="sm"
|
|
315
|
-
onClick={() => onReinforce(memory.id)}
|
|
316
|
-
className="flex-1 bg-blue-600 hover:bg-blue-700"
|
|
317
|
-
>
|
|
318
|
-
⚡ Reinforce Memory
|
|
319
|
-
</Button>
|
|
320
|
-
)}
|
|
321
|
-
</div>
|
|
322
|
-
</CardContent>
|
|
323
|
-
</Card>
|
|
324
|
-
);
|
|
325
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useDashboardStore } from '@/lib/store';
|
|
4
|
-
import { useStats } from '@/hooks/useMemories';
|
|
5
|
-
import { Network, LayoutGrid, BarChart3, Brain, Share2 } from 'lucide-react';
|
|
6
|
-
|
|
7
|
-
const NAV_ITEMS = [
|
|
8
|
-
{ id: 'graph' as const, label: 'Graph', icon: Network },
|
|
9
|
-
{ id: 'memories' as const, label: 'Memories', icon: LayoutGrid },
|
|
10
|
-
{ id: 'insights' as const, label: 'Insights', icon: BarChart3 },
|
|
11
|
-
{ id: 'brain' as const, label: 'Brain', icon: Brain },
|
|
12
|
-
{ id: 'ontology' as const, label: 'Ontology', icon: Share2 },
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
export function NavRail() {
|
|
16
|
-
const { viewMode, setViewMode } = useDashboardStore();
|
|
17
|
-
const { data: stats } = useStats();
|
|
18
|
-
|
|
19
|
-
const healthPercent = stats?.decayDistribution
|
|
20
|
-
? Math.round(
|
|
21
|
-
(stats.decayDistribution.healthy /
|
|
22
|
-
Math.max(1, stats.total)) *
|
|
23
|
-
100
|
|
24
|
-
)
|
|
25
|
-
: null;
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<nav className="w-14 border-r border-slate-800 bg-slate-900/50 flex flex-col items-center py-3 shrink-0">
|
|
29
|
-
<div className="flex-1 flex flex-col items-center gap-1">
|
|
30
|
-
{NAV_ITEMS.map(({ id, label, icon: Icon }) => (
|
|
31
|
-
<button
|
|
32
|
-
key={id}
|
|
33
|
-
onClick={() => setViewMode(id)}
|
|
34
|
-
className={`w-10 h-10 rounded-lg flex flex-col items-center justify-center gap-0.5 transition-colors ${
|
|
35
|
-
viewMode === id
|
|
36
|
-
? 'bg-cyan-600/20 text-cyan-400'
|
|
37
|
-
: 'text-slate-500 hover:text-slate-300 hover:bg-slate-800'
|
|
38
|
-
}`}
|
|
39
|
-
title={label}
|
|
40
|
-
>
|
|
41
|
-
<Icon size={18} />
|
|
42
|
-
<span className="text-[9px] leading-none">{label}</span>
|
|
43
|
-
</button>
|
|
44
|
-
))}
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
{/* Bottom stats */}
|
|
48
|
-
<div className="flex flex-col items-center gap-1 text-[10px] text-slate-500">
|
|
49
|
-
{stats && <span>{stats.total}</span>}
|
|
50
|
-
{healthPercent !== null && <span>{healthPercent}%</span>}
|
|
51
|
-
</div>
|
|
52
|
-
</nav>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
const buttonVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
-
destructive:
|
|
14
|
-
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
15
|
-
outline:
|
|
16
|
-
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
17
|
-
secondary:
|
|
18
|
-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
-
ghost:
|
|
20
|
-
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
21
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
-
icon: "size-9",
|
|
28
|
-
"icon-sm": "size-8",
|
|
29
|
-
"icon-lg": "size-10",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
defaultVariants: {
|
|
33
|
-
variant: "default",
|
|
34
|
-
size: "default",
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
function Button({
|
|
40
|
-
className,
|
|
41
|
-
variant = "default",
|
|
42
|
-
size = "default",
|
|
43
|
-
asChild = false,
|
|
44
|
-
...props
|
|
45
|
-
}: React.ComponentProps<"button"> &
|
|
46
|
-
VariantProps<typeof buttonVariants> & {
|
|
47
|
-
asChild?: boolean
|
|
48
|
-
}) {
|
|
49
|
-
const Comp = asChild ? Slot : "button"
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Comp
|
|
53
|
-
data-slot="button"
|
|
54
|
-
data-variant={variant}
|
|
55
|
-
data-size={size}
|
|
56
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
57
|
-
{...props}
|
|
58
|
-
/>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { Button, buttonVariants }
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/lib/utils"
|
|
4
|
-
|
|
5
|
-
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
-
return (
|
|
7
|
-
<div
|
|
8
|
-
data-slot="card"
|
|
9
|
-
className={cn(
|
|
10
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
11
|
-
className
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
data-slot="card-header"
|
|
22
|
-
className={cn(
|
|
23
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
24
|
-
className
|
|
25
|
-
)}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
data-slot="card-title"
|
|
35
|
-
className={cn("leading-none font-semibold", className)}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
-
return (
|
|
43
|
-
<div
|
|
44
|
-
data-slot="card-description"
|
|
45
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
52
|
-
return (
|
|
53
|
-
<div
|
|
54
|
-
data-slot="card-action"
|
|
55
|
-
className={cn(
|
|
56
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
-
className
|
|
58
|
-
)}
|
|
59
|
-
{...props}
|
|
60
|
-
/>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
-
return (
|
|
66
|
-
<div
|
|
67
|
-
data-slot="card-content"
|
|
68
|
-
className={cn("px-6", className)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
-
return (
|
|
76
|
-
<div
|
|
77
|
-
data-slot="card-footer"
|
|
78
|
-
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
Card,
|
|
86
|
-
CardHeader,
|
|
87
|
-
CardFooter,
|
|
88
|
-
CardTitle,
|
|
89
|
-
CardAction,
|
|
90
|
-
CardDescription,
|
|
91
|
-
CardContent,
|
|
92
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/lib/utils"
|
|
4
|
-
|
|
5
|
-
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
-
return (
|
|
7
|
-
<input
|
|
8
|
-
type={type}
|
|
9
|
-
data-slot="input"
|
|
10
|
-
className={cn(
|
|
11
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
12
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
13
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { Input }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debounce Hook
|
|
3
|
-
*
|
|
4
|
-
* Delays updating a value until after a specified delay has passed
|
|
5
|
-
* since the last time the value changed.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { useState, useEffect } from 'react';
|
|
9
|
-
|
|
10
|
-
export function useDebouncedValue<T>(value: T, delay: number = 300): T {
|
|
11
|
-
const [debouncedValue, setDebouncedValue] = useState<T>(value);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const timer = setTimeout(() => {
|
|
15
|
-
setDebouncedValue(value);
|
|
16
|
-
}, delay);
|
|
17
|
-
|
|
18
|
-
return () => {
|
|
19
|
-
clearTimeout(timer);
|
|
20
|
-
};
|
|
21
|
-
}, [value, delay]);
|
|
22
|
-
|
|
23
|
-
return debouncedValue;
|
|
24
|
-
}
|