shieldcortex 2.0.0
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/LICENSE +21 -0
- package/README.md +282 -0
- package/dashboard/components.json +22 -0
- package/dashboard/eslint.config.mjs +42 -0
- package/dashboard/next.config.ts +7 -0
- package/dashboard/package-lock.json +8053 -0
- package/dashboard/package.json +44 -0
- package/dashboard/postcss.config.mjs +7 -0
- package/dashboard/public/file.svg +1 -0
- package/dashboard/public/globe.svg +1 -0
- package/dashboard/public/next.svg +1 -0
- package/dashboard/public/vercel.svg +1 -0
- package/dashboard/public/window.svg +1 -0
- package/dashboard/scripts/ensure-api.mjs +76 -0
- package/dashboard/src/app/error.tsx +49 -0
- package/dashboard/src/app/favicon.ico +0 -0
- package/dashboard/src/app/globals.css +130 -0
- package/dashboard/src/app/layout.tsx +35 -0
- package/dashboard/src/app/page.tsx +364 -0
- package/dashboard/src/components/Providers.tsx +27 -0
- package/dashboard/src/components/brain/ActivityPulseSystem.tsx +229 -0
- package/dashboard/src/components/brain/BrainMesh.tsx +133 -0
- package/dashboard/src/components/brain/BrainRegions.tsx +254 -0
- package/dashboard/src/components/brain/BrainScene.tsx +255 -0
- package/dashboard/src/components/brain/CategoryLabels.tsx +103 -0
- package/dashboard/src/components/brain/CoreSphere.tsx +215 -0
- package/dashboard/src/components/brain/DataFlowParticles.tsx +123 -0
- package/dashboard/src/components/brain/DataStreamRings.tsx +161 -0
- package/dashboard/src/components/brain/ElectronFlow.tsx +323 -0
- package/dashboard/src/components/brain/HolographicGrid.tsx +235 -0
- package/dashboard/src/components/brain/MemoryLinks.tsx +271 -0
- package/dashboard/src/components/brain/MemoryNode.tsx +245 -0
- package/dashboard/src/components/brain/NeuralPathways.tsx +441 -0
- package/dashboard/src/components/brain/SynapseNodes.tsx +312 -0
- package/dashboard/src/components/brain/TimelineControls.tsx +205 -0
- package/dashboard/src/components/chip/ChipScene.tsx +497 -0
- package/dashboard/src/components/chip/ChipSubstrate.tsx +238 -0
- package/dashboard/src/components/chip/CortexCore.tsx +210 -0
- package/dashboard/src/components/chip/DataBus.tsx +416 -0
- package/dashboard/src/components/chip/MemoryCell.tsx +225 -0
- package/dashboard/src/components/chip/MemoryGrid.tsx +328 -0
- package/dashboard/src/components/chip/QuantumCell.tsx +316 -0
- package/dashboard/src/components/chip/SectionLabel.tsx +113 -0
- package/dashboard/src/components/chip/index.ts +14 -0
- package/dashboard/src/components/controls/ControlPanel.tsx +106 -0
- package/dashboard/src/components/controls/VersionPanel.tsx +185 -0
- package/dashboard/src/components/dashboard/StatsPanel.tsx +164 -0
- package/dashboard/src/components/debug/ActivityLog.tsx +250 -0
- package/dashboard/src/components/debug/DebugPanel.tsx +101 -0
- package/dashboard/src/components/debug/QueryTester.tsx +192 -0
- package/dashboard/src/components/debug/RelationshipGraph.tsx +403 -0
- package/dashboard/src/components/debug/SqlConsole.tsx +319 -0
- package/dashboard/src/components/graph/KnowledgeGraph.tsx +230 -0
- package/dashboard/src/components/graph/OntologyGraph.tsx +631 -0
- package/dashboard/src/components/insights/ActivityHeatmap.tsx +131 -0
- package/dashboard/src/components/insights/InsightsView.tsx +46 -0
- package/dashboard/src/components/insights/KnowledgeMapPanel.tsx +80 -0
- package/dashboard/src/components/insights/QualityPanel.tsx +116 -0
- package/dashboard/src/components/memories/MemoriesView.tsx +150 -0
- package/dashboard/src/components/memories/MemoryCard.tsx +103 -0
- package/dashboard/src/components/memory/MemoryDetail.tsx +325 -0
- package/dashboard/src/components/nav/NavRail.tsx +54 -0
- package/dashboard/src/components/ui/button.tsx +62 -0
- package/dashboard/src/components/ui/card.tsx +92 -0
- package/dashboard/src/components/ui/input.tsx +21 -0
- package/dashboard/src/hooks/useDebouncedValue.ts +24 -0
- package/dashboard/src/hooks/useMemories.ts +458 -0
- package/dashboard/src/hooks/useSuggestions.ts +46 -0
- package/dashboard/src/lib/category-colors.ts +84 -0
- package/dashboard/src/lib/position-algorithm.ts +177 -0
- package/dashboard/src/lib/simplex-noise.ts +217 -0
- package/dashboard/src/lib/store.ts +88 -0
- package/dashboard/src/lib/utils.ts +6 -0
- package/dashboard/src/lib/websocket.ts +249 -0
- package/dashboard/src/types/memory.ts +73 -0
- package/dashboard/tsconfig.json +34 -0
- package/dist/__tests__/consolidation-merge.test.d.ts +9 -0
- package/dist/__tests__/consolidation-merge.test.d.ts.map +1 -0
- package/dist/__tests__/consolidation-merge.test.js +137 -0
- package/dist/__tests__/consolidation-merge.test.js.map +1 -0
- package/dist/__tests__/contradictions.test.d.ts +8 -0
- package/dist/__tests__/contradictions.test.d.ts.map +1 -0
- package/dist/__tests__/contradictions.test.js +78 -0
- package/dist/__tests__/contradictions.test.js.map +1 -0
- package/dist/__tests__/salience-evolution.test.d.ts +7 -0
- package/dist/__tests__/salience-evolution.test.d.ts.map +1 -0
- package/dist/__tests__/salience-evolution.test.js +151 -0
- package/dist/__tests__/salience-evolution.test.js.map +1 -0
- package/dist/__tests__/store.test.d.ts +7 -0
- package/dist/__tests__/store.test.d.ts.map +1 -0
- package/dist/__tests__/store.test.js +582 -0
- package/dist/__tests__/store.test.js.map +1 -0
- package/dist/api/control.d.ts +27 -0
- package/dist/api/control.d.ts.map +1 -0
- package/dist/api/control.js +60 -0
- package/dist/api/control.js.map +1 -0
- package/dist/api/events.d.ts +159 -0
- package/dist/api/events.d.ts.map +1 -0
- package/dist/api/events.js +155 -0
- package/dist/api/events.js.map +1 -0
- package/dist/api/version.d.ts +36 -0
- package/dist/api/version.d.ts.map +1 -0
- package/dist/api/version.js +146 -0
- package/dist/api/version.js.map +1 -0
- package/dist/api/visualization-server.d.ts +11 -0
- package/dist/api/visualization-server.d.ts.map +1 -0
- package/dist/api/visualization-server.js +1186 -0
- package/dist/api/visualization-server.js.map +1 -0
- package/dist/context/project-context.d.ts +57 -0
- package/dist/context/project-context.d.ts.map +1 -0
- package/dist/context/project-context.js +135 -0
- package/dist/context/project-context.js.map +1 -0
- package/dist/database/init.d.ts +49 -0
- package/dist/database/init.d.ts.map +1 -0
- package/dist/database/init.js +567 -0
- package/dist/database/init.js.map +1 -0
- package/dist/defence/__tests__/firewall.test.d.ts +8 -0
- package/dist/defence/__tests__/firewall.test.d.ts.map +1 -0
- package/dist/defence/__tests__/firewall.test.js +123 -0
- package/dist/defence/__tests__/firewall.test.js.map +1 -0
- package/dist/defence/__tests__/fragmentation.test.d.ts +7 -0
- package/dist/defence/__tests__/fragmentation.test.d.ts.map +1 -0
- package/dist/defence/__tests__/fragmentation.test.js +51 -0
- package/dist/defence/__tests__/fragmentation.test.js.map +1 -0
- package/dist/defence/__tests__/pipeline.test.d.ts +8 -0
- package/dist/defence/__tests__/pipeline.test.d.ts.map +1 -0
- package/dist/defence/__tests__/pipeline.test.js +61 -0
- package/dist/defence/__tests__/pipeline.test.js.map +1 -0
- package/dist/defence/__tests__/sensitivity.test.d.ts +7 -0
- package/dist/defence/__tests__/sensitivity.test.d.ts.map +1 -0
- package/dist/defence/__tests__/sensitivity.test.js +61 -0
- package/dist/defence/__tests__/sensitivity.test.js.map +1 -0
- package/dist/defence/__tests__/trust.test.d.ts +7 -0
- package/dist/defence/__tests__/trust.test.d.ts.map +1 -0
- package/dist/defence/__tests__/trust.test.js +49 -0
- package/dist/defence/__tests__/trust.test.js.map +1 -0
- package/dist/defence/audit/index.d.ts +4 -0
- package/dist/defence/audit/index.d.ts.map +1 -0
- package/dist/defence/audit/index.js +3 -0
- package/dist/defence/audit/index.js.map +1 -0
- package/dist/defence/audit/logger.d.ts +14 -0
- package/dist/defence/audit/logger.d.ts.map +1 -0
- package/dist/defence/audit/logger.js +54 -0
- package/dist/defence/audit/logger.js.map +1 -0
- package/dist/defence/audit/queries.d.ts +33 -0
- package/dist/defence/audit/queries.d.ts.map +1 -0
- package/dist/defence/audit/queries.js +103 -0
- package/dist/defence/audit/queries.js.map +1 -0
- package/dist/defence/firewall/anomaly-scorer.d.ts +8 -0
- package/dist/defence/firewall/anomaly-scorer.d.ts.map +1 -0
- package/dist/defence/firewall/anomaly-scorer.js +58 -0
- package/dist/defence/firewall/anomaly-scorer.js.map +1 -0
- package/dist/defence/firewall/encoding-detector.d.ts +13 -0
- package/dist/defence/firewall/encoding-detector.d.ts.map +1 -0
- package/dist/defence/firewall/encoding-detector.js +120 -0
- package/dist/defence/firewall/encoding-detector.js.map +1 -0
- package/dist/defence/firewall/index.d.ts +21 -0
- package/dist/defence/firewall/index.d.ts.map +1 -0
- package/dist/defence/firewall/index.js +133 -0
- package/dist/defence/firewall/index.js.map +1 -0
- package/dist/defence/firewall/instruction-detector.d.ts +12 -0
- package/dist/defence/firewall/instruction-detector.d.ts.map +1 -0
- package/dist/defence/firewall/instruction-detector.js +99 -0
- package/dist/defence/firewall/instruction-detector.js.map +1 -0
- package/dist/defence/firewall/privilege-detector.d.ts +13 -0
- package/dist/defence/firewall/privilege-detector.d.ts.map +1 -0
- package/dist/defence/firewall/privilege-detector.js +89 -0
- package/dist/defence/firewall/privilege-detector.js.map +1 -0
- package/dist/defence/fragmentation/assembly-detector.d.ts +18 -0
- package/dist/defence/fragmentation/assembly-detector.d.ts.map +1 -0
- package/dist/defence/fragmentation/assembly-detector.js +72 -0
- package/dist/defence/fragmentation/assembly-detector.js.map +1 -0
- package/dist/defence/fragmentation/entity-extractor.d.ts +19 -0
- package/dist/defence/fragmentation/entity-extractor.d.ts.map +1 -0
- package/dist/defence/fragmentation/entity-extractor.js +86 -0
- package/dist/defence/fragmentation/entity-extractor.js.map +1 -0
- package/dist/defence/fragmentation/index.d.ts +23 -0
- package/dist/defence/fragmentation/index.d.ts.map +1 -0
- package/dist/defence/fragmentation/index.js +49 -0
- package/dist/defence/fragmentation/index.js.map +1 -0
- package/dist/defence/fragmentation/temporal-analyzer.d.ts +28 -0
- package/dist/defence/fragmentation/temporal-analyzer.d.ts.map +1 -0
- package/dist/defence/fragmentation/temporal-analyzer.js +41 -0
- package/dist/defence/fragmentation/temporal-analyzer.js.map +1 -0
- package/dist/defence/index.d.ts +12 -0
- package/dist/defence/index.d.ts.map +1 -0
- package/dist/defence/index.js +18 -0
- package/dist/defence/index.js.map +1 -0
- package/dist/defence/pipeline.d.ts +9 -0
- package/dist/defence/pipeline.d.ts.map +1 -0
- package/dist/defence/pipeline.js +115 -0
- package/dist/defence/pipeline.js.map +1 -0
- package/dist/defence/scanner/index.d.ts +5 -0
- package/dist/defence/scanner/index.d.ts.map +1 -0
- package/dist/defence/scanner/index.js +5 -0
- package/dist/defence/scanner/index.js.map +1 -0
- package/dist/defence/scanner/scan-existing.d.ts +34 -0
- package/dist/defence/scanner/scan-existing.d.ts.map +1 -0
- package/dist/defence/scanner/scan-existing.js +136 -0
- package/dist/defence/scanner/scan-existing.js.map +1 -0
- package/dist/defence/sensitivity/classifier.d.ts +6 -0
- package/dist/defence/sensitivity/classifier.d.ts.map +1 -0
- package/dist/defence/sensitivity/classifier.js +50 -0
- package/dist/defence/sensitivity/classifier.js.map +1 -0
- package/dist/defence/sensitivity/index.d.ts +11 -0
- package/dist/defence/sensitivity/index.d.ts.map +1 -0
- package/dist/defence/sensitivity/index.js +13 -0
- package/dist/defence/sensitivity/index.js.map +1 -0
- package/dist/defence/sensitivity/patterns.d.ts +14 -0
- package/dist/defence/sensitivity/patterns.d.ts.map +1 -0
- package/dist/defence/sensitivity/patterns.js +67 -0
- package/dist/defence/sensitivity/patterns.js.map +1 -0
- package/dist/defence/sensitivity/redaction.d.ts +17 -0
- package/dist/defence/sensitivity/redaction.d.ts.map +1 -0
- package/dist/defence/sensitivity/redaction.js +47 -0
- package/dist/defence/sensitivity/redaction.js.map +1 -0
- package/dist/defence/trust/index.d.ts +3 -0
- package/dist/defence/trust/index.d.ts.map +1 -0
- package/dist/defence/trust/index.js +3 -0
- package/dist/defence/trust/index.js.map +1 -0
- package/dist/defence/trust/recall-filter.d.ts +10 -0
- package/dist/defence/trust/recall-filter.d.ts.map +1 -0
- package/dist/defence/trust/recall-filter.js +38 -0
- package/dist/defence/trust/recall-filter.js.map +1 -0
- package/dist/defence/trust/source-scorer.d.ts +6 -0
- package/dist/defence/trust/source-scorer.d.ts.map +1 -0
- package/dist/defence/trust/source-scorer.js +34 -0
- package/dist/defence/trust/source-scorer.js.map +1 -0
- package/dist/defence/types.d.ts +88 -0
- package/dist/defence/types.d.ts.map +1 -0
- package/dist/defence/types.js +15 -0
- package/dist/defence/types.js.map +1 -0
- package/dist/embeddings/generator.d.ts +20 -0
- package/dist/embeddings/generator.d.ts.map +1 -0
- package/dist/embeddings/generator.js +83 -0
- package/dist/embeddings/generator.js.map +1 -0
- package/dist/embeddings/index.d.ts +2 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +2 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/errors.d.ts +74 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +131 -0
- package/dist/errors.js.map +1 -0
- package/dist/graph/backfill.d.ts +6 -0
- package/dist/graph/backfill.d.ts.map +1 -0
- package/dist/graph/backfill.js +33 -0
- package/dist/graph/backfill.js.map +1 -0
- package/dist/graph/extract.d.ts +21 -0
- package/dist/graph/extract.d.ts.map +1 -0
- package/dist/graph/extract.js +231 -0
- package/dist/graph/extract.js.map +1 -0
- package/dist/graph/resolve.d.ts +6 -0
- package/dist/graph/resolve.d.ts.map +1 -0
- package/dist/graph/resolve.js +126 -0
- package/dist/graph/resolve.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +248 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/activation.d.ts +69 -0
- package/dist/memory/activation.d.ts.map +1 -0
- package/dist/memory/activation.js +168 -0
- package/dist/memory/activation.js.map +1 -0
- package/dist/memory/consolidate.d.ts +98 -0
- package/dist/memory/consolidate.d.ts.map +1 -0
- package/dist/memory/consolidate.js +511 -0
- package/dist/memory/consolidate.js.map +1 -0
- package/dist/memory/contradiction.d.ts +69 -0
- package/dist/memory/contradiction.d.ts.map +1 -0
- package/dist/memory/contradiction.js +286 -0
- package/dist/memory/contradiction.js.map +1 -0
- package/dist/memory/decay.d.ts +62 -0
- package/dist/memory/decay.d.ts.map +1 -0
- package/dist/memory/decay.js +184 -0
- package/dist/memory/decay.js.map +1 -0
- package/dist/memory/salience.d.ts +36 -0
- package/dist/memory/salience.d.ts.map +1 -0
- package/dist/memory/salience.js +216 -0
- package/dist/memory/salience.js.map +1 -0
- package/dist/memory/similarity.d.ts +57 -0
- package/dist/memory/similarity.d.ts.map +1 -0
- package/dist/memory/similarity.js +114 -0
- package/dist/memory/similarity.js.map +1 -0
- package/dist/memory/store.d.ts +179 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +1184 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/memory/types.d.ts +97 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +30 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +568 -0
- package/dist/server.js.map +1 -0
- package/dist/service/install.d.ts +15 -0
- package/dist/service/install.d.ts.map +1 -0
- package/dist/service/install.js +178 -0
- package/dist/service/install.js.map +1 -0
- package/dist/service/templates.d.ts +13 -0
- package/dist/service/templates.d.ts.map +1 -0
- package/dist/service/templates.js +58 -0
- package/dist/service/templates.js.map +1 -0
- package/dist/setup/claude-md.d.ts +12 -0
- package/dist/setup/claude-md.d.ts.map +1 -0
- package/dist/setup/claude-md.js +68 -0
- package/dist/setup/claude-md.js.map +1 -0
- package/dist/setup/clawdbot.d.ts +15 -0
- package/dist/setup/clawdbot.d.ts.map +1 -0
- package/dist/setup/clawdbot.js +118 -0
- package/dist/setup/clawdbot.js.map +1 -0
- package/dist/setup/doctor.d.ts +5 -0
- package/dist/setup/doctor.d.ts.map +1 -0
- package/dist/setup/doctor.js +141 -0
- package/dist/setup/doctor.js.map +1 -0
- package/dist/setup/hooks.d.ts +6 -0
- package/dist/setup/hooks.d.ts.map +1 -0
- package/dist/setup/hooks.js +36 -0
- package/dist/setup/hooks.js.map +1 -0
- package/dist/setup/migrate.d.ts +16 -0
- package/dist/setup/migrate.d.ts.map +1 -0
- package/dist/setup/migrate.js +164 -0
- package/dist/setup/migrate.js.map +1 -0
- package/dist/setup/settings-hooks.d.ts +7 -0
- package/dist/setup/settings-hooks.d.ts.map +1 -0
- package/dist/setup/settings-hooks.js +83 -0
- package/dist/setup/settings-hooks.js.map +1 -0
- package/dist/setup/uninstall.d.ts +12 -0
- package/dist/setup/uninstall.d.ts.map +1 -0
- package/dist/setup/uninstall.js +125 -0
- package/dist/setup/uninstall.js.map +1 -0
- package/dist/tools/context.d.ts +135 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +273 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/forget.d.ts +53 -0
- package/dist/tools/forget.d.ts.map +1 -0
- package/dist/tools/forget.js +179 -0
- package/dist/tools/forget.js.map +1 -0
- package/dist/tools/graph.d.ts +46 -0
- package/dist/tools/graph.d.ts.map +1 -0
- package/dist/tools/graph.js +206 -0
- package/dist/tools/graph.js.map +1 -0
- package/dist/tools/recall.d.ts +79 -0
- package/dist/tools/recall.d.ts.map +1 -0
- package/dist/tools/recall.js +156 -0
- package/dist/tools/recall.js.map +1 -0
- package/dist/tools/remember.d.ts +83 -0
- package/dist/tools/remember.d.ts.map +1 -0
- package/dist/tools/remember.js +151 -0
- package/dist/tools/remember.js.map +1 -0
- package/dist/worker/brain-worker.d.ts +100 -0
- package/dist/worker/brain-worker.d.ts.map +1 -0
- package/dist/worker/brain-worker.js +283 -0
- package/dist/worker/brain-worker.js.map +1 -0
- package/dist/worker/link-discovery.d.ts +47 -0
- package/dist/worker/link-discovery.d.ts.map +1 -0
- package/dist/worker/link-discovery.js +103 -0
- package/dist/worker/link-discovery.js.map +1 -0
- package/dist/worker/predictive-consolidation.d.ts +46 -0
- package/dist/worker/predictive-consolidation.d.ts.map +1 -0
- package/dist/worker/predictive-consolidation.js +110 -0
- package/dist/worker/predictive-consolidation.js.map +1 -0
- package/dist/worker/types.d.ts +91 -0
- package/dist/worker/types.d.ts.map +1 -0
- package/dist/worker/types.js +22 -0
- package/dist/worker/types.js.map +1 -0
- package/hooks/clawdbot/cortex-memory/HOOK.md +71 -0
- package/hooks/clawdbot/cortex-memory/handler.js +279 -0
- package/package.json +73 -0
- package/scripts/pre-compact-hook.mjs +716 -0
- package/scripts/session-end-hook.mjs +548 -0
- package/scripts/session-start-hook.mjs +221 -0
- package/scripts/start-dashboard.sh +41 -0
- package/scripts/stop-dashboard.sh +21 -0
- package/scripts/stop-hook.mjs +163 -0
|
@@ -0,0 +1,325 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 }
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 }
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
}
|