var React = require('react'); var ReactBootstrap = require('react-bootstrap'); var ButtonGroup = ReactBootstrap.ButtonGroup; var DropdownButton = ReactBootstrap.DropdownButton; var MenuItem = ReactBootstrap.MenuItem; var BarChart = require('../components/BarChart'); var RatioBarChart = require('../components/RatioBarChart'); module.exports = React.createClass({ displayName: "LunchStats", getInitialState: function() { return { selectedReportId: null }; }, selectReport: function(reportId) { if (reportId == "suggestion-veto-ratio") { this.props.fetchReport("suggestions"); this.props.fetchReport("vetoed-suggestions"); } else { this.props.fetchReport(reportId); } this.setState({ selectedReportId: reportId }); }, render: function() { var chart = (
Please select a report from above
); if (this.state.selectedReportId && this.props.reports.hasOwnProperty(this.state.selectedReportId)) { var report = this.props.reports[this.state.selectedReportId]; var data = report.Data; data.sort(function(a, b){return b.Value - a.Value;}); chart=(); } else if (this.state.selectedReportId == "suggestion-veto-ratio" && this.props.reports.hasOwnProperty("suggestions") && this.props.reports.hasOwnProperty("vetoed-suggestions")) { chart=(); } return (
Suggestion Frequency Non-Vetoed Suggestions Vetoed Suggestions Veto Ratio Attendee Frequency {chart}
); } });