<commit_before>import React, {PropTypes} from 'react'
import {push} from 'react-router-redux'
import {connect} from 'react-redux'
import Toggle from 'material-ui/Toggle'

import ReviewList from '../components/ReviewList'
import TalkAbout from '../components/TalkAbout'
import ReadyUsers from '../components/ReadyUsers'
import {ready as liveReady, join} from '../actions/live'
import WebRTC from 'webrtc-adapter'

class InvitationsRaw extends React.Component {

  static propTypes = {
    join: PropTypes.func.isRequired,
    lessons: PropTypes.object.isRequired
  }

  handleClick = (e, lesson) => {
    e.preventDefault()
    this.props.join(lesson)
  }

  render () {
    const {lessons} = this.props
    return (
      <div>
        {Object.keys(lessons).map((id) => {
          const lesson = lessons[id]
          const handler = (e) => this.handleClick(e, lesson)
          return (
            <div key={lesson.id}>{lesson.id} {lesson.state} <a href='#' onClick={handler}>accept</a></div>
          )
        })}
      </div>
    )
  }
}

const Invitations = connect((state, props) => {
  const {live: {lessons}} = state
  return {lessons}
}, {join})(InvitationsRaw)

class ReadyPage extends React.Component {

  static propTypes = {
    push: PropTypes.func.isRequired,
    liveReady: PropTypes.func.isRequired,
    user: PropTypes.object,
    online: PropTypes.object,
    ready: PropTypes.bool,
    connected: PropTypes.bool
  }

  handleReadyChange = (e) => {
    this.props.liveReady({ready: e.target.checked})
  }

  render () {
    const {user: {profile: {role} = {}} = {}} = this.props
    const {teachers = 0, students = 0} = this.props.online

    return (
      <div style={{padding: 16}}>

        {!WebRTC.browserDetails.version ? (
          <div style={{padding: 16, border: 'solid 1px darkred', background: '#F88379', marginBottom: 16}}>
            This browser does not support audio and video calls. You won't be able to participate in lessons. Please try a recent version of Google Chrome, Firefox or Microsoft Edge.
          </div>
        ) : undefined}

        {role === 'student' ? (
          <div style={{display: 'flex', alignItems: 'center'}}>
            <div style={{margin: 20}}><Toggle toggled={this.props.ready} onToggle={this.handleReadyChange} /></div>
            <div style={{margin: 8, color: this.props.ready ? 'darkgreen' : 'darkred'}}>{this.props.ready ? 'You are ready' : 'You are not ready'}</div>
          </div>
        ) : undefined}

        <div>{this.props.connected ? 'connected' : 'not connected'}</div>
        <div>Online teachers: {teachers} | Online students: {students}</div>

        {role === 'teacher' ? (
          <ReadyUsers />
        ) : undefined}

        <div>
          <h2>Invitations</h2>
          <Invitations />
        </div>
        <div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'center', maxWidth: 1000, width: '100%', margin: '0 auto'}}>
          <ReviewList style={{flex: '0 1 600px', margin: '0 8px'}} />
        </div>
        <TalkAbout />
      </div>
    )
  }
}

export default connect((state, props) => {
  const {live: {connected, ready, online}, profile: {profile: user}} = state
  return {connected, ready, online, user}
}, {push, liveReady})(ReadyPage)
<commit_msg>Removed war invitation list<commit_after>import React, {PropTypes} from 'react'
import {push} from 'react-router-redux'
import {connect} from 'react-redux'
import Toggle from 'material-ui/Toggle'

import ReviewList from '../components/ReviewList'
import TalkAbout from '../components/TalkAbout'
import ReadyUsers from '../components/ReadyUsers'
import {ready as liveReady} from '../actions/live'
import WebRTC from 'webrtc-adapter'

class ReadyPage extends React.Component {

  static propTypes = {
    push: PropTypes.func.isRequired,
    liveReady: PropTypes.func.isRequired,
    user: PropTypes.object,
    online: PropTypes.object,
    ready: PropTypes.bool,
    connected: PropTypes.bool
  }

  handleReadyChange = (e) => {
    this.props.liveReady({ready: e.target.checked})
  }

  render () {
    const {user: {profile: {role} = {}} = {}} = this.props
    const {teachers = 0, students = 0} = this.props.online

    return (
      <div style={{padding: 16}}>

        {!WebRTC.browserDetails.version ? (
          <div style={{padding: 16, border: 'solid 1px darkred', background: '#F88379', marginBottom: 16}}>
            This browser does not support audio and video calls. You won't be able to participate in lessons. Please try a recent version of Google Chrome, Firefox or Microsoft Edge.
          </div>
        ) : undefined}

        {role === 'student' ? (
          <div style={{display: 'flex', alignItems: 'center'}}>
            <div style={{margin: 20}}><Toggle toggled={this.props.ready} onToggle={this.handleReadyChange} /></div>
            <div style={{margin: 8, color: this.props.ready ? 'darkgreen' : 'darkred'}}>{this.props.ready ? 'You are ready' : 'You are not ready'}</div>
          </div>
        ) : undefined}

        <div>{this.props.connected ? 'connected' : 'not connected'}</div>
        <div>Online teachers: {teachers} | Online students: {students}</div>

        {role === 'teacher' ? (
          <ReadyUsers />
        ) : undefined}

        <div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'center', maxWidth: 1000, width: '100%', margin: '0 auto'}}>
          <ReviewList style={{flex: '0 1 600px', margin: '0 8px'}} />
        </div>
        <TalkAbout />
      </div>
    )
  }
}

export default connect((state, props) => {
  const {live: {connected, ready, online}, profile: {profile: user}} = state
  return {connected, ready, online, user}
}, {push, liveReady})(ReadyPage)

{'fraction_non_alphanumeric': 0.15490743974851554, 'fraction_numerical': 0.011526370939573873, 'mean_word_length': 2.9415003441156227, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 62, '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': '5420595', 'n_tokens_mistral': 1804, 'n_tokens_neox': 1737, 'n_words': 473}