diff --git a/src/components/products/ProductFiltersBar.tsx b/src/components/products/ProductFiltersBar.tsx new file mode 100644 index 0000000..ca9185a --- /dev/null +++ b/src/components/products/ProductFiltersBar.tsx @@ -0,0 +1,38 @@ +'use client' +import type { ProductFilters } from '@/types/products' + +interface Props { + filters: ProductFilters + total: number + onChange: (f: Partial) => void +} + +export function ProductFiltersBar({ filters, total, onChange }: Props) { + return ( +
+ onChange({ search: e.target.value })} + className="flex-1 min-w-48 bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500" + /> +
+ {(['all', 'active', 'draft'] as const).map((s) => ( + + ))} +
+ {total} produit{total > 1 ? 's' : ''} +
+ ) +} diff --git a/src/components/products/ProductTable.tsx b/src/components/products/ProductTable.tsx new file mode 100644 index 0000000..05d91dc --- /dev/null +++ b/src/components/products/ProductTable.tsx @@ -0,0 +1,80 @@ +'use client' +import type { CatalogProduct } from '@/types/products' + +interface Props { + products: CatalogProduct[] + loading: boolean +} + +const PAGE_SIZE = 50 + +export function ProductTable({ products, loading }: Props) { + if (loading) { + return ( +
+ Chargement des produits… +
+ ) + } + + if (products.length === 0) { + return ( +
+ Aucun produit trouvé. +
+ ) + } + + const displayed = products.slice(0, PAGE_SIZE) + + return ( +
+ + + + + + + + + + + + + {displayed.map((p) => ( + + + + + + + + + ))} + +
RéférenceTitrePrixStockStatutLien
{p.ref}{p.title}{p.price} €{p.stock} + + {p.status === 'active' ? 'Actif' : 'Inactif'} + + + + Shopify ↗ + +
+ {products.length > PAGE_SIZE && ( +

+ Affichage des {PAGE_SIZE} premiers résultats sur {products.length}. +

+ )} +
+ ) +}