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';
import {FaChevronDown} from 'react-icons/fa6';
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 ShowMatchesToggleChevron(props) {
const toggleClass = props.show ? 'rotate' : '';
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 (
| # |
Team |
Pkt. |
Dif. |
Gew. |
{props.scores.map(groupScore => )}
);
}
function GroupScoresTableRow(props) {
const teamId = `favorite-team-groupstage-${props.score.team.id}`;
return (
| {props.score.position} |
{props.score.team.name} |
{props.score.group_points} |
{props.score.difference_in_points} |
{props.score.scored_points} |
);
}