brackt/app/routes/api
Chris Parsons 1ba50828f7
Claude/redesign autodraft queue c4 kp r (#40)
* Redesign autodraft queue system with three-state control and queue-only constraint

Core Logic & Database:
- Add `queue_only` boolean column to `autodraft_settings` (migration 0031)
- Rename autodraft UI states: Off / Next Pick / All Picks (while_on mode maps to All Picks)
- `autoPickForTeam`: respects new `queueOnly` param — skips EV fallback when enabled
- `executeAutoPick`: auto-disables autodraft + emits socket event when queue empties with queueOnly ON (AC3)
- `autodraft-updated` socket event now includes `queueOnly` field

Mobile UI Overhaul:
- Rename "Lobby" tab → "Available" (AC6)
- Add new "Queue" tab to mobile bottom nav with drag-reorder, per-item Draft buttons, and autodraft controls (AC5)
- Controls tab retains commissioner tools, notifications, exit; queue controls moved to Queue tab
- Turn indicator appears on both Available and Queue tabs

Components:
- `AutodraftSettings`: replaces toggle+radio with three-state button group (Off | Next Pick | All Picks) + "Only autodraft from queue" switch (AC1, AC2)
- `QueueSection`: adds `canPick` prop + per-item Draft buttons for instant drafting when on the clock

Desktop (AC4):
- Sidebar QueueSection unchanged in position; gains same three-state controls and Draft buttons

Tests (AC7):
- `autodraft.test.ts`: updated for queueOnly field and socket event shape
- `timer-autodraft.test.ts`: new tests for queue-only constraint, auto-shutoff transitions, and all three autodraft states

https://claude.ai/code/session_01PYhJicAStoJ2u6q6dV1naB

* fix: remove erroneous ?? fallbacks in autodraft socket emissions and add autoPickForTeam tests

- Remove `?? true` default on queueOnly in queue-empty auto-disable socket emit
  (line 488) — was dead code since the column is NOT NULL, but semantically wrong
  and would have caused client-side UI desync if the type ever relaxed
- Remove `?? false` default on the next_pick auto-disable path for consistency
- Add app/models/__tests__/auto-pick.test.ts with 6 tests covering the queueOnly
  constraint: empty queue, all items drafted, partial queue skip, and EV fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add missing queueOnly prop to AutodraftSettings test fixtures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: rewrite AutodraftSettings tests for three-state button group UI

The component was redesigned from a switch + radio buttons to Off/Next Pick/All Picks
buttons with a separate queue-only Switch toggle. Updated 17 stale tests and added 5
new tests covering the queue-only toggle and the All Picks/Off button interactions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 22:16:26 -08:00
..
__tests__ fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
webhooks refactor: simplify user update logic in Clerk webhook handler to reuse findOrCreateUser 2025-10-14 21:50:07 -07:00
autodraft.update.ts Claude/redesign autodraft queue c4 kp r (#40) 2026-02-27 22:16:26 -08:00
draft.adjust-time-bank.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.force-autopick.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.force-manual-pick.ts fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
draft.make-pick.ts fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
draft.pause.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.replace-pick.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.resume.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.rollback.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.start.ts fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
queue.add.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
queue.clear.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
queue.remove.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
queue.reorder.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00