From 58256fa42bf6e4027c75277e366db3091fe0e039 Mon Sep 17 00:00:00 2001 From: Kristoffer Juelsen Date: Sun, 24 Apr 2022 22:27:40 +0200 Subject: [PATCH] MUI Scaling + Styling --- src/client/src/TournamentOverview.js | 54 +++++++++++-------- .../src/components/tournamentBracket.css | 28 +++------- 2 files changed, 39 insertions(+), 43 deletions(-) diff --git a/src/client/src/TournamentOverview.js b/src/client/src/TournamentOverview.js index 1a96d23..fec49af 100644 --- a/src/client/src/TournamentOverview.js +++ b/src/client/src/TournamentOverview.js @@ -10,20 +10,23 @@ import EmojiEventsIcon from '@mui/icons-material/EmojiEvents'; import DoDisturbIcon from '@mui/icons-material/DoDisturb'; import BackspaceIcon from '@mui/icons-material/Backspace'; import AddCircleIcon from '@mui/icons-material/AddCircle'; +import { fontSize } from "@mui/system"; function TournamentTier(props){ - let roundTypes = ["winner","finals", "semifinals", "quarterfinals", "eighthfinals", "sixteenthfinals", "thirtysecondfinals"]; + let roundTypes = ["finals", "semifinals", "quarterfinals", "eighthfinals", "sixteenthfinals", "thirtysecondfinals"]; let matches = []; - for (let i = 0; i < props.matches.length; i++) { - matches.push(); + for (let i = 0; i < props.matches.length; i++) { + matches.push(); + } + return( + <> + +
  •  
  • + {matches} +
    + + ) } - return( -
      -
    •  
    • - {matches} -
    - ) -} function Match(props){ let team1Name = "TBA"; @@ -62,11 +65,11 @@ function Match(props){ }; let curryUnsetContestant = teamId => (e) => { - console.log("wack") + // console.log("wack") let formData = new FormData(); formData.append("teamId", teamId); let body = new URLSearchParams(formData); - console.log(props.match) + // console.log(props.match) fetch(process.env.REACT_APP_API_URL + `/match/${props.match.id}/unsetContestant`, { method: "POST", body: body @@ -74,7 +77,7 @@ function Match(props){ .then(response => response.json()) .then(data => { if (data.status === "OK") { - console.log("wacky smacky"); + // console.log("wacky smacky"); window.location.reload(); } }) @@ -84,16 +87,16 @@ function Match(props){ return ( <> {/* Team 1 (Winner-status?) (Team name) */} -
  • - - +
  • + + {team1Name} { props.match.winnerId && (props.match.team1Id === props.match.winnerId) && - + } { props.match.team1Id !== null && !props.tournament.hasEnded && props.match.tier !== Math.log2(props.tournament.teamLimit) - 1 && props.match.winnerId === null && props.user.isLoggedIn && - + } { props.match.team1Id !== null && props.match.winnerId === null && !props.tournament.hasEnded && props.user.isLoggedIn && @@ -102,16 +105,16 @@ function Match(props){
  •  
  • {/* Team 2 (Winner-status?) (Team name) */} -
  • - - +
  • + + {team2Name} { props.match.winnerId && (props.match.team2Id === props.match.winnerId) && } { props.match.team2Id !== null && !props.tournament.hasEnded && props.match.tier !== Math.log2(props.tournament.teamLimit) - 1 && props.match.winnerId === null && props.user.isLoggedIn && - + } { props.match.team2Id !== null && props.match.winnerId === null && !props.tournament.hasEnded && props.user.isLoggedIn && @@ -144,6 +147,7 @@ function BracketViewer(props){ tiers[match.tier] = []; } tiers[match.tier].push(match); + console.log(tiers) return tiers; }, {}); @@ -167,14 +171,18 @@ function BracketViewer(props){ .catch(err => showError(err)); }, []); return ( + (props.tournament && matches && teams) ? //
    + <>
    - {matches.map(tier => { + {matches.map(tier => { let tierNum = tier[0].tier; return })}
    + + : ); } diff --git a/src/client/src/components/tournamentBracket.css b/src/client/src/components/tournamentBracket.css index bf8f409..2823d19 100644 --- a/src/client/src/components/tournamentBracket.css +++ b/src/client/src/components/tournamentBracket.css @@ -10,10 +10,10 @@ display:flex; flex-direction:column; justify-content:center; - width:20vw; + /* width:20vw; */ list-style:none; padding:0; - font-size: 1.5rem; + /* font-size: 1.5rem; */ } .round .spacer{ flex-grow:1;} .round .spacer:first-child, @@ -31,30 +31,18 @@ padding:10px; line-height:1.4em; } */ - - .teamName{ - max-width: 5vw; - overflow: hidden; - word-wrap: none; - } li.game{ padding-left:20px; } - .winnerTrophy{ - visibility: hidden; - } - .teamName.winner{ - font-weight:bold; + .winner{ + color:green; + font-weight: bold; + } + .loser{ + color:grey; } - li.game.winner > div.winnerTrophy{ - visibility: visible; - } - /* li.game .winnerTrophy{ - float:right; - margin-right:5px; - } */ li.game-top{ border-bottom:1px solid #aaa; }