feat(dashboard,nav): edit-knop op productlijst + zichtbare product-switch
- nav-bar: vervang `router.push(/products/{id})` door `router.refresh()` na
setActiveProductAction; voeg success-toast toe. Maakt de actieve-product
switch zichtbaar zonder context-switch naar de detail-page; client-cache
wordt nu correct geinvalideerd.
- product-list (dashboard): integreer EditProductButton naast Activeer/Actief.
Owner én members kunnen editten (per productAccessFilter); demo-modus
rendert disabled+tooltip.
- edit-product-button: optionele isDemo + size + variant props; wraps
DemoTooltip; e.stopPropagation om card-click te voorkomen.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d8e6a68d69
commit
a839ac76c6
3 changed files with 40 additions and 19 deletions
|
|
@ -2,25 +2,37 @@
|
|||
|
||||
import { useState } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { DemoTooltip } from '@/components/shared/demo-tooltip'
|
||||
import { ProductDialog, type ProductDialogProduct } from '@/components/dialogs/product-dialog'
|
||||
|
||||
interface Props {
|
||||
product: ProductDialogProduct
|
||||
isDemo?: boolean
|
||||
size?: 'sm' | 'default'
|
||||
variant?: 'outline' | 'ghost'
|
||||
}
|
||||
|
||||
export function EditProductButton({ product }: Props) {
|
||||
export function EditProductButton({ product, isDemo = false, size = 'sm', variant = 'outline' }: Props) {
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button variant="outline" size="sm" onClick={() => setOpen(true)}>
|
||||
Bewerken
|
||||
</Button>
|
||||
<DemoTooltip show={isDemo}>
|
||||
<Button
|
||||
variant={variant}
|
||||
size={size}
|
||||
onClick={(e) => { e.stopPropagation(); if (!isDemo) setOpen(true) }}
|
||||
disabled={isDemo}
|
||||
>
|
||||
Bewerken
|
||||
</Button>
|
||||
</DemoTooltip>
|
||||
<ProductDialog
|
||||
mode="edit"
|
||||
open={open}
|
||||
onOpenChange={setOpen}
|
||||
product={product}
|
||||
isDemo={isDemo}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue