import {Button, Card, CardBody, Col, Collapse, Row, Table} from 'reactstrap'; import {Match} from './Match'; import React, {Component} from 'react'; import {getGroup} from '../redux/tournamentApi'; import {notify} from 'react-notify-toast'; import {sortMatchesByPositionAscending} from '../utils/sorting'; export default class GroupStage extends Component { constructor(props) { super(props); this.state = {showMatches: this.props.showMatches}; this.toggleShowMatches = this.toggleShowMatches.bind(this); } toggleShowMatches() { this.setState({showMatches: !this.state.showMatches}); } render() { return (

Gruppenphase

{this.props.groups.map(group => ( ))}
); } } function ShowMatchesToggleButton(props) { return (); } export class Group extends Component { constructor(props) { super(props); this.state = props.group; this.reload = this.reload.bind(this); this.onReloadSuccess = this.onReloadSuccess.bind(this); this.onReloadError = this.onReloadError.bind(this); } reload() { getGroup(this.state.id, this.onReloadSuccess, this.onReloadError); } onReloadSuccess(status, updatedGroup) { this.setState(updatedGroup); } onReloadError() { notify.show('Die Gruppe konnte nicht aktualisiert werden.', 'warning', 2000); } render() { return (

Gruppe {this.state.number}

{this.state.matches.sort(sortMatchesByPositionAscending()).map(match => ( ))}
); } } function GroupScoresTable(props) { return ( {props.scores.map(groupScore => ( ))}
# Team Pkt. Dif. Gew.
); } function GroupScoresTableRow(props) { const advancingTeam = props.teams?.find(team => team.id === props.score.team.id && team.advancing_from_group_stage); const rowClass = advancingTeam ? 'table-success' : ''; return ( {props.score.position} {props.score.team.name} {props.score.group_points} {props.score.difference_in_points} {props.score.scored_points} ); }