import React from "react"; import "./radar.scss"; import { Match, Veto } from "../../api/interfaces"; import { Map, CSGO, Team } from 'csgogsi-socket'; import { actions } from './../../App'; import Radar from './Radar' import TeamLogo from "../MatchBar/TeamLogo"; interface Props { match: Match | null, map: Map, game: CSGO } interface State { showRadar: boolean, radarSize: number, showBig: boolean } export default class RadarMaps extends React.Component { state = { showRadar: true, radarSize: 350, showBig: false } componentDidMount() { actions.on('radarBigger', () => this.radarChangeSize(20)); actions.on('radarSmaller', () => this.radarChangeSize(-20)); actions.on('toggleRadar', () => { this.setState(state => ({ showRadar: !state.showRadar })) }); actions.on("toggleRadarView", () => { this.setState({showBig:!this.state.showBig}); }); } radarChangeSize = (delta: number) => { const newSize = this.state.radarSize + delta; this.setState({ radarSize: newSize > 0 ? newSize : this.state.radarSize }); } render() { const { match } = this.props; const { radarSize, showBig, showRadar } = this.state; const size = showBig ? 600 : radarSize; return (
{match ? : null}
); } } class MapsBar extends React.PureComponent { render() { const { match, map } = this.props; if (!match || !match.vetos.length) return ''; const picks = match.vetos.filter(veto => veto.type !== "ban" && veto.mapName); if (picks.length > 3) { const current = picks.find(veto => map.name.includes(veto.mapName)); if (!current) return null; return
{}
} return
{match.vetos.filter(veto => veto.type !== "ban").filter(veto => veto.teamId || veto.type === "decider").map(veto => )}
} } class MapEntry extends React.PureComponent<{ veto: Veto, map: Map, team: Team | null }> { render() { const { veto, map, team } = this.props; return
{team ? : null}
{veto.mapName}
} }