'use client'; import { useState } from 'react'; import { Item } from '@/lib/db'; import { ChevronRight, ChevronDown, Layers, Package } from 'lucide-react'; import { clsx, type ClassValue } from 'clsx'; import { twMerge } from 'tailwind-merge'; function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } interface InventoryTableProps { items: Item[]; categories: string[]; expandedCategory: string | null; onExpandCategory: (category: string | null) => void; onItemClick: (item: Item) => void; onEditCategory?: (category: string) => void; categoriesList?: any[]; } export default function InventoryTable({ items, categories, expandedCategory, onExpandCategory, onItemClick, onEditCategory, categoriesList = [] }: InventoryTableProps) { if (categories.length === 0) { return (

No results found

); } return (
{categories.map(cat => { const categoryItems = items.filter(i => i.category === cat); return (
onExpandCategory(expandedCategory === cat ? null : cat)} >

{cat}

{categoryItems.length} Item types in stock

{expandedCategory === cat ? : } {onEditCategory && ( )}
{expandedCategory === cat && (
{categoryItems.map(item => (
onItemClick(item)} className="bg-background/40 border border-slate-800/50 p-4 lg:p-5 xl:p-6 lg:p-8 xl:p-10 rounded-2xl flex items-center justify-between hover:border-primary/40 cursor-pointer transition-all active:scale-[0.98]" >

{item.name}

{item.specs}

{item.quantity}

Stock

))}
)}
); })}
); } // EditIcon component (lucide-react equivalent) function EditIcon({ size = 24 }: { size?: number }) { return ( ); }