"use client"; import { useTranslations } from "next-intl"; // ─── Types ──────────────────────────────────────────────────────────────────── interface MemoryCardsProps { memoryEntries?: number; dbEntries?: number; hits?: number; misses?: number; hitRate?: string; tokensSaved?: number; loading?: boolean; error?: string | null; onRetry?: () => void; } // ─── Internal StatCard ──────────────────────────────────────────────────────── function StatCard({ icon, label, value, sub, valueClass = "text-text", }: { icon: string; label: string; value: string | number; sub?: string; valueClass?: string; }) { return (
{label}
{value}
{sub &&
{sub}
}
); } // ─── Skeleton card ──────────────────────────────────────────────────────────── function SkeletonCard() { return (
); } // ─── MemoryCards ────────────────────────────────────────────────────────────── export default function MemoryCards({ memoryEntries = 0, dbEntries = 0, hits = 0, misses: _misses = 0, hitRate, tokensSaved = 0, loading = false, error = null, onRetry, }: MemoryCardsProps) { const t = useTranslations("cache"); if (loading) { return (
); } if (error) { return (

{error}

{onRetry && ( )}
); } return (
); }