"use client";
import Link from "next/link";
import { useMemory } from "@/lib/hooks";
function Bar({ label, usage }: { label: string; usage: string }) {
const pctMatch = usage.match(/(\d+)%/);
const pct = pctMatch ? parseInt(pctMatch[1]) : 0;
return (
{label}
85 ? "#ff3b30" : "var(--accent)",
}}
/>
{pct}%
);
}
export function MemorySnapshotCard() {
const { data } = useMemory();
const mem = data?.targets?.find((t) => t.target === "memory");
const usr = data?.targets?.find((t) => t.target === "user");
return (
Memory
{(mem?.entry_count || 0) + (usr?.entry_count || 0)} entries
{mem &&
}
{usr &&
}
);
}