Skip to content

Commit 39fceb2

Browse files
committed
feat(App): wire up qe-verify change handling
- Add handleQeVerifyChange callback in App.tsx - Pass qe-verify props through Board, Column, BacklogSection - Add stagedQeVerifyBugIds and stagedQeVerifies memos in Board/BacklogSection
1 parent 31e981f commit 39fceb2

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

src/App.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useStore } from './store'
1010
import { useUrlFilters } from './hooks/use-url-filters'
1111
import { useBoardAssignees } from './hooks/use-board-assignees'
1212
import { addSprintTag, removeSprintTag } from './lib/bugzilla/sprint-tag'
13+
import { getQeVerifyStatus, type QeVerifyStatus } from './lib/bugzilla/qe-verify'
1314

1415
function App() {
1516
// Local UI state
@@ -46,6 +47,7 @@ function App() {
4647
const stageWhiteboardChange = useStore((state) => state.stageWhiteboardChange)
4748
const stagePointsChange = useStore((state) => state.stagePointsChange)
4849
const stagePriorityChange = useStore((state) => state.stagePriorityChange)
50+
const stageQeVerifyChange = useStore((state) => state.stageQeVerifyChange)
4951
const applyChanges = useStore((state) => state.applyChanges)
5052
const clearAllChanges = useStore((state) => state.clearAllChanges)
5153
const getChangeCount = useStore((state) => state.getChangeCount)
@@ -218,6 +220,18 @@ function App() {
218220
[bugs, stagePriorityChange],
219221
)
220222

223+
// Handle qe-verify change
224+
const handleQeVerifyChange = useCallback(
225+
(bugId: number, newStatus: QeVerifyStatus) => {
226+
const bug = bugs.find((b) => b.id === bugId)
227+
if (bug) {
228+
const currentStatus = getQeVerifyStatus(bug.flags)
229+
stageQeVerifyChange(bugId, currentStatus, newStatus)
230+
}
231+
},
232+
[bugs, stageQeVerifyChange],
233+
)
234+
221235
// Handle invalid move attempt (e.g., unassigned bug out of backlog)
222236
const handleInvalidMove = useCallback(
223237
(_bugId: number, reason: string) => {
@@ -392,6 +406,7 @@ function App() {
392406
onAssigneeChange={handleAssigneeChange}
393407
onPointsChange={handlePointsChange}
394408
onPriorityChange={handlePriorityChange}
409+
onQeVerifyChange={handleQeVerifyChange}
395410
onInvalidMove={handleInvalidMove}
396411
isLoading={isLoadingBugs}
397412
onApplyChanges={handleApplyChanges}

src/components/Board/BacklogSection.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Card } from './Card'
44
import type { BugzillaBug } from '@/lib/bugzilla/types'
55
import type { StagedChange } from '@/store/slices/staged-slice'
66
import type { Assignee } from '@/hooks/use-board-assignees'
7+
import type { QeVerifyStatus } from '@/lib/bugzilla/qe-verify'
78

89
interface BacklogSectionProps {
910
bugs: BugzillaBug[]
@@ -12,6 +13,7 @@ interface BacklogSectionProps {
1213
onAssigneeChange?: (bugId: number, newAssignee: string) => void
1314
onPointsChange?: (bugId: number, points: number | string | undefined) => void
1415
onPriorityChange?: (bugId: number, priority: string) => void
16+
onQeVerifyChange?: (bugId: number, status: QeVerifyStatus) => void
1517
onBugClick?: (bug: BugzillaBug) => void
1618
isLoading?: boolean
1719
isDropTarget?: boolean
@@ -24,6 +26,7 @@ export function BacklogSection({
2426
onAssigneeChange,
2527
onPointsChange,
2628
onPriorityChange,
29+
onQeVerifyChange,
2730
onBugClick,
2831
isLoading = false,
2932
isDropTarget = false,
@@ -109,6 +112,28 @@ export function BacklogSection({
109112
return map
110113
}, [stagedChanges])
111114

115+
// Get staged qe-verify bug IDs
116+
const stagedQeVerifyBugIds = useMemo(() => {
117+
const ids = new Set<number>()
118+
for (const [bugId, change] of stagedChanges) {
119+
if (change.qeVerify) {
120+
ids.add(bugId)
121+
}
122+
}
123+
return ids
124+
}, [stagedChanges])
125+
126+
// Get staged qe-verifies
127+
const stagedQeVerifies = useMemo(() => {
128+
const map = new Map<number, QeVerifyStatus>()
129+
for (const [bugId, change] of stagedChanges) {
130+
if (change.qeVerify) {
131+
map.set(bugId, change.qeVerify.to)
132+
}
133+
}
134+
return map
135+
}, [stagedChanges])
136+
112137
const stagedCount = bugs.filter((bug) => stagedBugIds.has(bug.id)).length
113138
const countId = 'backlog-count'
114139

@@ -192,10 +217,13 @@ export function BacklogSection({
192217
stagedPoints={stagedPoints.get(bug.id)}
193218
isPriorityStaged={stagedPriorityBugIds.has(bug.id)}
194219
stagedPriority={stagedPriorities.get(bug.id)}
220+
isQeVerifyStaged={stagedQeVerifyBugIds.has(bug.id)}
221+
stagedQeVerify={stagedQeVerifies.get(bug.id)}
195222
allAssignees={allAssignees}
196223
onAssigneeChange={onAssigneeChange}
197224
onPointsChange={onPointsChange}
198225
onPriorityChange={onPriorityChange}
226+
onQeVerifyChange={onQeVerifyChange}
199227
onClick={onBugClick}
200228
/>
201229
</div>

src/components/Board/Board.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { sortBugs } from '@/lib/bugzilla/sort-bugs'
1818
import { filterRecentBugs } from '@/lib/bugzilla/date-filter'
1919
import type { BugzillaBug } from '@/lib/bugzilla/types'
2020
import type { StagedChange } from '@/store/slices/staged-slice'
21+
import type { QeVerifyStatus } from '@/lib/bugzilla/qe-verify'
2122
import { useBoardAssignees } from '@/hooks/use-board-assignees'
2223
import { useStore } from '@/store'
2324

@@ -30,6 +31,7 @@ interface BoardProps {
3031
onAssigneeChange?: (bugId: number, newAssignee: string) => void
3132
onPointsChange?: (bugId: number, points: number | string | undefined) => void
3233
onPriorityChange?: (bugId: number, priority: string) => void
34+
onQeVerifyChange?: (bugId: number, status: QeVerifyStatus) => void
3335
onInvalidMove?: (bugId: number, reason: string) => void
3436
isLoading?: boolean
3537
onApplyChanges?: () => void
@@ -52,6 +54,7 @@ export function Board({
5254
onAssigneeChange,
5355
onPointsChange,
5456
onPriorityChange,
57+
onQeVerifyChange,
5558
onInvalidMove,
5659
isLoading = false,
5760
onApplyChanges,
@@ -194,6 +197,28 @@ export function Board({
194197
return priorities
195198
}, [stagedChanges])
196199

200+
// Get bug IDs with staged qe-verify changes
201+
const stagedQeVerifyBugIds = useMemo(() => {
202+
const ids = new Set<number>()
203+
for (const [bugId, change] of stagedChanges) {
204+
if (change.qeVerify) {
205+
ids.add(bugId)
206+
}
207+
}
208+
return ids
209+
}, [stagedChanges])
210+
211+
// Get staged qe-verifies map (bugId -> new status)
212+
const stagedQeVerifies = useMemo(() => {
213+
const qeVerifies = new Map<number, QeVerifyStatus>()
214+
for (const [bugId, change] of stagedChanges) {
215+
if (change.qeVerify) {
216+
qeVerifies.set(bugId, change.qeVerify.to)
217+
}
218+
}
219+
return qeVerifies
220+
}, [stagedChanges])
221+
197222
// Get all assignees from bugs on the board
198223
const allAssignees = useBoardAssignees(bugs)
199224

@@ -551,10 +576,13 @@ export function Board({
551576
stagedPoints={stagedPoints}
552577
stagedPriorityBugIds={stagedPriorityBugIds}
553578
stagedPriorities={stagedPriorities}
579+
stagedQeVerifyBugIds={stagedQeVerifyBugIds}
580+
stagedQeVerifies={stagedQeVerifies}
554581
allAssignees={allAssignees}
555582
onAssigneeChange={onAssigneeChange}
556583
onPointsChange={onPointsChange}
557584
onPriorityChange={onPriorityChange}
585+
onQeVerifyChange={onQeVerifyChange}
558586
isLoading={isLoading}
559587
selectedIndex={
560588
selectedPosition?.columnIndex === columnIndex
@@ -576,6 +604,7 @@ export function Board({
576604
onAssigneeChange={onAssigneeChange}
577605
onPointsChange={onPointsChange}
578606
onPriorityChange={onPriorityChange}
607+
onQeVerifyChange={onQeVerifyChange}
579608
isLoading={isLoading}
580609
/>
581610
</main>

src/components/Board/Column.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Card } from './Card'
44
import type { BugzillaBug } from '@/lib/bugzilla/types'
55
import type { KanbanColumn } from '@/lib/bugzilla/status-mapper'
66
import type { Assignee } from '@/hooks/use-board-assignees'
7+
import type { QeVerifyStatus } from '@/lib/bugzilla/qe-verify'
78
import { COLUMN_NAMES } from '@/types'
89

910
const NOBODY_EMAIL = 'nobody@mozilla.org'
@@ -29,10 +30,13 @@ interface ColumnProps {
2930
stagedPoints?: Map<number, number | string | undefined>
3031
stagedPriorityBugIds?: Set<number>
3132
stagedPriorities?: Map<number, string>
33+
stagedQeVerifyBugIds?: Set<number>
34+
stagedQeVerifies?: Map<number, QeVerifyStatus>
3235
allAssignees?: Assignee[]
3336
onAssigneeChange?: (bugId: number, newAssignee: string) => void
3437
onPointsChange?: (bugId: number, points: number | string | undefined) => void
3538
onPriorityChange?: (bugId: number, priority: string) => void
39+
onQeVerifyChange?: (bugId: number, status: QeVerifyStatus) => void
3640
isLoading?: boolean
3741
selectedIndex?: number
3842
isGrabbing?: boolean
@@ -57,10 +61,13 @@ export function Column({
5761
stagedPoints,
5862
stagedPriorityBugIds,
5963
stagedPriorities,
64+
stagedQeVerifyBugIds,
65+
stagedQeVerifies,
6066
allAssignees,
6167
onAssigneeChange,
6268
onPointsChange,
6369
onPriorityChange,
70+
onQeVerifyChange,
6471
isLoading = false,
6572
selectedIndex,
6673
isGrabbing = false,
@@ -173,12 +180,15 @@ export function Column({
173180
stagedPoints={stagedPoints?.get(bug.id)}
174181
isPriorityStaged={stagedPriorityBugIds?.has(bug.id)}
175182
stagedPriority={stagedPriorities?.get(bug.id)}
183+
isQeVerifyStaged={stagedQeVerifyBugIds?.has(bug.id)}
184+
stagedQeVerify={stagedQeVerifies?.get(bug.id)}
176185
isSelected={selectedIndex === index}
177186
isGrabbed={selectedIndex === index && isGrabbing}
178187
allAssignees={filteredAssignees}
179188
onAssigneeChange={onAssigneeChange}
180189
onPointsChange={onPointsChange}
181190
onPriorityChange={onPriorityChange}
191+
onQeVerifyChange={onQeVerifyChange}
182192
/>
183193
))}
184194
</div>

0 commit comments

Comments
 (0)