<commit_before>import React from 'react';
import ReactDOM from 'react-dom';

import BreakoutApi from './BreakoutApi';

import Login from './Components/Login/Login.jsx';
import Registration from './Components/Register/Registration.jsx';
import Participation from './Components/Participate/Participation.jsx';
import SelectRole from './Components/SelectRole/SelectRole.jsx';
import ResetPassword from './Components/ResetPassword/ResetPassword.jsx';
import CreateOrJoinTeam from './Components/CreateOrJoinTeam.jsx';
import de from '../../resources/translations/translations.de';
import en from '../../resources/translations/translations.en';
import i18next from 'i18next';
import Modal from './Components/Modal.jsx';
import {
  BrowserRouter as Router,
  Route,
} from 'react-router-dom';

class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      api: this.props.api,
      activeModal: null,
    };
  }

  componentWillMount() {

    i18next.init({
      lng: window.getBoUserLang(),
      fallbackLng: 'de',
      resources: {
        de: {
          translation: de
        },
        en: {
          translation: en
        }
      }
    });

    this.setState({i18next: i18next});
  }

  onHide() {
    location.replace('/');
  }

  showModalFor(Comp) {
    return (props) => {
      return (
        <Modal show={true} onHide={this.onHide.bind(this)}>
          <Comp {...props} api={this.props.api} i18next={this.state.i18next}/>
        </Modal>
      );
    };
  }

  render() {
    return (
      <Router>
        <div>
          <Route exact path="/r/login" component={this.showModalFor(Login)}/>
          <Route exact path="/r/register" component={this.showModalFor(Registration)}/>
          <Route exact path="/r/reset-password" component={this.showModalFor(ResetPassword)}/>
          <Route exact path="/r/select-role" component={this.showModalFor(SelectRole)}/>
          <Route exact path="/r/participate" component={this.showModalFor(Participation)}/>
          <Route exact path="/r/create-join-team" component={this.showModalFor(CreateOrJoinTeam)}/>
        </div>
      </Router>
    );
  }
}

App.propTypes = {
  api: React.PropTypes.object
};

const createReactApp = (api) => {
  ReactDOM.render(
    <App api={api}/>,
    document.getElementById('react-root')
  );
};

BreakoutApi.initFromServer()
  .then(createReactApp)
  .catch(console.error);<commit_msg>Set accessToken correctly<commit_after>import React from 'react';
import ReactDOM from 'react-dom';

import BreakoutApi from './BreakoutApi';

import Login from './Components/Login/Login.jsx';
import Registration from './Components/Register/Registration.jsx';
import Participation from './Components/Participate/Participation.jsx';
import SelectRole from './Components/SelectRole/SelectRole.jsx';
import ResetPassword from './Components/ResetPassword/ResetPassword.jsx';
import CreateOrJoinTeam from './Components/CreateOrJoinTeam.jsx';
import de from '../../resources/translations/translations.de';
import en from '../../resources/translations/translations.en';
import i18next from 'i18next';
import Modal from './Components/Modal.jsx';
import {
  BrowserRouter as Router,
  Route,
} from 'react-router-dom';
import {getAccessToken} from './Components/helpers';

class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      api: this.props.api,
      activeModal: null,
    };
  }

  componentWillMount() {

    i18next.init({
      lng: window.getBoUserLang(),
      fallbackLng: 'de',
      resources: {
        de: {
          translation: de
        },
        en: {
          translation: en
        }
      }
    });

    this.setState({i18next: i18next});
  }

  onHide() {
    location.replace('/');
  }

  showModalFor(Comp) {
    return (props) => {
      return (
        <Modal show={true} onHide={this.onHide.bind(this)}>
          <Comp {...props} api={this.props.api} i18next={this.state.i18next}/>
        </Modal>
      );
    };
  }

  render() {
    return (
      <Router>
        <div>
          <Route exact path="/r/login" component={this.showModalFor(Login)}/>
          <Route exact path="/r/register" component={this.showModalFor(Registration)}/>
          <Route exact path="/r/reset-password" component={this.showModalFor(ResetPassword)}/>
          <Route exact path="/r/select-role" component={this.showModalFor(SelectRole)}/>
          <Route exact path="/r/participate" component={this.showModalFor(Participation)}/>
          <Route exact path="/r/create-join-team" component={this.showModalFor(CreateOrJoinTeam)}/>
        </div>
      </Router>
    );
  }
}

App.propTypes = {
  api: React.PropTypes.object
};

const createReactApp = (api) => {
  api.setAccessToken(getAccessToken());
  ReactDOM.render(
    <App api={api}/>,
    document.getElementById('react-root')
  );
};

BreakoutApi.initFromServer()
  .then(createReactApp)
  .catch(console.error);
{'fraction_non_alphanumeric': 0.15245009074410162, 'fraction_numerical': 0.0056462996571889496, 'mean_word_length': 3.0194489465153973, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, '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': '7619201', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1507, 'n_words': 290}