@@ -33,6 +48,30 @@ export function NotificationsSection({ discordPingEnabled, hasDiscordLinked, suc
+
+
Draft Pick Emails
+
+
+
+
+ Receive an email when it's your turn to pick in a draft. If you have back-to-back
+ picks, you'll get a single email letting you know.
+
+
+
+
+ {emailFetcher.state === "idle" && emailFetcher.data && (emailFetcher.data as { intent?: string; success?: boolean }).intent === "update-email-draft-notifications" && (emailFetcher.data as { success?: boolean }).success && (
+
Email notification preference saved.
+ )}
+
+
Discord Pings
@@ -62,9 +101,9 @@ export function NotificationsSection({ discordPingEnabled, hasDiscordLinked, suc
{success && (
diff --git a/app/models/draft-utils.ts b/app/models/draft-utils.ts
index 517f8fe..0a11b49 100644
--- a/app/models/draft-utils.ts
+++ b/app/models/draft-utils.ts
@@ -8,6 +8,7 @@ import { isParticipantDrafted, getDraftPicksWithSports, getTeamDraftPicksWithSpo
import { getParticipantsForSeasonWithSports } from "./season-participant";
import { getSeasonSportsSimple } from "./season-sport";
import { calculateDraftEligibility } from "~/lib/draft-eligibility";
+import { sendOnTheClockEmail } from "~/services/draft-email.server";
import { getSocketIO, scheduleDraftRoomClosure } from "../../server/socket";
import { runBracktHarvilleForFantasySeason } from "~/services/brackt.server";
@@ -833,6 +834,12 @@ export async function executeAutoPick(params: {
draftSlots,
db,
});
+
+ // After autodraft chain settles, notify whoever is actually on the clock
+ const postChainSeason = await db.query.seasons.findFirst({ where: eq(schema.seasons.id, seasonId) });
+ const finalPickNumber = postChainSeason?.currentPickNumber ?? nextPickNumber;
+ sendOnTheClockEmail({ seasonId, currentPickNumber: finalPickNumber, totalTeams, totalPicks, draftSlots, db })
+ .catch((err) => logger.error("[AutoPick] On-the-clock email failed:", err));
}
return {
diff --git a/app/routes/api/draft.make-pick.ts b/app/routes/api/draft.make-pick.ts
index d547cf1..c8c15c1 100644
--- a/app/routes/api/draft.make-pick.ts
+++ b/app/routes/api/draft.make-pick.ts
@@ -11,6 +11,7 @@ import { calculatePickInfo, checkAndTriggerNextAutodraft, pruneIneligibleQueueIt
import { getSocketIO, scheduleDraftRoomClosure } from "../../../server/socket";
import { logger } from "~/lib/logger";
import { runBracktHarvilleForFantasySeason } from "~/services/brackt.server";
+import { sendOnTheClockEmail } from "~/services/draft-email.server";
import type { ActionFunctionArgs } from "react-router";
export async function action(args: ActionFunctionArgs) {
@@ -322,6 +323,13 @@ export async function action(args: ActionFunctionArgs) {
db,
});
}
+
+ // After autodraft chain settles, notify whoever is actually on the clock
+ const postChainSeason = await db.query.seasons.findFirst({ where: eq(schema.seasons.id, seasonId) });
+ const finalPickNumber = postChainSeason?.currentPickNumber ?? nextPickNumber;
+ const totalPicks = totalTeams * season.draftRounds;
+ sendOnTheClockEmail({ seasonId, currentPickNumber: finalPickNumber, totalTeams, totalPicks, draftSlots, db })
+ .catch((err) => logger.error("On-the-clock email failed:", err));
}
return Response.json({
diff --git a/app/routes/leagues/$leagueId.draft.$seasonId.tsx b/app/routes/leagues/$leagueId.draft.$seasonId.tsx
index 5e69ace..1ee9492 100644
--- a/app/routes/leagues/$leagueId.draft.$seasonId.tsx
+++ b/app/routes/leagues/$leagueId.draft.$seasonId.tsx
@@ -1328,7 +1328,7 @@ export default function DraftRoom() {