Mark advancing teams with success background

This commit is contained in:
Daniel Schädler 2025-03-14 14:45:30 +01:00
parent cd06ab4747
commit 5184d63738
4 changed files with 62 additions and 30 deletions

View File

@ -23,8 +23,16 @@ export default class GroupStage extends Component {
<ShowMatchesToggleButton show={this.state.showMatches} toggle={this.toggleShowMatches}/>
</h1>
<Row className='mt-3'>
{this.props.groups.map(group => <Group group={group} key={group.id} isSignedIn={this.props.isSignedIn}
isOwner={this.props.isOwner} showMatches={this.state.showMatches}/>)}
{this.props.groups.map(group => (
<Group
group={group}
key={group.id}
isSignedIn={this.props.isSignedIn}
isOwner={this.props.isOwner}
showMatches={this.state.showMatches}
teams={this.props.teams}
/>
))}
</Row>
</div>);
}
@ -64,11 +72,17 @@ export class Group extends Component {
<CardBody>
<h3 className='custom-font'>Gruppe {this.state.number}</h3>
<Collapse isOpen={this.props.showMatches}>
{this.state.matches.sort(sortMatchesByPositionAscending()).map((match => (
<Match match={match} isSignedIn={this.props.isSignedIn} isOwner={this.props.isOwner}
onChange={this.reload} key={match.id}/>)))}
{this.state.matches.sort(sortMatchesByPositionAscending()).map(match => (
<Match
match={match}
isSignedIn={this.props.isSignedIn}
isOwner={this.props.isOwner}
onChange={this.reload}
key={match.id}
/>
))}
</Collapse>
<GroupScoresTable scores={this.state.scores}/>
<GroupScoresTable scores={this.state.scores} teams={this.props.teams} />
</CardBody>
</Card>
</Col>);
@ -76,8 +90,9 @@ export class Group extends Component {
}
function GroupScoresTable(props) {
return (<Table className='mt-4' striped size='sm' responsive>
<thead>
return (
<Table className='mt-4' striped size='sm' responsive>
<thead>
<tr>
<th>#</th>
<th>Team</th>
@ -85,20 +100,31 @@ function GroupScoresTable(props) {
<th><span title="Becherdifferenz">Dif.</span></th>
<th><span title="Getroffene Becher (Geworfen)">Gew.</span></th>
</tr>
</thead>
<tbody>
{props.scores.map(groupScore => <GroupScoresTableRow score={groupScore} key={groupScore.id}/>)}
</tbody>
</Table>);
</thead>
<tbody>
{props.scores.map(groupScore => (
<GroupScoresTableRow
score={groupScore}
key={groupScore.id}
teams={props.teams}
/>
))}
</tbody>
</Table>
);
}
function GroupScoresTableRow(props) {
return (<tr>
<td>{props.score.position}</td>
<td>{props.score.team.name}</td>
<td>{props.score.group_points}</td>
<td>{props.score.difference_in_points}</td>
<td>{props.score.scored_points}</td>
</tr>);
const advancingTeam = props.teams?.find(team => team.id === props.score.team.id && team.advancing_from_group_stage);
const rowClass = advancingTeam ? 'table-success' : '';
return (
<tr className={rowClass}>
<td>{props.score.position}</td>
<td>{props.score.team.name}</td>
<td>{props.score.group_points}</td>
<td>{props.score.difference_in_points}</td>
<td>{props.score.scored_points}</td>
</tr>
);
}

View File

@ -67,7 +67,8 @@ function convertTournament(apiTournament) {
isPublic: apiTournament.public,
ownerUsername: apiTournament.owner_username,
groupStage: groupStage,
playoffStages: playoffStages
playoffStages: playoffStages,
teams: apiTournament.teams
};
}

View File

@ -14,17 +14,17 @@ function FullscreenPage(props) {
let logo;
if (props.showLogo) {
logo = <Col>
<div className="d-flex justify-content-center align-items-center">
<img height='300' width='300' src='/static/images/bpwstr_logo.png'></img>
</div>
</Col>;
<div className="d-flex justify-content-center align-items-center">
<img height='300' width='300' src='/static/images/bpwstr_logo.png'></img>
</div>
</Col>;
} else {
logo = <div />;
}
return (<div>
<Container className='fs-5' fluid>
<Row className='row-cols-4'>
{props.groups.map(group => <Col className='mb-2'><Group group={group} key={group.id}/></Col>)}
{props.groups.map(group => <Col className='mb-2'><Group group={group} key={group.id} teams={props.teams}/></Col>)}
<Col>
<div className="d-flex justify-content-center align-items-center">
<QRCodeSVG
@ -134,7 +134,7 @@ class Main extends React.Component {
</Head>
<FullscreenPage
tournament={tournament} groups={groups} page={page} maxPage={this.pages}
showLogo={showLogo}
showLogo={showLogo} teams={tournament.teams}
/>
<style global jsx>{`
body {

View File

@ -27,8 +27,13 @@ class PrivateTournamentPage extends React.Component {
<StatusBar tournament={this.props.tournament} isOwner={isOwner} isSignedIn={isSignedIn}/>
<div className='stages'>
{groupStage != null &&
<div><GroupStage groups={groupStage.groups} isSignedIn={isSignedIn} isOwner={isOwner}
showMatches={playoffStages !== null}/></div>}
<div><GroupStage
groups={groupStage.groups}
isSignedIn={isSignedIn}
isOwner={isOwner}
showMatches={playoffStages !== null}
teams={this.props.tournament.teams}
/></div>}
<PlayoffStages playoffStages={playoffStages} isSignedIn={isSignedIn}
isOwner={isOwner}/>
</div>