<commit_before>import React from 'react';
import request from 'request';

import PreviewOrLaunchModal from '../shared/preview_or_launch_modal';

export default class extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      lessons: null,
      showModal: false,
      completedDiagnosticUnitInfo: null
    };

    this.openModal = this.openModal.bind(this);
    this.closeModal = this.closeModal.bind(this);
  }

  componentDidMount() {
    this.getListOfAssignedLessons();
    this.getCompletedDiagnosticInfo();
  }

  getListOfAssignedLessons() {
    const that = this;
    request.get({
      url: `${process.env.DEFAULT_URL}/teachers/classroom_activities/lessons_units_and_activities`,
    },
    (e, r, lessons) => {
      that.setState({ lessons: JSON.parse(lessons).data, });
    });
  }

  getCompletedDiagnosticInfo() {
    const that = this;
    request.get({
      url: `${process.env.DEFAULT_URL}/teachers/get_completed_diagnostic_unit_info`,
    },
    (e, r, body) => {
      that.setState({ completedDiagnosticUnitInfo: JSON.parse(body).unit_info, });
    });
  }

  openModal(unitID) {
    this.setState({ showModal: unitID, });
  }

  closeModal() {
    this.setState({ showModal: false, });
  }

  renderAssignedLessons() {
    const lessons = this.state.lessons;
    const rows = [];
    for (let i = 0; i < Math.min(4, lessons.length); i++) {
      const l = lessons[i];
      rows.push(
        <div key={JSON.stringify(l)}>
          {this.renderModal(l.activity_id, l.unit_id)}
          <div className="flex-row space-between vertically-centered lesson-item">
            <div className="flex-row vertically-centered">
              <div className="image-container flex-row space-around vertically-centered">
                <img alt="quill-logo" src="/images/lesson_icon_green.svg" />
              </div>
              <span onClick={() => this.openModal(l.unit_id)} className="lesson-name">{l.name}</span>
            </div>
            <a href={`/teachers/units/${l.unit_id}/launch_lesson/${l.activity_id}`} className="q-button bg-quillgreen text-white">Launch Lesson</a>
          </div>
        </div>
      );
    }
    return rows;
  }

  renderModal(lessonID, unitID) {
    if (this.state.showModal === unitID) {
      return <PreviewOrLaunchModal
        lessonID={lessonID}
        unitID={unitID}
        closeModal={this.closeModal}
      />;
    }
  }

  renderModalContent() {
    if (this.state.lessons && this.state.lessons.length) {
      return <div className="inner-container">
        <div className="header-container flex-row space-between vertically-centered lesson-item">
          <h3 >
            List of Assigned Quill Lessons
          </h3>
          <a href="/teachers/classrooms/activity_planner/lessons">View All Assigned Lessons </a>
        </div>
        {this.renderAssignedLessons()}
      </div>
    } else if (this.state.completedDiagnosticUnitInfo) {
      const {unit_id, classroom_id, activity_id} = this.state.completedDiagnosticUnitInfo
      return <div className="inner-container">
        <div className="header-container flex-row space-between vertically-centered lesson-item">
          <h3 >
            List of Assigned Quill Lessons
          </h3>
          <a href={`/teachers/progress_reports/diagnostic_reports#/u/${unit_id}/a/${activity_id}/c/${classroom_id}/recommendations`}>View and Assign Quill Recommendations </a>
        </div>
        <div className="no-assigned-lessons completed-diagnostic">
          <img src={`${process.env.CDN_URL}/images/Illustrations/empty_state_lessons_launch_card.svg`} />
          <p>Based on your class performance on the diagnostic, your students need instructions in concepts such as <span className="recommendation">Complex Sentences</span>, <span className="recommendation">Fragments</span> and <span className="recommendation">Compound Sentences</span>.</p>
        </div>
      </div>
    } else {
      return <div className="inner-container">
        <div className="header-container flex-row space-between vertically-centered lesson-item">
          <h3 >
            List of Assigned Quill Lessons
          </h3>
          <a href="/teachers/classrooms/assign_activities/create-unit?tool=lessons">View and Assign Quill Lessons </a>
        </div>
        <div className="no-assigned-lessons">
          <img src={`${process.env.CDN_URL}/images/Illustrations/empty_state_lessons_launch_card.svg`} />
          <p>Once you assign a shared group lesson, you can launch it from this window.</p>
          <p>Quill Lessons provides whole-class lessons that are led by the teacher.</p>
          <p>Select questions for your students and instantly see their responses. <a target="_blank" href="/tools/lessons">Learn More</a></p>
        </div>
      </div>
    }
  }

  render() {
      return (
        <div className="mini_container results-overview-mini-container col-md-8 col-sm-10 text-center lessons-list">
          {this.renderModalContent()}
        </div>);
    return <span />;
  }
}<commit_msg>downcase illustrations in cdn path<commit_after>import React from 'react';
import request from 'request';

import PreviewOrLaunchModal from '../shared/preview_or_launch_modal';

export default class extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      lessons: null,
      showModal: false,
      completedDiagnosticUnitInfo: null
    };

    this.openModal = this.openModal.bind(this);
    this.closeModal = this.closeModal.bind(this);
  }

  componentDidMount() {
    this.getListOfAssignedLessons();
    this.getCompletedDiagnosticInfo();
  }

  getListOfAssignedLessons() {
    const that = this;
    request.get({
      url: `${process.env.DEFAULT_URL}/teachers/classroom_activities/lessons_units_and_activities`,
    },
    (e, r, lessons) => {
      that.setState({ lessons: JSON.parse(lessons).data, });
    });
  }

  getCompletedDiagnosticInfo() {
    const that = this;
    request.get({
      url: `${process.env.DEFAULT_URL}/teachers/get_completed_diagnostic_unit_info`,
    },
    (e, r, body) => {
      that.setState({ completedDiagnosticUnitInfo: JSON.parse(body).unit_info, });
    });
  }

  openModal(unitID) {
    this.setState({ showModal: unitID, });
  }

  closeModal() {
    this.setState({ showModal: false, });
  }

  renderAssignedLessons() {
    const lessons = this.state.lessons;
    const rows = [];
    for (let i = 0; i < Math.min(4, lessons.length); i++) {
      const l = lessons[i];
      rows.push(
        <div key={JSON.stringify(l)}>
          {this.renderModal(l.activity_id, l.unit_id)}
          <div className="flex-row space-between vertically-centered lesson-item">
            <div className="flex-row vertically-centered">
              <div className="image-container flex-row space-around vertically-centered">
                <img alt="quill-logo" src="/images/lesson_icon_green.svg" />
              </div>
              <span onClick={() => this.openModal(l.unit_id)} className="lesson-name">{l.name}</span>
            </div>
            <a href={`/teachers/units/${l.unit_id}/launch_lesson/${l.activity_id}`} className="q-button bg-quillgreen text-white">Launch Lesson</a>
          </div>
        </div>
      );
    }
    return rows;
  }

  renderModal(lessonID, unitID) {
    if (this.state.showModal === unitID) {
      return <PreviewOrLaunchModal
        lessonID={lessonID}
        unitID={unitID}
        closeModal={this.closeModal}
      />;
    }
  }

  renderModalContent() {
    if (this.state.lessons && this.state.lessons.length) {
      return <div className="inner-container">
        <div className="header-container flex-row space-between vertically-centered lesson-item">
          <h3 >
            List of Assigned Quill Lessons
          </h3>
          <a href="/teachers/classrooms/activity_planner/lessons">View All Assigned Lessons </a>
        </div>
        {this.renderAssignedLessons()}
      </div>
    } else if (this.state.completedDiagnosticUnitInfo) {
      const {unit_id, classroom_id, activity_id} = this.state.completedDiagnosticUnitInfo
      return <div className="inner-container">
        <div className="header-container flex-row space-between vertically-centered lesson-item">
          <h3 >
            List of Assigned Quill Lessons
          </h3>
          <a href={`/teachers/progress_reports/diagnostic_reports#/u/${unit_id}/a/${activity_id}/c/${classroom_id}/recommendations`}>View and Assign Quill Recommendations </a>
        </div>
        <div className="no-assigned-lessons completed-diagnostic">
          <img src={`${process.env.CDN_URL}/images/illustrations/empty_state_lessons_launch_card.svg`} />
          <p>Based on your class performance on the diagnostic, your students need instructions in concepts such as <span className="recommendation">Complex Sentences</span>, <span className="recommendation">Fragments</span> and <span className="recommendation">Compound Sentences</span>.</p>
        </div>
      </div>
    } else {
      return <div className="inner-container">
        <div className="header-container flex-row space-between vertically-centered lesson-item">
          <h3 >
            List of Assigned Quill Lessons
          </h3>
          <a href="/teachers/classrooms/assign_activities/create-unit?tool=lessons">View and Assign Quill Lessons </a>
        </div>
        <div className="no-assigned-lessons">
          <img src={`${process.env.CDN_URL}/images/illustrations/empty_state_lessons_launch_card.svg`} />
          <p>Once you assign a shared group lesson, you can launch it from this window.</p>
          <p>Quill Lessons provides whole-class lessons that are led by the teacher.</p>
          <p>Select questions for your students and instantly see their responses. <a target="_blank" href="/tools/lessons">Learn More</a></p>
        </div>
      </div>
    }
  }

  render() {
      return (
        <div className="mini_container results-overview-mini-container col-md-8 col-sm-10 text-center lessons-list">
          {this.renderModalContent()}
        </div>);
    return <span />;
  }
}
{'fraction_non_alphanumeric': 0.13454151482320498, 'fraction_numerical': 0.0021668472372697724, 'mean_word_length': 2.824482109227872, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 135, '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': '533139', 'n_tokens_mistral': 3118, 'n_tokens_neox': 3055, 'n_words': 618}