diff --git a/frontend/app/(sidebar)/inventory/page.tsx b/frontend/app/(sidebar)/inventory/page.tsx index ed25255..b93c003 100644 --- a/frontend/app/(sidebar)/inventory/page.tsx +++ b/frontend/app/(sidebar)/inventory/page.tsx @@ -59,6 +59,7 @@ export default function InventoryPage() { queryFn: fetchInventoryItems, staleTime: 60 * 1000, }); + // console.table(inventoryItems); const [searchTerm, setSearchTerm] = useState(""); const handleSearch = () => { // update search state when user clicks or presses enter @@ -79,29 +80,23 @@ export default function InventoryPage() { { accessorKey: "status", header: "Status", - cell: (info: { - getValue: () => - | string - | number - | bigint - | boolean - | ReactElement> - | Iterable - | ReactPortal - | Promise< - | string - | number - | bigint - | boolean - | ReactPortal - | ReactElement> - | Iterable - | null - | undefined - > - | null - | undefined; - }) => {info.getValue()}, + cell: (info: { getValue: () => string }) => { + const status = info.getValue(); + + let statusClass = ""; // default status class + + if (status === "Low Stock") { + statusClass = "bg-yellow-300"; // yellow for low stock + } else if (status === "Out of Stock") { + statusClass = "bg-red-500 text-white"; // red for out of stock + } + + return ( + + {status} + + ); + }, }, { accessorKey: "edit",