Almost brackets working
This commit is contained in:
parent
ac71748bb3
commit
7f8ac6d345
|
@ -104,8 +104,8 @@ let deleteTournament = tournamentId => event => {
|
||||||
|
|
||||||
function ManageTournament(props) {
|
function ManageTournament(props) {
|
||||||
|
|
||||||
const [startTime, setStartTime] = React.useState([new Date(),null]);
|
const [startTime, setStartTime] = React.useState([null,null]);
|
||||||
const [endTime, setEndTime] = React.useState([new Date(),null]);
|
const [endTime, setEndTime] = React.useState([null,null]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
fetch(
|
fetch(
|
||||||
|
@ -119,8 +119,8 @@ function ManageTournament(props) {
|
||||||
|
|
||||||
document.getElementById("editName").value = data.data.name;
|
document.getElementById("editName").value = data.data.name;
|
||||||
document.getElementById("editDesc").value = data.data.description;
|
document.getElementById("editDesc").value = data.data.description;
|
||||||
setStartTime(data.data.startTime.slice(0, 16));
|
// setStartTime(data.data.startTime.slice(0, 16));
|
||||||
setEndTime(data.data.endTime.slice(0, 16));
|
// setEndTime(data.data.endTime.slice(0, 16));
|
||||||
})
|
})
|
||||||
.catch((err) => showError(err));
|
.catch((err) => showError(err));
|
||||||
}, [endTime, props.tournamentId, startTime]);
|
}, [endTime, props.tournamentId, startTime]);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Link } from "react-router-dom";
|
||||||
import Appbar from './components/AsuraBar';
|
import Appbar from './components/AsuraBar';
|
||||||
import TournamentBar from "./components/TournamentBar";
|
import TournamentBar from "./components/TournamentBar";
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import { Button, Paper, Stack, CircularProgress, Box } from "@mui/material";
|
import { Button, Paper, Stack, CircularProgress, Box, Grid } from "@mui/material";
|
||||||
import "./components/tournamentBracket.css";
|
import "./components/tournamentBracket.css";
|
||||||
import EmojiEventsIcon from '@mui/icons-material/EmojiEvents';
|
import EmojiEventsIcon from '@mui/icons-material/EmojiEvents';
|
||||||
import DoDisturbIcon from '@mui/icons-material/DoDisturb';
|
import DoDisturbIcon from '@mui/icons-material/DoDisturb';
|
||||||
|
@ -12,16 +12,14 @@ function MatchPair(props) {
|
||||||
let match1 = <Match teams={props.teams} match={props.matches[0]} key={0} />;
|
let match1 = <Match teams={props.teams} match={props.matches[0]} key={0} />;
|
||||||
let match2 = <Match teams={props.teams} match={props.matches[1]} key={1} />;
|
let match2 = <Match teams={props.teams} match={props.matches[1]} key={1} />;
|
||||||
|
|
||||||
return <div className="winners">
|
return (
|
||||||
<div className="matchups">
|
<>
|
||||||
{match1}
|
<li className="game game-top">{match1}</li>
|
||||||
{match2}
|
<li className="game game-spacer"> </li>
|
||||||
</div>
|
<li className="game game-bottom">{match2}</li>
|
||||||
<div className="connector">
|
<li class="spacer"> </li>
|
||||||
<div className="merger"></div>
|
</>
|
||||||
<div className="line"></div>
|
)
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function TournamentTier(props) {
|
function TournamentTier(props) {
|
||||||
|
@ -31,12 +29,10 @@ function TournamentTier(props) {
|
||||||
if (props.tier === 0) {
|
if (props.tier === 0) {
|
||||||
// The final, just a single match without the bracket lines
|
// The final, just a single match without the bracket lines
|
||||||
return (
|
return (
|
||||||
<div className="round finals"><div className="winners">
|
<ul className="round finals">
|
||||||
<div className="matchups">
|
<li class="spacer"> </li>
|
||||||
<Match teams={props.teams} match={props.matches[0]} key={0} />
|
<Match teams={props.teams} match={props.matches[0]} key={0} />
|
||||||
</div>
|
</ul>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// The rest of the rounds/tiers, divide into pairs of two matches
|
// The rest of the rounds/tiers, divide into pairs of two matches
|
||||||
|
@ -47,9 +43,10 @@ function TournamentTier(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`round ${roundTypes[props.tier]}`}>
|
<ul className={`round ${roundTypes[props.tier]}`}>
|
||||||
|
<li class="spacer"> </li>
|
||||||
{matchPairs}
|
{matchPairs}
|
||||||
</div>
|
</ul>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,18 +88,18 @@ function Match(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="matchup">
|
<>
|
||||||
<div className="participants">
|
|
||||||
{/* Team 1 (Winner-status?) (Team name) */}
|
{/* Team 1 (Winner-status?) (Team name) */}
|
||||||
<div onClick={setWinner(props.match.team1Id)} className={`participant ${props.match.winnerId && (props.match.team1Id === props.match.winnerId) ? "winner" : ""}`}>
|
<li onClick={setWinner(props.match.team1Id)} className={`game game-top ${props.match.winnerId && (props.match.team1Id === props.match.winnerId) ? "winner" : ""}`}>
|
||||||
<span>{team1Name}</span>
|
{team1Name}
|
||||||
</div>
|
</li>
|
||||||
|
<li class="game game-spacer"> </li>
|
||||||
{/* Team 2 (Winner-status?) (Team name) */}
|
{/* Team 2 (Winner-status?) (Team name) */}
|
||||||
<div onClick={setWinner(props.match.team2Id)} className={`participant ${props.match.winnerId && (props.match.team2Id === props.match.winnerId) ? "winner" : ""}`}>
|
<li onClick={setWinner(props.match.team2Id)} className={`game game-bottom ${props.match.winnerId && (props.match.team2Id === props.match.winnerId) ? "winner" : ""}`}>
|
||||||
<span>{team2Name}</span>
|
{team2Name}
|
||||||
</div>
|
</li>
|
||||||
</div>
|
<li class="spacer"> </li>
|
||||||
</div>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,153 +1,56 @@
|
||||||
html,body{
|
/*
|
||||||
height:100%;
|
* Flex Layout Specifics
|
||||||
}
|
*/
|
||||||
|
|
||||||
.bracket{
|
.bracket{
|
||||||
display: flex;
|
display:flex;
|
||||||
position: relative;
|
flex-direction:row;
|
||||||
flex-direction: row;
|
}
|
||||||
justify-content: center;
|
.round{
|
||||||
align-items: center;
|
display:flex;
|
||||||
width: 90vw;
|
flex-direction:column;
|
||||||
height: 100%;
|
justify-content:center;
|
||||||
padding:2%;
|
width:200px;
|
||||||
}
|
list-style:none;
|
||||||
|
padding:0;
|
||||||
.winners{
|
}
|
||||||
margin: 2vw;
|
.round .spacer{ flex-grow:1; }
|
||||||
}
|
.round .spacer:first-child,
|
||||||
|
.round .spacer:last-child{ flex-grow:.5; }
|
||||||
.participants{
|
|
||||||
border-radius: 0.25vw;
|
.round .game-spacer{
|
||||||
overflow: hidden;
|
flex-grow:1;
|
||||||
border: 1px solid gray;
|
}
|
||||||
}
|
|
||||||
.participants .participant {
|
/*
|
||||||
box-sizing: border-box;
|
* General Styles
|
||||||
color: #404040;
|
*/
|
||||||
background: white;
|
body{
|
||||||
width: 10vw;
|
font-family:sans-serif;
|
||||||
height: 3vw;
|
font-size:small;
|
||||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12);
|
padding:10px;
|
||||||
}
|
line-height:1.4em;
|
||||||
.participants .participant span {
|
}
|
||||||
margin: 0 1.25vw;
|
|
||||||
line-height: 3;
|
li.game{
|
||||||
font-size: 1rem;
|
padding-left:20px;
|
||||||
font-family: "Roboto Slab";
|
}
|
||||||
overflow: ellipsis;
|
|
||||||
}
|
li.game.winner{
|
||||||
.participants .participant:not(:last-child) {
|
font-weight:bold;
|
||||||
border-bottom: thin solid #dcdddd;
|
}
|
||||||
}
|
li.game span{
|
||||||
.participants .participant.loser {
|
float:right;
|
||||||
color: #dc563f;
|
margin-right:5px;
|
||||||
border-color: #dc563f;
|
}
|
||||||
}
|
|
||||||
.participants .participant.winner {
|
li.game-top{ border-bottom:1px solid #aaa; }
|
||||||
color: white;
|
|
||||||
background-color: #1ab35a;
|
li.game-spacer{
|
||||||
}
|
border-right:1px solid #aaa;
|
||||||
|
min-height:40px;
|
||||||
.participants .participant:hover{
|
}
|
||||||
cursor: pointer;
|
|
||||||
background-color: #1ab35a;
|
li.game-bottom{
|
||||||
}
|
border-top:1px solid #aaa;
|
||||||
|
}
|
||||||
.matchups{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.matchup{
|
|
||||||
margin: 1vw 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.winners{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: row;
|
|
||||||
margin: 2vh 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.round{
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.round.thirtysecondfinals{
|
|
||||||
margin: 0vh 2vw;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.round.sixteenthfinals{
|
|
||||||
margin: 0vh 2vw;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.round.eighthfinals{
|
|
||||||
margin: 0vh 2vw;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.round.quarterfinals{
|
|
||||||
margin: 0vh 2vw;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.round.semifinals{
|
|
||||||
margin: 0vh 2vw;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.round.finals{
|
|
||||||
margin: 0vh 2vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.connector{
|
|
||||||
display:none;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .bracket .round .winners>div.connector.filled .line,
|
|
||||||
.bracket .round .winners>div.connector.filled.bottom .merger:after,
|
|
||||||
.bracket .round .winners>div.connector.filled.top .merger:before {
|
|
||||||
border-color: #60c645;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bracket .round .winners>div.connector .line,
|
|
||||||
.bracket .round .winners>div.connector .merger {
|
|
||||||
box-sizing: border-box;
|
|
||||||
width: 2rem;
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bracket .round .winners>div.connector .line {
|
|
||||||
border-bottom: thin solid #c0c0c8;
|
|
||||||
height: 25%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bracket .round .winners>div.connector .merger {
|
|
||||||
position: relative;
|
|
||||||
height: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bracket .round .winners>div.connector .merger:before,
|
|
||||||
.bracket .round .winners>div.connector .merger:after {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
width: 100%;
|
|
||||||
height: 50%;
|
|
||||||
border: 0 solid;
|
|
||||||
border-color: #c0c0c8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bracket .round .winners>div.connector .merger:before {
|
|
||||||
border-right-width: thin;
|
|
||||||
border-top-width: thin;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bracket .round .winners>div.connector .merger:after {
|
|
||||||
border-right-width: thin;
|
|
||||||
border-bottom-width: thin;
|
|
||||||
} */
|
|
Loading…
Reference in New Issue