<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import { getParameterByName } from '../../../libs/getParameterByName';
import { goToNextSlide } from '../../../actions/classroomSessions';
import {
  ClassroomLessonSession,
} from '../interfaces'
import {
  ClassroomLesson
} from '../../../interfaces/classroomLessons'

class NextSlideButton extends Component<any, any> {
  constructor(props) {
    super(props);
    this.goToNextSlide = this.goToNextSlide.bind(this);
  }

  goToNextSlide() {
    const ca_id: string|null = getParameterByName('classroom_activity_id');
    const sessionData: ClassroomLessonSession = this.props.classroomSessions.data;
    const lessonData: ClassroomLesson = this.props.classroomLesson.data;
    if (ca_id) {
      const updateInStore = goToNextSlide(ca_id, sessionData, lessonData);
      if (updateInStore) {
        this.props.dispatch(updateInStore);
      }
    }
  }

  render() {
    const data = this.props.classroomSessions.data;
    const lessonsData = this.props.classroomLesson.data
    if (lessonsData.questions && Number(data.current_slide) === lessonsData.questions.length - 1) {
      return <span />;
    } else if (Number(data.current_slide) === 0) {
      return <span>Press the <span>right arrow key</span> to continue to the next slide.<button onClick={this.goToNextSlide}>Next Slide</button></span>
    }
    return (
      <button onClick={this.goToNextSlide}>Next Slide</button>
    );
  }
}

function select(props) {
  return {
    classroomSessions: props.classroomSessions,
    classroomLesson: props.classroomLesson,
  };
}

function mergeProps(stateProps: Object, dispatchProps: Object, ownProps: Object) {
  return {...ownProps, ...stateProps, ...dispatchProps}
}

export default connect(select, dispatch => ({dispatch}), mergeProps)(NextSlideButton);<commit_msg>fix next slide button so it uses editionQuestions data, not lesson data<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import { getParameterByName } from '../../../libs/getParameterByName';
import { goToNextSlide } from '../../../actions/classroomSessions';
import {
  ClassroomLessonSession,
} from '../interfaces'
import {
  EditionQuestions
} from '../../../interfaces/customize'

class NextSlideButton extends Component<any, any> {
  constructor(props) {
    super(props);
    this.goToNextSlide = this.goToNextSlide.bind(this);
  }

  goToNextSlide() {
    const ca_id: string|null = getParameterByName('classroom_activity_id');
    const sessionData: ClassroomLessonSession = this.props.classroomSessions.data;
    const editionData: EditionQuestions = this.props.customize.editionQuestions;
    if (ca_id) {
      const updateInStore = goToNextSlide(ca_id, sessionData, editionData);
      if (updateInStore) {
        this.props.dispatch(updateInStore);
      }
    }
  }

  render() {
    const data = this.props.classroomSessions.data;
    const editionData = this.props.customize.editionQuestions
    if (editionData.questions && Number(data.current_slide) === editionData.questions.length - 1) {
      return <span />;
    } else if (Number(data.current_slide) === 0) {
      return <span>Press the <span>right arrow key</span> to continue to the next slide.<button onClick={this.goToNextSlide}>Next Slide</button></span>
    }
    return (
      <button onClick={this.goToNextSlide}>Next Slide</button>
    );
  }
}

function select(props) {
  return {
    classroomSessions: props.classroomSessions,
    customize: props.customize,
  };
}

function mergeProps(stateProps: Object, dispatchProps: Object, ownProps: Object) {
  return {...ownProps, ...stateProps, ...dispatchProps}
}

export default connect(select, dispatch => ({dispatch}), mergeProps)(NextSlideButton);
{'fraction_non_alphanumeric': 0.1327899027083881, 'fraction_numerical': 0.001051801209571391, 'mean_word_length': 3.966057441253264, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '3432439', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1158, 'n_words': 244}