"use client"; import Link from "next/link"; import { Brain } from "lucide-react"; import { useMemory } from "@/lib/hooks"; function UsageBar({ label, usage }: { label: string; usage: string }) { // usage format: "42% — 939/2,200 chars" const pctMatch = usage.match(/(\d+)%/); const pct = pctMatch ? parseInt(pctMatch[1]) : 0; const color = pct > 85 ? "#ef4444" : pct > 65 ? "#f59e0b" : "#38bdf8"; return (
{label} {usage}
); } export function MemorySnapshotCard() { const { data } = useMemory(); const memoryTarget = data?.targets?.find((t) => t.target === "memory"); const userTarget = data?.targets?.find((t) => t.target === "user"); return (
Memory {(memoryTarget?.entry_count || 0) + (userTarget?.entry_count || 0)} entries
{memoryTarget && ( )} {userTarget && ( )}
); }