feat: support double-elimination series games
This commit is contained in:
1 parent
2ee8c3807b
commit
e188828423
16 files changed
+1176
-234
No files matched your search
@@ -52,6 +52,12 @@ function normalizeRoundRobinMaxRounds(
|
||||
return Math.max(1, Math.min(fullRoundCount, Math.floor(value)));
|
||||
}
|
||||
|
||||
function normalizeSeriesGameCount(value: number | undefined) {
|
||||
if (!value || !Number.isFinite(value) || value < 1) return 3;
|
||||
const integer = Math.floor(value);
|
||||
return integer % 2 === 0 ? integer + 1 : integer;
|
||||
}
|
||||
|
||||
function RequiredBadge() {
|
||||
return (
|
||||
<span className="ml-1 inline-flex items-center border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-xs font-bold text-primary">
|
||||
@@ -350,14 +356,15 @@ export default function MatchAdminPage() {
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
disabled={form.gameMode === 'double-elimination'}
|
||||
value={form.gameMode === 'double-elimination' ? 1 : form.gameCount}
|
||||
step={form.gameMode === 'double-elimination' ? 2 : 1}
|
||||
value={form.gameCount}
|
||||
onChange={(event) => setForm((current) => ({ ...current, gameCount: Number(event.target.value) }))}
|
||||
className="mt-1 w-full border border-base-content/10 bg-transparent px-3 py-2 text-sm"
|
||||
/>
|
||||
{form.gameMode === 'double-elimination' && (
|
||||
<span className="mt-1 block text-xs text-base-content/30">
|
||||
더블 엘리미네이션은 단판으로 진행됩니다.
|
||||
승자조는 현재 3판 2선승으로 진행됩니다. 추후 5판 3선승도 같은
|
||||
구조로 지원합니다.
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
@@ -377,7 +384,9 @@ export default function MatchAdminPage() {
|
||||
? 20
|
||||
: current.maxParticipants,
|
||||
gameCount:
|
||||
gameMode === 'double-elimination' ? 1 : current.gameCount,
|
||||
gameMode === 'double-elimination'
|
||||
? normalizeSeriesGameCount(current.gameCount)
|
||||
: current.gameCount,
|
||||
}));
|
||||
}}
|
||||
className="mt-1 w-full border border-base-content/10 bg-transparent px-3 py-2 text-sm"
|
||||
|
||||
Reference in new issue
Block a user