/** * Copyright (c) 2017 Tomek Wójcik * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ import ClassName from "classnames"; import React from "react"; import {connect} from "react-redux"; import {Link} from "react-router"; import ChartComponent from "../components/ChartComponent"; import ContainerComponent from "../components/ContainerComponent"; import LoaderComponent from "../components/LoaderComponent"; import WeaponIconComponent from "../components/WeaponIconComponent"; import {cleanup, setDay} from "../actions/sessions"; class NavComponent extends React.PureComponent { render () { let previousClassName = ClassName("previous", { disabled: !this.props.previousDay }); let nextClassName = ClassName("next", { disabled: !this.props.nextDay }); let previousDayLinkTo = this.props.previousDay ? "/sessions/" + this.props.previousDay : ""; let nextDayLinkTo = this.props.nextDay ? "/sessions/" + this.props.nextDay : ""; return ( ); } } NavComponent.propTypes = { previousDay: React.PropTypes.string, nextDay: React.PropTypes.string }; class GamesTableView extends React.PureComponent { render () { return ( {(this.props.games.length == 0) && } {this.props.games.map((game) => { return game.scores.map((score, index) => { let playerStatsLinkTo = "/players/" + score.player + "/game/" + game.uuid; return ( {(index == 0) && } ); }); })}
Map Player Scores Favourite weapon Quad freak?
Total Frags Deaths Suicides
No stats :(
{game.map} {score.player} {score.score} {score.kills} {score.deaths} {score.suicides} {(!score.favourite_weapon) && "?"} {(score.favourite_weapon) && } {(!score.quad_freak) && "No"} {(score.quad_freak) && "Yes (" + score.quad_pickups + " pickups)" }
); } } GamesTableView.propTypes = { games: React.PropTypes.array.isRequired }; class SessionsView extends React.PureComponent { constructor (props) { super(props); this.chartConfig = { "chart": { "type": "column" }, "title": { "text": "Scores by map and player" }, "credits": { "enabled": false }, "yAxis": { "min": -10, "title": { "text": "Score" } }, "plotOptions": { "column": { "pointPadding": 0.2, "borderWidth": 0 } } }; } setDay (day) { this.props.dispatch(setDay(this.props.dispatch, day)); } componentDidMount () { this.setDay(this.props.params.day); } componentWillUnmount () { this.props.dispatch(cleanup()); } componentDidUpdate (prevProps) { if (prevProps.params.day != this.props.params.day) { this.setDay(this.props.params.day); } } render () { return ( {!this.props.loading &&

Results

Stats

}
); } } SessionsView.propTypes = { categories: React.PropTypes.array.isRequired, day: React.PropTypes.string.isRequired, games: React.PropTypes.array.isRequired, loading: React.PropTypes.bool.isRequired, nextDay: React.PropTypes.string.isRequired, params: React.PropTypes.object.isRequired, previousDay: React.PropTypes.string.isRequired, series: React.PropTypes.array.isRequired }; const mapStateToProps = (state, props) => { return { loading: state.sessions.loading, day: state.sessions.day, previousDay: state.sessions.previousDay, nextDay: state.sessions.nextDay, games: state.sessions.games, categories: state.sessions.categories, series: state.sessions.series, params: props.params }; }; const reduxContainer = connect(mapStateToProps)(SessionsView); export default reduxContainer;