@@ -12,6 +12,7 @@ import CustomEventStylesContext from "@/components/CustomEventStylesContext";
1212import {
1313 cancelTournament ,
1414 restartTournament as handleRestartTournament ,
15+ retryTournament as handleRetryTournament ,
1516 finishRoundTournament as handleFinishRoundTournament ,
1617 openUpTournament as handleOpenUpTournament ,
1718 showTournamentResults as handleShowResults ,
@@ -50,6 +51,7 @@ function TournamentMainControlButtons({
5051 const confirmBtnRef = useRef ( null ) ;
5152 const hasCustomEventStyle = useContext ( CustomEventStylesContext ) ;
5253 const [ restartConfirmationModalShowing , setRestartConfirmationModalShowing ] = useState ( false ) ;
54+ const [ retryConfirmationModalShowing , setRetryConfirmationModalShowing ] = useState ( false ) ;
5355
5456 const handleStartTournament = useCallback ( ( ) => {
5557 handleStartRound ( "firstRound" ) ;
@@ -70,6 +72,16 @@ function TournamentMainControlButtons({
7072 handleRestartTournament ( ) ;
7173 closeRestartConfirmationModal ( ) ;
7274 } , [ closeRestartConfirmationModal ] ) ;
75+ const openRetryConfirmationModal = useCallback ( ( ) => {
76+ setRetryConfirmationModalShowing ( true ) ;
77+ } , [ ] ) ;
78+ const closeRetryConfirmationModal = useCallback ( ( ) => {
79+ setRetryConfirmationModalShowing ( false ) ;
80+ } , [ ] ) ;
81+ const confirmRetryTournament = useCallback ( ( ) => {
82+ handleRetryTournament ( ) ;
83+ closeRetryConfirmationModal ( ) ;
84+ } , [ closeRetryConfirmationModal ] ) ;
7385
7486 const restartBtnClassName = cn (
7587 "btn text-nowrap ml-lg-2 rounded-left btn-secondary cb-btn-secondary" ,
@@ -126,6 +138,33 @@ function TournamentMainControlButtons({
126138 </ div >
127139 </ Modal . Footer >
128140 </ Modal >
141+ < Modal
142+ show = { retryConfirmationModalShowing }
143+ onHide = { closeRetryConfirmationModal }
144+ contentClassName = "cb-bg-panel cb-text"
145+ >
146+ < Modal . Header className = "cb-border-color" closeButton >
147+ < Modal . Title > Retry tournament</ Modal . Title >
148+ </ Modal . Header >
149+ < Modal . Body className = "cb-border-color" >
150+ < div className = "d-flex flex-column" >
151+ < h4 className = "mb-3" > Are you sure you want to retry this tournament?</ h4 >
152+ < p className = "mb-0 text-muted" >
153+ This will clear tournament games and results, then restore the current player roster.
154+ </ p >
155+ </ div >
156+ </ Modal . Body >
157+ < Modal . Footer className = "cb-border-color" >
158+ < div className = "d-flex justify-content-between w-100" >
159+ < Button onClick = { closeRetryConfirmationModal } className = { cancelBtnClassName } >
160+ Cancel
161+ </ Button >
162+ < Button onClick = { confirmRetryTournament } className = { confirmBtnClassName } >
163+ Retry tournament
164+ </ Button >
165+ </ div >
166+ </ Modal . Footer >
167+ </ Modal >
129168 { ! streamMode && (
130169 < >
131170 { canStartRound ? (
@@ -235,6 +274,16 @@ function TournamentMainControlButtons({
235274 < FontAwesomeIcon className = "mr-2" icon = "cog" />
236275 Tournament details
237276 </ Dropdown . Item >
277+ < Dropdown . Item
278+ as = "button"
279+ disabled = { disabled }
280+ key = "retry"
281+ className = "cb-dropdown-item"
282+ onSelect = { openRetryConfirmationModal }
283+ >
284+ < FontAwesomeIcon className = "mr-2" icon = "redo" />
285+ Retry
286+ </ Dropdown . Item >
238287 < Dropdown . Item
239288 as = "button"
240289 disabled = { disabled }
0 commit comments