import React, { useState } from 'react'; import { AuthProvider, AuthGuard, useAuth } from './AdminAuth'; import AdminLayout from './AdminLayout'; interface Product { id: string; name: string; brand: string; price: number; image?: string; shop_count: number; category?: string; } function ProductTableContent() { const { token } = useAuth(); const [search, setSearch] = useState(''); const [brandFilter, setBrandFilter] = useState(''); const [selected, setSelected] = useState>(new Set()); const [page, setPage] = useState(1); // Mock products const allProducts: Product[] = [ { id: '1', name: 'Nike Dunk Low Panda', brand: 'Nike', price: 109, shop_count: 6, category: 'Sneakers' }, { id: '2', name: 'New Balance 550 White Grey', brand: 'New Balance', price: 149, shop_count: 4, category: 'Sneakers' }, { id: '3', name: 'Adidas Samba OG', brand: 'Adidas', price: 100, shop_count: 8, category: 'Sneakers' }, { id: '4', name: 'Nike Air Max 90', brand: 'Nike', price: 139, shop_count: 5, category: 'Sneakers' }, { id: '5', name: 'Asics Gel-1130', brand: 'Asics', price: 120, shop_count: 3, category: 'Sneakers' }, { id: '6', name: 'Adidas Gazelle Bold', brand: 'Adidas', price: 110, shop_count: 7, category: 'Sneakers' }, ]; const brands = [...new Set(allProducts.map(p => p.brand))]; const filtered = allProducts.filter(p => (!search || p.name.toLowerCase().includes(search.toLowerCase())) && (!brandFilter || p.brand === brandFilter) ); const toggleSelect = (id: string) => { setSelected(prev => { const next = new Set(prev); next.has(id) ? next.delete(id) : next.add(id); return next; }); }; const toggleAll = () => { if (selected.size === filtered.length) setSelected(new Set()); else setSelected(new Set(filtered.map(p => p.id))); }; return (
setSearch(e.target.value)} className="bg-[#141414] border border-[#333] rounded-lg px-4 py-2 text-sm text-[#F5F5F5] focus:outline-none focus:border-[#00FF6A] flex-1 max-w-md" />
{selected.size > 0 && (
{selected.size} selected
)}
{filtered.map(product => ( ))}
0} className="accent-[#00FF6A]" /> Product Brand Price Shops Actions
toggleSelect(product.id)} className="accent-[#00FF6A]" />
{product.name}
{product.brand} €{product.price} {product.shop_count}
{filtered.length} products
Page {page}
); } export default function ProductTablePage() { return ; }