import React from "react"; import Store from "./interface/Store"; export default class Players extends React.Component { constructor() { super(); this.state = { plylst: Store.getPlayers() }; this.getPlayers = this.getPlayers.bind(this) this.color = ['grey', 'red', 'green', 'blue'] } componentDidMount() { Store.on("playlist", this.getPlayers) } componentWillUnmount() { Store.removeListener("playlist", this.getPlayers) } getPlayers() { this.setState({ plylst: Store.getPlayers() }) } render() { const p = this.props.players const t = this.props.turn const plyrs = this.state.plylst.map((d, i) => { return (
{t.length ? : null}
{p.length && p[i].live === true ?
{t.length && t[i].req ? :
}
:
}
{d.Desc}
) }) return (
{plyrs}
); } }