<commit_before>import React from 'react';
import { Meteor } from 'meteor/meteor';
import { FlowRouter } from 'meteor/kadira:flow-router';
import UserList from './UserList.jsx';
import TeamList from './TeamList.jsx';
import PuzzleDashboard from './PuzzleDashboard.jsx';
import BulkEmail from './BulkEmail.jsx';
import GamePlay from './GamePlay.jsx';
import Scoreing from './Scoring.jsx';

Admin = React.createClass({

    getInitialState() {
        return {
            pageComp: Scoring //UserList
        }
    },

    mixins: [ReactMeteorData],
    getMeteorData() {
        return {
            user: Meteor.user()
        };
    },

    componentDidMount() {
        $(this.refs.tabMenu).find('.item').tab();
    },

    setPage(targetPage) {
        this.setState({
            pageComp: targetPage
        });
    },

    render() {
        // First Check Access
        if (!this.data.user) {
            return <LoadingSegment />
        }
        else if (this.data.user.roles.indexOf('admin') < 0) {
            return <Login />
        }

        let pageComp = this.state.pageComp ? <this.state.pageComp /> : <div className="basic segment">Oops, no page found</div>;

        return (
            <div className="custom-bg red-square">
                <br/>
                <div className="ui raised segment transparent-bg">
                    <h3 className="ui violet center aligned header">Admin Panel</h3>
                    <div className="ui labeled icon menu">
                        <a className="item" onClick={this.setPage.bind(this, UserList)}>
                            <i className="green user icon"></i>
                            Users
                        </a>
                        <a className="item" onClick={this.setPage.bind(this, TeamList)}>
                            <i className="blue users icon"></i>
                            Teams
                        </a>
                        <a className="item" onClick={this.setPage.bind(this, PuzzleDashboard)}>
                            <i className="violet puzzle icon"></i>
                            Puzzles
                        </a>
                        <a className="item" onClick={this.setPage.bind(this, BulkEmail)}>
                            <i className="orange mail icon"></i>
                            Email
                        </a>
                        <a className="item" onClick={this.setPage.bind(this, GamePlay)}>
                            <i className="red gamepad icon"></i>
                            The Game
                        </a>
                        <a className="item" onClick={this.setPage.bind(this, Scoring)}>
                            <i className="yellow trophy icon"></i>
                            Scoring
                        </a>
                    </div>
                    {pageComp}
                </div>
            </div>
        );
    }
});

/*
Admin.propTypes = {
    list: React.PropTypes.object,
    ...
}
        
*/<commit_msg>Wrap Admin page in AuthedComponentContainer<commit_after>import React, { Component } from 'react';
import { Meteor } from 'meteor/meteor';
import { FlowRouter } from 'meteor/kadira:flow-router';
import UserList from './UserList.jsx';
import TeamList from './TeamList.jsx';
import PuzzleDashboard from './PuzzleDashboard.jsx';
import BulkEmail from './BulkEmail.jsx';
import GamePlay from './GamePlay.jsx';
import Scoreing from './Scoring.jsx';

Admin = class Admin extends Component {

  constructor(props) {
    super(props);
    this.state = {
      pageComp: Scoring //UserList
    }
  }

  componentDidMount() {
      $(this.refs.tabMenu).find('.item').tab();
  }

  setPage(targetPage) {
      this.setState({
          pageComp: targetPage
      });
  }

  render() {

    let pageComp = this.state.pageComp ? <this.state.pageComp /> : <div className="basic segment">Oops, no page found</div>;

    return (
      <AuthedComponentContainer params={{accessLevel: 'admin'}}>
        <div className="ui container">
          <PuzzlePageTitle title="Admin" />
          <div className="ui labeled icon menu">
            <a className="item" onClick={this.setPage.bind(this, UserList)}>
              <i className="green user icon"></i>
              Users
            </a>
            <a className="item" onClick={this.setPage.bind(this, TeamList)}>
              <i className="blue users icon"></i>
              Teams
            </a>
            <a className="item" onClick={this.setPage.bind(this, PuzzleDashboard)}>
              <i className="violet puzzle icon"></i>
              Puzzles
            </a>
            <a className="item" onClick={this.setPage.bind(this, BulkEmail)}>
              <i className="orange mail icon"></i>
              Email
            </a>
            <a className="item" onClick={this.setPage.bind(this, GamePlay)}>
              <i className="red gamepad icon"></i>
              The Game
            </a>
            <a className="item" onClick={this.setPage.bind(this, Scoring)}>
              <i className="yellow trophy icon"></i>
              Scoring
            </a>
          </div>
          {pageComp}
        </div>
      </AuthedComponentContainer>
    );
  }
}
{'fraction_non_alphanumeric': 0.1317903596021423, 'fraction_numerical': 0.0005738332058148432, 'mean_word_length': 1.5847750865051904, 'pattern_counts': {'":': 0, '<': 76, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5428897', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1397, 'n_words': 317}