feat(PBI-79): sprint-switch auto-select PBI/story + user-settings persist
Bij sprint-switch wordt de sprint-content server-side opgevraagd. Wanneer
de sprint precies één PBI (en die PBI exact één story binnen de sprint)
heeft, worden PBI en story automatisch geselecteerd. Alle drie keuzes
(sprint, pbi, story) worden atomair in user-settings opgeslagen zodat ze
cross-device blijven hangen.
- lib/user-settings.ts: layout krijgt nullable activePbis +
activeStories per product.
- lib/active-sprint.ts: setActiveSelectionInSettings schrijft de drie
keys atomair + notify pg_notify.
- actions/active-sprint.ts: switchActiveSprintAction(productId, sprintId)
doet de server-side auto-select-resolutie (single PBI → single story)
en returnt { sprintId, pbiId, storyId }.
- components/shared/sprint-switcher.tsx: handleSwitchSprint roept de
nieuwe action aan en synchroniseert de workspace-store gelijk zodat
de UI geen flash krijgt voor de SSR-refresh.
- components/backlog/active-selection-hydrator.tsx (nieuw): client-side
effect dat user-settings.activePbis/activeStories naar workspace-store
spiegelt; wint van de localStorage hint-restore.
- app/(app)/products/[id]/page.tsx: ActiveSelectionHydrator gemount
binnen BacklogHydrationWrapper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
35c6404b14
commit
d7d11124e3
6 changed files with 205 additions and 4 deletions
|
|
@ -93,6 +93,57 @@ export async function clearActiveSprintInSettings(
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* PBI-79: persisteer sprint-keuze + bijbehorende PBI/story-selectie atomair.
|
||||
* Sprintkeuze blijft 'sleutel met null = bewust geen sprint'-contract trouw;
|
||||
* activePbi/activeStory volgen dezelfde semantiek (null = expliciet leeg).
|
||||
*/
|
||||
export async function setActiveSelectionInSettings(
|
||||
userId: string,
|
||||
productId: string,
|
||||
selection: {
|
||||
sprintId: string | null
|
||||
pbiId?: string | null
|
||||
storyId?: string | null
|
||||
},
|
||||
): Promise<void> {
|
||||
const current = await readSettings(userId)
|
||||
const nextActiveSprints: Record<string, string | null> = {
|
||||
...(current.layout?.activeSprints ?? {}),
|
||||
[productId]: selection.sprintId,
|
||||
}
|
||||
const nextActivePbis: Record<string, string | null> = {
|
||||
...(current.layout?.activePbis ?? {}),
|
||||
}
|
||||
if (selection.pbiId !== undefined) {
|
||||
nextActivePbis[productId] = selection.pbiId
|
||||
}
|
||||
const nextActiveStories: Record<string, string | null> = {
|
||||
...(current.layout?.activeStories ?? {}),
|
||||
}
|
||||
if (selection.storyId !== undefined) {
|
||||
nextActiveStories[productId] = selection.storyId
|
||||
}
|
||||
|
||||
const next: UserSettings = {
|
||||
...current,
|
||||
layout: {
|
||||
...current.layout,
|
||||
activeSprints: nextActiveSprints,
|
||||
activePbis: nextActivePbis,
|
||||
activeStories: nextActiveStories,
|
||||
},
|
||||
}
|
||||
await writeSettings(userId, next)
|
||||
await notifyUserSettings(userId, {
|
||||
layout: {
|
||||
activeSprints: nextActiveSprints,
|
||||
activePbis: nextActivePbis,
|
||||
activeStories: nextActiveStories,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export async function resolveActiveSprint(
|
||||
productId: string,
|
||||
userId: string,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ const DevToolsPrefs = z.object({
|
|||
const LayoutPrefs = z.object({
|
||||
splitPanePositions: z.record(z.string(), z.array(z.number())).optional(),
|
||||
activeSprints: z.record(z.string(), z.string().nullable()).optional(),
|
||||
activePbis: z.record(z.string(), z.string().nullable()).optional(),
|
||||
activeStories: z.record(z.string(), z.string().nullable()).optional(),
|
||||
}).strict()
|
||||
|
||||
const PbiIntent = z.enum(['all', 'none'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue