brackt/app/components/ui
Chris Parsons b8b58ec9f8
Add draft email notifications feature (#459)
* Add on-the-clock email notifications and fix push notification modal

- Add `draft_email_notifications_enabled` column to users table
- New `sendOnTheClockEmail` service sends an email when a user's turn arrives
  in a draft; detects back-to-back picks and sends one combined email instead
  of two; skips notification if the team has autodraft enabled
- Email is triggered after every manual pick (make-pick route) and every
  timer-expiry pick (executeAutoPick) once the full autodraft chain settles,
  so the notified user is always the first human on the clock
- Add email notification toggle to the user settings Notifications section
- Fix push notification dropdown in the draft room: the bare absolute div is
  replaced with a Radix Popover so clicking outside dismisses it without
  toggling notifications off
- Rename draft room label from "Pick Notifications" to "Push Notifications"
  to distinguish from the new email notifications

https://claude.ai/code/session_01LMGxgYvtE3CF8Jf3u2pXgA

* Address code review feedback on email notification feature

- sendOnTheClockEmail now fetches season (and currentPickNumber) internally,
  removing the blocking postChainSeason pre-fetch from both make-pick.ts and
  executeAutoPick; callers are now true fire-and-forget with no IIFE needed
- Parallel Promise.all for team, autodraftSettings, and league queries reduces
  sequential DB round-trips from 5 to 3
- Remove team.ownerId type cast; assign to local after the null guard
- Combine the two calculatePickInfo calls for the same pick into one
- Fix popoverOpen/enabled divergence: remove the {enabled && ...} guard on
  PopoverContent so popoverOpen is the sole visibility control
- Unify NotificationsSection feedback pattern: both Discord and email sections
  now read success/error directly from their respective fetcher data via a
  shared feedbackFromFetcher helper; removes the success/error props and the
  verbose cast that was used for email
- Add 13 unit tests for sendOnTheClockEmail covering: early-exit paths
  (no season, past totalPicks, no owner, notifications disabled, autodraft
  enabled, no league), single vs back-to-back subject selection, draft room
  link presence, error logging without throwing, and parallel query execution

https://claude.ai/code/session_01LMGxgYvtE3CF8Jf3u2pXgA

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-20 15:35:43 -07:00
..
__tests__ Harden sport icon cleanup (#397) 2026-05-08 21:19:09 -07:00
accordion.tsx feat: Integrate accordion component for sidebar and update autodraft settings to sync with props 2025-10-25 10:04:21 -07:00
alert-dialog.tsx feat: add commissioner model and league management features 2025-10-11 00:29:04 -07:00
AvatarEditor.tsx Fix avatar display bugs in navbar, standings, and draft views (#387) 2026-05-06 17:03:34 -07:00
AvatarUploader.tsx Add Cloudinary-backed avatar system (#385) 2026-05-06 14:47:37 -07:00
badge.tsx feat: add admin routes and checkbox component for sports management 2025-10-12 21:54:49 -07:00
BracktGradients.tsx Add Storybook stories for new components from staged changes (#321) 2026-04-23 22:09:25 -07:00
button.stories.tsx Initial storybook components. 2026-03-29 22:09:45 -07:00
button.tsx Add Storybook stories for new components from staged changes (#321) 2026-04-23 22:09:25 -07:00
calendar.tsx feat: add draft date/time selection to league creation and settings 2025-10-15 22:02:21 -07:00
card.tsx Add Storybook stories for new components from staged changes (#321) 2026-04-23 22:09:25 -07:00
checkbox.stories.tsx Initial storybook components. 2026-03-29 22:09:45 -07:00
checkbox.tsx feat: add admin routes and checkbox component for sports management 2025-10-12 21:54:49 -07:00
collapsible.tsx feat: Implement draft room redesign with collapsible sidebar and tabbed content 2025-10-25 03:23:41 -07:00
context-menu.tsx feat: add draft API routes and implement draft room pick controls 2025-10-18 14:55:26 -07:00
dialog.tsx Improve draft room UX with better error handling and UI refinements (#17) 2026-02-20 21:50:27 -08:00
FlagBuilder.stories.tsx Add Cloudinary-backed avatar system (#385) 2026-05-06 14:47:37 -07:00
FlagBuilder.tsx Add Cloudinary-backed avatar system (#385) 2026-05-06 14:47:37 -07:00
FlagSvg.stories.tsx Add Cloudinary-backed avatar system (#385) 2026-05-06 14:47:37 -07:00
FlagSvg.tsx Improve flag config validation and remove settings completion tracking (#390) 2026-05-07 10:09:45 -07:00
GradientIcon.tsx New design (#309) 2026-04-23 13:14:55 -07:00
input.tsx feat: add fantasy league schema and new league routes 2025-10-11 00:07:39 -07:00
label.tsx feat: add fantasy league schema and new league routes 2025-10-11 00:07:39 -07:00
navigation-menu.tsx feat: add theme system with dark mode support and navbar component 2025-10-10 23:30:26 -07:00
popover.tsx Add draft email notifications feature (#459) 2026-05-20 15:35:43 -07:00
radio-group.tsx feat: add sports selection and team management to league settings 2025-10-13 19:59:34 -07:00
SectionCardHeader.tsx New design (#309) 2026-04-23 13:14:55 -07:00
select.tsx Formalize simulator system with manifest, input-policy, runner, and admin UI (#409) 2026-05-11 21:09:53 -07:00
sheet.tsx feat: add theme system with dark mode support and navbar component 2025-10-10 23:30:26 -07:00
sonner.tsx feat: add commissioner model and league management features 2025-10-11 00:29:04 -07:00
SportIconUploader.tsx Harden sport icon cleanup (#397) 2026-05-08 21:19:09 -07:00
switch.tsx feat: add autodraft status and team connection indicators to draft grid 2025-10-21 23:22:17 -07:00
table.tsx feat: add admin routes and checkbox component for sports management 2025-10-12 21:54:49 -07:00
tabs.tsx feat: Implement draft room redesign with collapsible sidebar and tabbed content 2025-10-25 03:23:41 -07:00
team-name-display.tsx Display team owner names in standings views (#184) 2026-03-19 20:19:28 -07:00
team-owner-badge.stories.tsx Add Storybook stories for new components from staged changes (#321) 2026-04-23 22:09:25 -07:00
team-owner-badge.tsx Add Storybook stories for new components from staged changes (#321) 2026-04-23 22:09:25 -07:00
textarea.tsx feat: add admin routes and checkbox component for sports management 2025-10-12 21:54:49 -07:00
UserAvatar.stories.tsx Add Cloudinary-backed avatar system (#385) 2026-05-06 14:47:37 -07:00
UserAvatar.tsx Add Cloudinary-backed avatar system (#385) 2026-05-06 14:47:37 -07:00