- Product aanmaken/bewerken/archiveren/herstellen (ST-101, ST-103) - SplitPane component met versleepbare splitter en localStorage (ST-104) - PanelNavBar herbruikbaar paneelheader component (ST-105) - PbiList met prioriteitsgroepen, inline aanmaken, filter en verwijderen (ST-106-ST-110) - StoryPanel placeholder rechter paneel met selectie via Zustand (ST-109) - App iconen geinstalleerd: favicon, apple-icon, PWA manifest (192/512px) - AppIcon SVG component in navigatiebar - Root layout metadata bijgewerkt naar Nederlands Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { useState, useTransition } from 'react'
|
|
import { Button } from '@/components/ui/button'
|
|
import { archiveProductAction } from '@/actions/products'
|
|
|
|
interface ArchiveProductButtonProps {
|
|
productId: string
|
|
}
|
|
|
|
export function ArchiveProductButton({ productId }: ArchiveProductButtonProps) {
|
|
const [confirming, setConfirming] = useState(false)
|
|
const [isPending, startTransition] = useTransition()
|
|
|
|
function handleArchive() {
|
|
startTransition(async () => {
|
|
await archiveProductAction(productId)
|
|
})
|
|
}
|
|
|
|
if (confirming) {
|
|
return (
|
|
<div className="flex gap-2 shrink-0">
|
|
<Button
|
|
variant="destructive"
|
|
size="sm"
|
|
disabled={isPending}
|
|
onClick={handleArchive}
|
|
>
|
|
{isPending ? 'Bezig…' : 'Ja, archiveer'}
|
|
</Button>
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
onClick={() => setConfirming(false)}
|
|
disabled={isPending}
|
|
>
|
|
Annuleren
|
|
</Button>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
className="shrink-0 border-error/40 text-error hover:bg-error/10"
|
|
onClick={() => setConfirming(true)}
|
|
>
|
|
Archiveren
|
|
</Button>
|
|
)
|
|
}
|