From 9a0e27ea50ff829fbbd74ecf764ccb4398a1df30 Mon Sep 17 00:00:00 2001 From: Stanleyowskiki Date: Fri, 24 May 2024 17:12:47 +0200 Subject: [PATCH] Wizualiztor demo --- src/elements/Ladder/Ladder.js | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/elements/Ladder/Ladder.js b/src/elements/Ladder/Ladder.js index 8576b93..ed8b3bc 100644 --- a/src/elements/Ladder/Ladder.js +++ b/src/elements/Ladder/Ladder.js @@ -1,5 +1,25 @@ import { useEffect, useState } from "react" -import { Bracket } from 'react-brackets'; +import { Bracket, RoundProps, Seed, SeedItem, SeedTeam, RenderSeedProps } from 'react-brackets'; + +const CustomSeed = ({seed, breakpoint, roundIndex, seedIndex}) => { + const getColor = (winner, team) => { + if (winner === -1) return 'gray'; + if (winner === team.name) return 'green'; + return 'red'; + } + console.log("seed"); + console.log(seed); + return ( + + +
+ {seed.teams[0]?.name || '...'} + {seed.teams[1]?.name || '...'} +
+
+
+ ); + }; const buildRounds = function (json) { console.log("before") @@ -15,7 +35,7 @@ const buildRounds = function (json) { temp.push({ id: i, date: new Date().toDateString(), - teams: [{ name: 'Its a me' }, { name: 'Mario ' + i }], + teams: [{}, {}], }); }; temp = temp.concat(result); @@ -24,7 +44,7 @@ const buildRounds = function (json) { temp.push({ id: i + maxPosition + 1, date: new Date().toDateString(), - teams: [{ name: 'Its a me' }, { name: 'Luigi ' + i }], + teams: [{}, {}], }); } @@ -43,7 +63,6 @@ const buildRounds = function (json) { let cursor = -1; for (let i = result.length - 1; i >= 0 ; i--) { if (Number.isInteger(Math.log2(i + 2))) { - temp.push([]); cursor++; } @@ -129,6 +148,9 @@ export default function Ladder({status}){ }, [status]); return (<> - + ) } \ No newline at end of file