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) +
++ 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 +
+