brackt/app/routes/api
Chris Parsons 285981ab9d
Improve draft room UX with better error handling and UI refinements (#17)
* Remove pause/resume controls when draft is complete, rename Live to Connected

- Hide Pause/Resume Draft buttons when isDraftComplete is true
- Change 'Live' status indicator to 'Connected' in both draft room and draft board views

https://claude.ai/code/session_01AUaKzx465NrY29Qv6MVwjC

* Fix code review issues in draft room: security, bugs, and quality

Security:
- Fix inconsistent commissioner check: draft.start, force-autopick, force-manual-pick,
  and make-pick all now query the commissioners table instead of league.createdBy,
  so co-commissioners have consistent access to all draft controls

Bugs:
- canPick now includes !isPaused so the UI correctly blocks picks during a pause
- isDraftComplete initial state now covers 'completed' season status, not just 'active'
- Guard JSON.parse in queue.reorder.ts with try/catch to return 400 instead of 500

Code quality:
- Add error handling (try/catch + toast) to handlePauseDraft, handleResumeDraft,
  handleRemoveFromQueue, and handleReorderQueue
- Replace alert() with toast.error() in handleMakePick, handleForceAutopick,
  handleForceManualPick for consistent UX
- Memoize filteredParticipants with useMemo to avoid recomputing on every render
- Replace custom force-pick dialog div with ShadCN Dialog component for proper
  keyboard support (Escape to close, focus trap, accessible markup); add dialog.tsx
- Remove console.log debug statements from socket event handlers and API routes
- Replace (global as any).__socketIO with getSocketIO() across all API routes
- Replace window.location.reload() in handleStartDraft with useRevalidator

https://claude.ai/code/session_01AUaKzx465NrY29Qv6MVwjC

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-20 21:50:27 -08:00
..
__tests__ feat: Implement drag-and-drop functionality for queue items; add duplicate prevention for participants in queue 2025-10-25 21:02:16 -07: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 refactor: update import paths to use absolute paths for better clarity and maintainability 2025-10-24 21:20:19 -07:00
draft.force-autopick.ts Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00
draft.force-manual-pick.ts Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00
draft.make-pick.ts Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00
draft.pause.ts Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00
draft.resume.ts Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00
draft.start.ts Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00
queue.add.ts feat: Implement drag-and-drop functionality for queue items; add duplicate prevention for participants in queue 2025-10-25 21:02:16 -07:00
queue.clear.ts feat: add queue management UI and API endpoints for draft room 2025-10-17 17:42:40 -07:00
queue.remove.ts feat: add queue management UI and API endpoints for draft room 2025-10-17 17:42:40 -07:00
queue.reorder.ts Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00