From 702c223f2e6484663cc18fb0cb7720eeb60dd70c Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:59:48 +0300 Subject: [PATCH] Require confirmation if submitting a low point value --- .../components/MatchActions.tsx | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/app/features/tournament-bracket/components/MatchActions.tsx b/app/features/tournament-bracket/components/MatchActions.tsx index 1899ede56..768dbd047 100644 --- a/app/features/tournament-bracket/components/MatchActions.tsx +++ b/app/features/tournament-bracket/components/MatchActions.tsx @@ -136,6 +136,7 @@ export function MatchActions({ {!revising && ( point < 10); + const submitButtonDisabled = () => { + if (wouldEndSet && !endConfirmation) return true; + if (lowPoints && !pointConfirmation) return true; + + return false; + }; + return ( {wouldEndSet ? ( setEndConfirmation(e.target.checked)} id={confirmCheckId} data-testid="end-confirmation" @@ -281,11 +293,25 @@ function ReportScoreButtons({ ) : null} + {lowPoints ? ( + + setPointConfirmation(e.target.checked)} + id={pointConfirmCheckId} + /> + + Confirm reporting of low score value ( + {points!.map((p) => `${p}p`).join(" & ")}) + + + ) : null} {wouldEndSet ? "Report & end set" : "Report"}