feat: cm table next tree match + lock scores
This commit is contained in:
parent
489bfeb354
commit
ef5b707697
@ -8,6 +8,7 @@ import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||
import {faCircleQuestion} from "@fortawesome/free-regular-svg-icons";
|
||||
import {DrawGraph} from "../../result/DrawGraph.jsx";
|
||||
import {scorePrint, win} from "../../../utils/Tools.js";
|
||||
import {toast} from "react-toastify";
|
||||
|
||||
function CupImg() {
|
||||
return <img decoding="async" loading="lazy" width={"16"} height={"16"} className="wp-image-1635"
|
||||
@ -278,7 +279,7 @@ function BuildTree({treeData, matches}) {
|
||||
const trees = initTree(treeData);
|
||||
|
||||
const onMatchClick = (rect, matchId, __) => {
|
||||
setCurrentMatch({matchSelect: matchId, matchNext: new TreeNode(matchId).nextMatchTree(trees)});
|
||||
setCurrentMatch({matchSelect: matchId, matchNext: new TreeNode(matchId).nextMatchTree(trees.reverse())});
|
||||
}
|
||||
|
||||
const onClickVoid = () => {
|
||||
@ -288,7 +289,7 @@ function BuildTree({treeData, matches}) {
|
||||
return <div>
|
||||
<div ref={scrollRef} className="overflow-x-auto" style={{position: "relative"}}>
|
||||
<DrawGraph root={trees} scrollRef={scrollRef} onMatchClick={onMatchClick} onClickVoid={onClickVoid}
|
||||
matchSelect={currentMatch?.matchSelect} matchNext={currentMatch?.matchNext}/>
|
||||
matchSelect={currentMatch?.matchSelect} matchNext={currentMatch?.matchNext} size={23}/>
|
||||
</div>
|
||||
|
||||
{currentMatch?.matchSelect && <LoadingProvider><ScorePanel matchId={currentMatch?.matchSelect} matches={matches}/></LoadingProvider>}
|
||||
@ -381,6 +382,14 @@ function ScorePanel({matchId, matches}) {
|
||||
if (!match || match?.end === end)
|
||||
return;
|
||||
|
||||
if (end){
|
||||
if (win(match?.scores) === 0 && match.categorie_ord === -42){
|
||||
toast.error("Impossible de terminer un match nul en tournois.");
|
||||
setEnd(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setLoading(1)
|
||||
sendRequest('updateMatchEnd', {matchId: matchId, end})
|
||||
.finally(() => {
|
||||
|
||||
@ -2,7 +2,6 @@ import {useEffect, useRef} from "react";
|
||||
import {scorePrint, win} from "../../utils/Tools.js";
|
||||
|
||||
const max_x = 500;
|
||||
const size = 24;
|
||||
|
||||
function getMousePos(canvas, evt) {
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
@ -21,6 +20,7 @@ export function DrawGraph({
|
||||
},
|
||||
matchSelect = null,
|
||||
matchNext = null,
|
||||
size = 24
|
||||
}) {
|
||||
const canvasRef = useRef(null);
|
||||
const actionCanvasRef = useRef(null);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user