diff --git a/components/dashboard/product-list.tsx b/components/dashboard/product-list.tsx index c8e5fdd..b85390a 100644 --- a/components/dashboard/product-list.tsx +++ b/components/dashboard/product-list.tsx @@ -2,7 +2,7 @@ import Link from 'next/link' import { useRouter } from 'next/navigation' -import { useTransition } from 'react' +import { useState, useTransition } from 'react' import { toast } from 'sonner' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' @@ -10,7 +10,7 @@ import { CodeBadge } from '@/components/shared/code-badge' import { DemoTooltip } from '@/components/shared/demo-tooltip' import { restoreProductAction } from '@/actions/products' import { setActiveProductAction } from '@/actions/active-product' -import { EditProductButton } from '@/components/products/edit-product-button' +import { ProductDialog, type ProductDialogProduct } from '@/components/dialogs/product-dialog' interface Product { id: string @@ -32,6 +32,7 @@ interface ProductListProps { export function ProductList({ products, isDemo, showArchived = false, activeProductId }: ProductListProps) { const router = useRouter() const [, startTransition] = useTransition() + const [editingProduct, setEditingProduct] = useState(null) function handleRestore(id: string) { startTransition(async () => { @@ -104,7 +105,16 @@ export function ProductList({ products, isDemo, showArchived = false, activeProd )} {!showArchived && ( <> - + + + {product.id === activeProductId ? Actief : ( @@ -136,6 +146,15 @@ export function ProductList({ products, isDemo, showArchived = false, activeProd ))} + {editingProduct && ( + { if (!v) setEditingProduct(null) }} + product={editingProduct} + isDemo={isDemo} + /> + )} ) }