From 0bef91e530f9852241e3cfcf3c1bb034aa64dfda Mon Sep 17 00:00:00 2001
From: Chris Parsons
Date: Thu, 16 Oct 2025 00:37:51 -0700
Subject: [PATCH] feat: add configurable initial and increment time settings
for draft picks
---
app/routes/leagues/$leagueId.settings.tsx | 58 +++++++++++++++++++++++
app/routes/leagues/new.tsx | 46 ++++++++++++++++++
2 files changed, 104 insertions(+)
diff --git a/app/routes/leagues/$leagueId.settings.tsx b/app/routes/leagues/$leagueId.settings.tsx
index 6a8e437..0c30c97 100644
--- a/app/routes/leagues/$leagueId.settings.tsx
+++ b/app/routes/leagues/$leagueId.settings.tsx
@@ -212,6 +212,8 @@ export async function action(args: Route.ActionArgs) {
const teamCount = formData.get("teamCount");
const draftDateTime = formData.get("draftDateTime");
const draftRounds = formData.get("draftRounds");
+ const draftInitialTime = formData.get("draftInitialTime");
+ const draftIncrementTime = formData.get("draftIncrementTime");
// Validation
if (typeof name !== "string" || !name.trim()) {
@@ -250,6 +252,28 @@ export async function action(args: Route.ActionArgs) {
seasonUpdates.draftDateTime = draftDateTime ? new Date(draftDateTime) : null;
}
+ // Handle draft initial time
+ if (typeof draftInitialTime === "string") {
+ const initialTime = parseInt(draftInitialTime, 10);
+ if (!isNaN(initialTime)) {
+ if (initialTime < 30 || initialTime > 86400) {
+ return { error: "Initial draft time must be between 30 seconds and 24 hours (86400 seconds)" };
+ }
+ seasonUpdates.draftInitialTime = initialTime;
+ }
+ }
+
+ // Handle draft increment time
+ if (typeof draftIncrementTime === "string") {
+ const incrementTime = parseInt(draftIncrementTime, 10);
+ if (!isNaN(incrementTime)) {
+ if (incrementTime < 0 || incrementTime > 3600) {
+ return { error: "Draft increment time must be between 0 and 1 hour (3600 seconds)" };
+ }
+ seasonUpdates.draftIncrementTime = incrementTime;
+ }
+ }
+
// Update season if there are changes
if (Object.keys(seasonUpdates).length > 0) {
await updateSeason(season.id, seasonUpdates);
@@ -552,6 +576,40 @@ export default function LeagueSettings({ loaderData, actionData }: Route.Compone
: "Draft date cannot be changed after draft has started"}
+
+
+
+
+
+ Time each team starts with (30 seconds to 24 hours)
+
+
+
+
+
+
+
+ Time added after each pick (0 to 1 hour)
+
+
diff --git a/app/routes/leagues/new.tsx b/app/routes/leagues/new.tsx
index 69beb25..4bfdaa3 100644
--- a/app/routes/leagues/new.tsx
+++ b/app/routes/leagues/new.tsx
@@ -76,6 +76,8 @@ export async function action(args: Route.ActionArgs) {
const templateId = formData.get("templateId");
const draftRounds = formData.get("draftRounds");
const draftDateTime = formData.get("draftDateTime");
+ const draftInitialTime = formData.get("draftInitialTime");
+ const draftIncrementTime = formData.get("draftIncrementTime");
// Validation
if (typeof name !== "string" || !name.trim()) {
@@ -96,6 +98,16 @@ export async function action(args: Route.ActionArgs) {
return { error: "Draft rounds must be between 1 and 50" };
}
+ const draftInitialTimeNum = typeof draftInitialTime === "string" ? parseInt(draftInitialTime, 10) : 120;
+ if (isNaN(draftInitialTimeNum) || draftInitialTimeNum < 30 || draftInitialTimeNum > 86400) {
+ return { error: "Initial draft time must be between 30 seconds and 24 hours" };
+ }
+
+ const draftIncrementTimeNum = typeof draftIncrementTime === "string" ? parseInt(draftIncrementTime, 10) : 30;
+ if (isNaN(draftIncrementTimeNum) || draftIncrementTimeNum < 0 || draftIncrementTimeNum > 3600) {
+ return { error: "Draft increment time must be between 0 and 1 hour" };
+ }
+
try {
// Create league
const league = await createLeague({
@@ -118,6 +130,8 @@ export async function action(args: Route.ActionArgs) {
templateId: typeof templateId === "string" && templateId !== "" ? templateId : null,
draftRounds: draftRoundsNum,
draftDateTime: typeof draftDateTime === "string" && draftDateTime ? new Date(draftDateTime) : null,
+ draftInitialTime: draftInitialTimeNum,
+ draftIncrementTime: draftIncrementTimeNum,
});
// Set this as the current season for the league
@@ -326,6 +340,38 @@ export default function NewLeague({ loaderData, actionData }: Route.ComponentPro
+
+
+
+
+ Time each team starts with (30 seconds to 24 hours). Default: 120 seconds (2 minutes)
+
+
+
+
+
+
+
+ Time added after each pick (0 to 1 hour). Default: 30 seconds
+
+
+