Итоги партии: общий разбор целей/миров и один расчёт мест
parseCount и граница 99 — в domain/matchCounts.ts вместо двух копий в PlaceEditor и AdminMatchEdit. В MatchDetailPage места по раскладке считает placeRows, из него строятся и предупреждения, и строки для API. Поведение не меняется. #89 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqSoRj99iwVEH5U5fnZgsd
This commit is contained in:
@@ -2,6 +2,7 @@ import { Scissors } from "lucide-react";
|
||||
import { useRef } from "react";
|
||||
|
||||
import { Avatar } from "./Avatar";
|
||||
import { MAX_COUNT, parseCount } from "../domain/matchCounts";
|
||||
|
||||
export interface PlacePlayer {
|
||||
user_id: number;
|
||||
@@ -241,19 +242,11 @@ export function PlaceEditor({
|
||||
type="number"
|
||||
inputMode="numeric"
|
||||
min={0}
|
||||
max={99}
|
||||
max={MAX_COUNT}
|
||||
placeholder="—"
|
||||
disabled={locked}
|
||||
value={locked ? 0 : (counts?.[userId]?.[field] ?? "")}
|
||||
onChange={(e) => {
|
||||
const raw = e.target.value.trim();
|
||||
const num = Number(raw);
|
||||
onCount?.(
|
||||
userId,
|
||||
field,
|
||||
raw === "" || !Number.isFinite(num) ? null : Math.min(99, Math.max(0, Math.trunc(num))),
|
||||
);
|
||||
}}
|
||||
onChange={(e) => onCount?.(userId, field, parseCount(e.target.value))}
|
||||
/>
|
||||
</label>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user