feat: voeg geselecteerde PBI automatisch toe aan nieuwe sprint

Bij sprint-aanmaak wordt de pbi_id uit de selection-store als hidden
form-field meegestuurd. Server-side worden alle stories van die PBI
(zonder sprint) en hun taken aan de nieuwe sprint gekoppeld; stories
krijgen status IN_SPRINT met incrementele sort_order.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-08 02:09:55 +02:00
parent b55a929fd8
commit 1ecb2d6f4d
3 changed files with 38 additions and 0 deletions

View file

@ -21,6 +21,7 @@ import {
entityDialogHeaderClasses,
} from '@/components/shared/entity-dialog-layout'
import { createSprintAction } from '@/actions/sprints'
import { useSelectionStore } from '@/stores/selection-store'
interface StartSprintButtonProps {
productId: string
@ -44,6 +45,7 @@ export function StartSprintButton({ productId, isDemo = false }: StartSprintButt
const [dirty, setDirty] = useState(false)
const formRef = useRef<HTMLFormElement>(null)
const router = useRouter()
const selectedPbiId = useSelectionStore((s) => s.selectedPbiId)
const [state, formAction, pending] = useActionState<ActionResult | undefined, FormData>(
async (_prev, fd) => {
@ -92,6 +94,7 @@ export function StartSprintButton({ productId, isDemo = false }: StartSprintButt
className="flex-1 overflow-y-auto px-6 py-6 space-y-6"
>
<input type="hidden" name="productId" value={productId} />
{selectedPbiId && <input type="hidden" name="pbi_id" value={selectedPbiId} />}
<div className="space-y-1.5">
<label className="text-sm font-medium text-foreground">