feat(ST-1369): SprintSwitcher op deriveScreenState + draft op trigger (G5)
De trigger-knop toont nu de concept-sprint zodra er een sprint-draft loopt, niet langer alleen de (disabled) dropdown-regel. Schermstaat-afleiding loopt via de pure deriveScreenState() i.p.v. losse flags. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3171daed9e
commit
32410d41a2
1 changed files with 27 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ import {
|
||||||
switchActiveSprintAction,
|
switchActiveSprintAction,
|
||||||
} from '@/actions/active-sprint'
|
} from '@/actions/active-sprint'
|
||||||
import { useProductWorkspaceStore } from '@/stores/product-workspace/store'
|
import { useProductWorkspaceStore } from '@/stores/product-workspace/store'
|
||||||
|
import { deriveScreenState } from '@/stores/product-workspace/screen-state'
|
||||||
import { useUserSettingsStore } from '@/stores/user-settings/store'
|
import { useUserSettingsStore } from '@/stores/user-settings/store'
|
||||||
import type { SprintStatusApi } from '@/lib/task-status'
|
import type { SprintStatusApi } from '@/lib/task-status'
|
||||||
import { debugProps } from '@/lib/debug'
|
import { debugProps } from '@/lib/debug'
|
||||||
|
|
@ -57,6 +58,20 @@ export function SprintSwitcher({
|
||||||
const draftGoal = useUserSettingsStore(
|
const draftGoal = useUserSettingsStore(
|
||||||
(s) => s.entities.settings.workflow?.pendingSprintDraft?.[productId]?.goal ?? null,
|
(s) => s.entities.settings.workflow?.pendingSprintDraft?.[productId]?.goal ?? null,
|
||||||
)
|
)
|
||||||
|
const pendingAdds = useProductWorkspaceStore(
|
||||||
|
(s) => s.sprintMembership.pending.adds,
|
||||||
|
)
|
||||||
|
const pendingRemoves = useProductWorkspaceStore(
|
||||||
|
(s) => s.sprintMembership.pending.removes,
|
||||||
|
)
|
||||||
|
|
||||||
|
const screenState = deriveScreenState({
|
||||||
|
activeSprintItem: activeSprint,
|
||||||
|
buildingSprintIds,
|
||||||
|
hasPendingDraft: draftGoal !== null,
|
||||||
|
pendingAdds,
|
||||||
|
pendingRemoves,
|
||||||
|
})
|
||||||
|
|
||||||
const visibleSprints = sprints.filter(s => {
|
const visibleSprints = sprints.filter(s => {
|
||||||
if (showClosed) return true
|
if (showClosed) return true
|
||||||
|
|
@ -139,10 +154,19 @@ export function SprintSwitcher({
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
className="flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded-md hover:bg-surface-container focus:outline-none"
|
className="flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded-md hover:bg-surface-container focus:outline-none"
|
||||||
>
|
>
|
||||||
<span className="truncate max-w-[160px]">
|
<span
|
||||||
{activeSprint ? activeSprint.code : 'Selecteer sprint'}
|
className={cn(
|
||||||
|
'truncate max-w-[160px]',
|
||||||
|
screenState.kind === 'DRAFT' && 'italic text-tertiary',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{screenState.kind === 'DRAFT'
|
||||||
|
? `⚙ Concept — ${draftGoal}`
|
||||||
|
: activeSprint
|
||||||
|
? activeSprint.code
|
||||||
|
: 'Selecteer sprint'}
|
||||||
</span>
|
</span>
|
||||||
{activeSprint && (
|
{screenState.kind !== 'DRAFT' && activeSprint && (
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
'text-sm',
|
'text-sm',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue