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,
|
||||
} from '@/actions/active-sprint'
|
||||
import { useProductWorkspaceStore } from '@/stores/product-workspace/store'
|
||||
import { deriveScreenState } from '@/stores/product-workspace/screen-state'
|
||||
import { useUserSettingsStore } from '@/stores/user-settings/store'
|
||||
import type { SprintStatusApi } from '@/lib/task-status'
|
||||
import { debugProps } from '@/lib/debug'
|
||||
|
|
@ -57,6 +58,20 @@ export function SprintSwitcher({
|
|||
const draftGoal = useUserSettingsStore(
|
||||
(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 => {
|
||||
if (showClosed) return true
|
||||
|
|
@ -139,10 +154,19 @@ export function SprintSwitcher({
|
|||
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"
|
||||
>
|
||||
<span className="truncate max-w-[160px]">
|
||||
{activeSprint ? activeSprint.code : 'Selecteer sprint'}
|
||||
<span
|
||||
className={cn(
|
||||
'truncate max-w-[160px]',
|
||||
screenState.kind === 'DRAFT' && 'italic text-tertiary',
|
||||
)}
|
||||
>
|
||||
{screenState.kind === 'DRAFT'
|
||||
? `⚙ Concept — ${draftGoal}`
|
||||
: activeSprint
|
||||
? activeSprint.code
|
||||
: 'Selecteer sprint'}
|
||||
</span>
|
||||
{activeSprint && (
|
||||
{screenState.kind !== 'DRAFT' && activeSprint && (
|
||||
<span
|
||||
className={cn(
|
||||
'text-sm',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue