"use client"; import { useEffect } from "react"; import { useProducts } from "@/hooks/use-products"; import { OfflineState } from "@/components/ui/offline-state"; import { CreateProductDialog } from "@/components/products/create-product-dialog"; import { ProductTable } from "@/components/products/product-table"; import { usePageRefresh } from "@/hooks"; /** Products tab content — extracted from the standalone /products page so it * can live inside the Workstation tab shell (see workstation/page.tsx). */ export function ProductsView() { const { data: products, isLoading, error, refetch } = useProducts(); const { register, unregister, refresh } = usePageRefresh(); useEffect(() => { const cb = () => { void refetch(); }; register(cb); return () => unregister(cb); }, [register, unregister, refetch]); // Check if it's a connection error (backend not running) const isOffline = error && (error.message?.includes("Network Error") || error.message?.includes("ECONNREFUSED") || (error as { code?: string })?.code === "ERR_NETWORK"); return (
{/* Header */}

Products

Map each cell to the project it works on for a product

{/* Content */} {isOffline ? ( void refresh()} /> ) : ( )}
); }