diff --git a/src/client/src/TournamentOverview.js b/src/client/src/TournamentOverview.js index 49d4aba..04703ca 100644 --- a/src/client/src/TournamentOverview.js +++ b/src/client/src/TournamentOverview.js @@ -69,19 +69,40 @@ function Match(props){ .catch(error => showError(error)); } + const [endTime, setendTime] = React.useState(null); + + React.useEffect(() => { + fetch(process.env.REACT_APP_API_URL + `/tournament/${props.tournamentId}`) + .then(res => res.json()) + .then(data => { + if (data.status !== "OK") { + // Do your error thing + console.error(data); + return; + } + let endTime = data.data.endTime; + setendTime(endTime); + }) + .catch(err => showError(err)); + }) + + let today = new Date() + let yesterday = today.setDate(today.getDate() - 1) + let isComplete = new Date(endTime) < yesterday + return ( <> {/* Team 1 (Winner-status?) (Team name) */}
  • - + {team1Name} - { props.match.winnerId && (props.match.team1Id === props.match.winnerId) && - + { props.match.winnerId && (props.match.team1Id === props.match.winnerId) && !isComplete ? + : null } - { props.match.team1Id !== null && - + { props.match.team1Id !== null && !isComplete ? + : null } {/* { props.match.winnerId && (props.match.team1Id === props.match.winnerId) && @@ -92,14 +113,14 @@ function Match(props){ {/* Team 2 (Winner-status?) (Team name) */}
  • - + {team2Name} - { props.match.winnerId && (props.match.team2Id === props.match.winnerId) && - + { props.match.winnerId && (props.match.team2Id === props.match.winnerId) && !isComplete ? + : null } - { props.match.team2Id !== null && - + { props.match.team2Id !== null && !isComplete ? + : null } {/* { props.match.winnerId && (props.match.team2Id === props.match.winnerId) && diff --git a/src/client/src/components/tournamentBracket.css b/src/client/src/components/tournamentBracket.css index 844f186..bf8f409 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:200px; + width:20vw; list-style:none; padding:0; - font-size: 2rem; + font-size: 1.5rem; } .round .spacer{ flex-grow:1;} .round .spacer:first-child, @@ -33,7 +33,7 @@ } */ .teamName{ - max-width: 7.5vw; + max-width: 5vw; overflow: hidden; word-wrap: none; }