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

View File

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

View File

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