import React from "react"; import Store from "./interface/Store"; import * as Act from "./interface/Actions"; import delImg from "./Images/delete.png"; import addE from "./Images/addE.png" import addD from "./Images/addD.png" export default class NewMatch extends React.Component { constructor() { super() this.state = { grplst: Store.getGroups(), grp: -1, fndlst: Store.getFriends(), sernme:'' } this.getGroups = this.getGroups.bind(this); this.getFriends = this.getFriends.bind(this); this.color = ['grey', 'red', 'green', 'blue'] } componentDidMount() { Store.on("groups", this.getGroups) Store.on("friends", this.getFriends) } componentWillUnmount() { Store.removeListener("groups", this.getGroups) Store.removeListener("friends", this.getFriends) } getGroups() { this.setState({ grplst: Store.getGroups() }) } getFriends() { this.setState({ fndlst: Store.getFriends() }) } groupChange(e) { if (e.target.value > -1) { let tag = this.state.grplst[e.target.value].Tag Act.apiCall('service', 'GRFRND', { grp: tag }); this.setState({ grp: e.target.value }) } else { this.setState({ grp: e.target.value, fndlst: [] }) } } delGroup() { let tag = this.state.grplst[this.state.grp].Tag Act.apiCall('service', 'GRPDLT', { grp: tag }); this.setState({ grp: -1, sernme: '', fndlst: [] }) } newSeries() { if (this.state.grp > -1 && this.state.sernme.length > 3) { let tag = this.state.grplst[this.state.grp].Tag Act.apiCall('service', 'NEWSER', { grp: tag, ser: this.state.sernme }); this.setState({ grp: -1, sernme: '', fndlst: [] }) } } render() { let groups = this.state.grplst.map((g,i) => { return }) let friends = this.state.fndlst.map((f) => { return
{f.Desc}
}) let flag = this.state.grp > -1 && this.state.sernme.length > 3 ? true : false; return (
match title
this.setState({ sernme: e.target.value })} />
{ this.state.grp > -1 ? : null }
{friends}
) } }