import React from 'react' import { Link } from 'react-router-dom' import moment from 'moment' class Matches extends React.Component { constructor() { super() this.handleChange = this.handleChange.bind(this) } componentDidMount () { console.log('Matches did mount', this) const { matchesGetMatchesRequest } = this.props.matchesActions matchesGetMatchesRequest() } handleChange (event) { event.preventDefault() const { matchesSetFilter } = this.props.matchesActions const nextFilter = { category: this.category.value, date: this.date.value, time: this.time.value, place: this.place.value, player: this.player.value, result: this.result.value } matchesSetFilter(nextFilter) } render () { const state = this.props.matches const actions = this.props.matchesActions const { setRecipients } = this.props.smsActions const { matches, filteredMatches, filter } = state const participatingPlayers = [] filteredMatches.forEach(match => { if (match.player1) participatingPlayers.push(match.player1) if (match.player2) participatingPlayers.push(match.player2) }) return (
{filteredMatches.length}/{matches.length} Spiele, {participatingPlayers.length} Spieler > setRecipients(participatingPlayers)}>SMS