<commit_before>/* @flow weak */
import React from 'react';
import {RouterMixin} from 'react-mini-router';

import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import injectTapEventPlugin from 'react-tap-event-plugin';

import AuthContainer from './auth_container.jsx';
import VirtualSchoolPage from './virtual_school/virtual_school_page.jsx';
import HomePage from './home/home_page.jsx';
import DemosPage from './home/demos_page.jsx';
import ConsentPage from './home/consent_page.jsx';
import * as MessagePopup from './message_popup/index.js';


export default React.createClass({
  displayName: 'App',

  mixins: [RouterMixin],

  propTypes: {
    muiTheme: React.PropTypes.object
  },

  getDefaultProps() {
    return {
      muiTheme: getMuiTheme()
    };
  },

  componentWillMount() {
    injectTapEventPlugin(); // material-ui, see https://github.com/zilverline/react-tap-event-plugin
  },

  routes: {
    '/': 'home',
    '/demos': 'demos',
    '/consent': 'consent',

    // Included in /demos, shared externally, or used in playtests
    '/teachermoments/original': 'messagePopup',
    '/teachermoments/bias': 'biasHome',
    '/teachermoments/alpha': 'alphaPlaytest',
    '/teachermoments/discipline': 'disciplinePlaytest',
    '/teachermoments/mentoring': 'mentoringPlaytest',
    '/teachermoments/mindset': 'mindsetPlaytest',
    '/teachermoments/danson': 'dansonPlaytest',
    '/teachermoments/valpha': 'VideoAlphaPlaytest',
    '/teachermoments/twine': 'messagePopupTwine',
    '/teachermoments/demo': 'messagePopupDemo',
    '/teachermoments/sub': 'messagePopupPairs',
    '/teachermoments/darius': 'messagePopupDarius',
    '/teachermoments/chat': 'chatPrototype',
    '/teachermoments/tuesday': 'messagePopupMeredith',
    '/teachermoments/csfair': 'messagePopupCsFair',

    // Deprecated experiences
    '/playtest/:cohortKey': 'messagePopupPlaytest',

    // Mechanical Turk experiment
    '/teachermoments/turk-0000': 'turk0000',

    // Prototype authoring UIs
    '/teachermoments/author/questions' : 'messagePopupAuthorQuestions',
    '/teachermoments/author/questions/new' : 'messagePopupAuthorQuestionsNew',
    '/teachermoments/author/questions/:id' : 'messagePopupAuthorQuestionsEdit',

    // Reviewing endpoints
    '/teachermoments/review/:key': 'messagePopupReviewLogin',
    '/teachermoments/review_link': 'messagePopupReview',

    // Other
    '/virtual_school': 'virtualSchool'
  },

  /*eslint-disable react/sort-comp */
  render(){
    return (
      <MuiThemeProvider muiTheme={this.props.muiTheme}>
        <AuthContainer isEmailRequired={false}>
          {this.renderCurrentRoute()}
        </AuthContainer>
      </MuiThemeProvider>
    );
  },

  home(query = {}) {
    return <HomePage />;
  },

  notFound(path) {
    window.location = '/';
  },

  demos(query = {}) {
    return <DemosPage />;
  },

  consent(query = {}) {
    return <ConsentPage />;
  },

  messagePopup(query = {}) {
    // Uses a unique key per query string so that navigating between
    // rebuilds the page.
    return <MessagePopup.ExperiencePage key={JSON.stringify(query)} query={query} />;
  },

  chatPrototype(query = {}) {
    return this.messagePopup({...query, mobilePrototype: true});
  },

  messagePopupTwine(query = {}) {
    return <MessagePopup.TwinePage key={JSON.stringify(query)} />;
  },

  messagePopupDemo(query = {}) {
    return <MessagePopup.DemoPage key={JSON.stringify(query)} />;
  },

  alphaPlaytest(query = {}) {
    return <MessagePopup.InsubordinationPage query={{}}/>;
  },

  disciplinePlaytest(query = {}) {
    return <MessagePopup.DisciplinePage query={{}}/>;
  },

  turk0000(query = {}) {
    return (
      <MessagePopup.MTurkPage
        query={query}
        experimentFactory={MessagePopup.InsubordinationExperiment} />
    );
  },

  // Home page for bias project, from website, reachout, etc.
  biasHome(query = {}) {
    return this.messagePopupPairs(query);
  },

  mentoringPlaytest(query = {}) {
    return <MessagePopup.MentoringPage query={{}}/>;
  },

  mindsetPlaytest(query = {}) {
    return <MessagePopup.MindsetPage query={{}}/>;
  },

  dansonPlaytest(query = {}) {
    return <MessagePopup.DansonExperiencePage query={{}}/>;
  },

  VideoAlphaPlaytest(query = {}) {
    return <MessagePopup.VideoAlphaExperiencePage query={{}}/>;
  },

  messagePopupPairs(query = {}) {
    return <MessagePopup.PairsExperiencePage query={query} />;
  },

  messagePopupMeredith(query = {}) {
    return <MessagePopup.PairsExperiencePage query={query} isForMeredith={true} />;
  },

  messagePopupCsFair(query = {}) {
    return <MessagePopup.CsFairExperiencePage query={query} />;
  },

  messagePopupDarius(query = {}) {
    return <MessagePopup.DariusExperiencePage query={{}}/>;
  },

  messagePopupPlaytest(cohortKey, query = {}) {<commit_msg>Add CSP url<commit_after>/* @flow weak */
import React from 'react';
import {RouterMixin} from 'react-mini-router';

import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import injectTapEventPlugin from 'react-tap-event-plugin';

import AuthContainer from './auth_container.jsx';
import VirtualSchoolPage from './virtual_school/virtual_school_page.jsx';
import HomePage from './home/home_page.jsx';
import DemosPage from './home/demos_page.jsx';
import ConsentPage from './home/consent_page.jsx';
import * as MessagePopup from './message_popup/index.js';


export default React.createClass({
  displayName: 'App',

  mixins: [RouterMixin],

  propTypes: {
    muiTheme: React.PropTypes.object
  },

  getDefaultProps() {
    return {
      muiTheme: getMuiTheme()
    };
  },

  componentWillMount() {
    injectTapEventPlugin(); // material-ui, see https://github.com/zilverline/react-tap-event-plugin
  },

  routes: {
    '/': 'home',
    '/demos': 'demos',
    '/consent': 'consent',

    // Included in /demos, shared externally, or used in playtests
    '/teachermoments/original': 'messagePopup',
    '/teachermoments/bias': 'biasHome',
    '/teachermoments/alpha': 'alphaPlaytest',
    '/teachermoments/discipline': 'disciplinePlaytest',
    '/teachermoments/mentoring': 'mentoringPlaytest',
    '/teachermoments/mindset': 'mindsetPlaytest',
    '/teachermoments/danson': 'dansonPlaytest',
    '/teachermoments/valpha': 'VideoAlphaPlaytest',
    '/teachermoments/twine': 'messagePopupTwine',
    '/teachermoments/demo': 'messagePopupDemo',
    '/teachermoments/sub': 'messagePopupPairs',
    '/teachermoments/darius': 'messagePopupDarius',
    '/teachermoments/chat': 'chatPrototype',
    '/teachermoments/csfair': 'messagePopupCsFair',

    // Specific cohorts
    '/teachermoments/csp': 'messagePopupCSP',
    '/teachermoments/tuesday': 'messagePopupMeredith',

    // Deprecated experiences
    '/playtest/:cohortKey': 'messagePopupPlaytest',

    // Mechanical Turk experiment
    '/teachermoments/turk-0000': 'turk0000',

    // Prototype authoring UIs
    '/teachermoments/author/questions' : 'messagePopupAuthorQuestions',
    '/teachermoments/author/questions/new' : 'messagePopupAuthorQuestionsNew',
    '/teachermoments/author/questions/:id' : 'messagePopupAuthorQuestionsEdit',

    // Reviewing endpoints
    '/teachermoments/review/:key': 'messagePopupReviewLogin',
    '/teachermoments/review_link': 'messagePopupReview',

    // Other
    '/virtual_school': 'virtualSchool'
  },

  /*eslint-disable react/sort-comp */
  render(){
    return (
      <MuiThemeProvider muiTheme={this.props.muiTheme}>
        <AuthContainer isEmailRequired={false}>
          {this.renderCurrentRoute()}
        </AuthContainer>
      </MuiThemeProvider>
    );
  },

  home(query = {}) {
    return <HomePage />;
  },

  notFound(path) {
    window.location = '/';
  },

  demos(query = {}) {
    return <DemosPage />;
  },

  consent(query = {}) {
    return <ConsentPage />;
  },

  messagePopup(query = {}) {
    // Uses a unique key per query string so that navigating between
    // rebuilds the page.
    return <MessagePopup.ExperiencePage key={JSON.stringify(query)} query={query} />;
  },

  chatPrototype(query = {}) {
    return this.messagePopup({...query, mobilePrototype: true});
  },

  messagePopupTwine(query = {}) {
    return <MessagePopup.TwinePage key={JSON.stringify(query)} />;
  },

  messagePopupDemo(query = {}) {
    return <MessagePopup.DemoPage key={JSON.stringify(query)} />;
  },

  alphaPlaytest(query = {}) {
    return <MessagePopup.InsubordinationPage query={{}}/>;
  },

  disciplinePlaytest(query = {}) {
    return <MessagePopup.DisciplinePage query={{}}/>;
  },

  turk0000(query = {}) {
    return (
      <MessagePopup.MTurkPage
        query={query}
        experimentFactory={MessagePopup.InsubordinationExperiment} />
    );
  },

  // Home page for bias project, from website, reachout, etc.
  biasHome(query = {}) {
    return this.messagePopupPairs(query);
  },

  mentoringPlaytest(query = {}) {
    return <MessagePopup.MentoringPage query={{}}/>;
  },

  mindsetPlaytest(query = {}) {
    return <MessagePopup.MindsetPage query={{}}/>;
  },

  dansonPlaytest(query = {}) {
    return <MessagePopup.DansonExperiencePage query={{}}/>;
  },

  VideoAlphaPlaytest(query = {}) {
    return <MessagePopup.VideoAlphaExperiencePage query={{}}/>;
  },

  messagePopupPairs(query = {}) {
    return <MessagePopup.PairsExperiencePage query={query} />;
  },

  messagePopupMeredith(query = {}) {
    return <MessagePopup.PairsExperiencePage query={query} isForMeredith={true} />;
  },

  messagePopupCSP(query = {}) {
    return <MessagePopup.PairsExperiencePage query={query} />;
  },

  messagePopupCsFair(query = {}) {
    return <MessagePopup.CsFairExperiencePage query={query} />;
  },

  messagePopupDarius(query = {}) {
    return <MessagePopup.DariusExperiencePage query={{}}/>;
  },

  messagePopupPlaytest(cohortKey, query = {}) {
{'fraction_non_alphanumeric': 0.1540937437135385, 'fraction_numerical': 0.0024140012070006035, 'mean_word_length': 3.81501210653753, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 46, 'https://': 2, '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': '7411369', 'n_tokens_mistral': 3283, 'n_tokens_neox': 3235, 'n_words': 516}