import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Edit, Trash } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Product } from "@/models/products"; interface ProductTableProps { products: Product[]; loading: boolean; onEdit: (product: Product) => void; onDelete: (productId: string) => void; // Added onDelete prop getCategoryNameById: (categoryId: string) => string; } const ProductTable = ({ products, loading, onEdit, onDelete, getCategoryNameById }: ProductTableProps) => { const sortedProducts = [...products].sort((a, b) => { const categoryNameA = getCategoryNameById(a.category); const categoryNameB = getCategoryNameById(b.category); return categoryNameA.localeCompare(categoryNameB); }); return (