feat: ProductMember — team management for product backlogs
- Add ProductMember model (many-to-many User ↔ Product) - Add productAccessFilter helper (owner OR member OR clause) - Replace all ownership checks across actions and API routes - Add addProductMemberAction / removeProductMemberAction / leaveProductAction - Add TeamManager component in product settings (owner adds/removes Developers) - Add LeaveProductButton in user settings (member leaves a product team) - Regenerate Prisma Client after schema migration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fc12e3cc64
commit
357b1e32e8
18 changed files with 370 additions and 82 deletions
44
components/settings/leave-product-button.tsx
Normal file
44
components/settings/leave-product-button.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
'use client'
|
||||
|
||||
import { useState, useTransition } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { leaveProductAction } from '@/actions/products'
|
||||
|
||||
interface LeaveProductButtonProps {
|
||||
productId: string
|
||||
}
|
||||
|
||||
export function LeaveProductButton({ productId }: LeaveProductButtonProps) {
|
||||
const [confirming, setConfirming] = useState(false)
|
||||
const [isPending, startTransition] = useTransition()
|
||||
|
||||
function handleLeave() {
|
||||
startTransition(async () => {
|
||||
await leaveProductAction(productId)
|
||||
})
|
||||
}
|
||||
|
||||
if (confirming) {
|
||||
return (
|
||||
<div className="flex gap-2 shrink-0">
|
||||
<Button variant="destructive" size="sm" disabled={isPending} onClick={handleLeave}>
|
||||
{isPending ? 'Bezig…' : 'Ja, verlaten'}
|
||||
</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)}
|
||||
>
|
||||
Verlaten
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue