import React, {Component} from 'react'; import {connect} from 'react-redux'; import {SelectField, Option} from 'react-mdl-selectfield'; import styles from './Community.css'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from '../../translations'; import {setRole, setCommenterStatus} from '../../actions/community'; const lang = new I18n(translations); class Table extends Component { constructor (props) { super(props); this.onRoleChange = this.onRoleChange.bind(this); } onRoleChange (id, role) { this.props.dispatch(setRole(id, role)); } onCommenterStatusChange (id, status) { this.props.dispatch(setCommenterStatus(id, status)); } render () { const {headers, commenters, onHeaderClickHandler} = this.props; return ( {headers.map((header, i) =>( ))} {commenters.map((row, i)=> ( ))}
onHeaderClickHandler({field: header.field})}> {header.title}
{row.displayName} {row.profiles.map(({id}) => id)} {row.created_at} this.onCommenterStatusChange(row.id, status)}> this.onRoleChange(row.id, role)}>
); } } export default connect(state => ({commenters: state.community.get('commenters')}))(Table);