import { useTranslation } from "react-i18next"; import { Pencil, Trash2 } from "lucide-react"; import type { MemoryEntry } from "@/api/memory"; import { cn } from "@/lib/utils"; interface MemoryListProps { entries: MemoryEntry[]; onEdit: (entry: MemoryEntry) => void; onDelete: (entryId: string) => void; } const importanceColors: Record = { critical: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400", high: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400", medium: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400", low: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-400", }; export function MemoryList({ entries, onEdit, onDelete }: MemoryListProps) { const { t } = useTranslation(); if (entries.length === 0) { return

{t("memory.no_entries")}

; } // Group by category const grouped = entries.reduce>((acc, entry) => { (acc[entry.category] ??= []).push(entry); return acc; }, {}); return (
{Object.entries(grouped).map(([category, items]) => (

{t(`memory.categories.${category}`)}

{items.map((entry) => (

{entry.title}

{t(`memory.importance_levels.${entry.importance}`)}

{entry.content}

))}
))}
); }