<commit_before>import React from 'react';

import { StudentDashboardStore, StudentDashboardActions } from '../../flux/student-dashboard';
import LoadableItem from '../loadable-item';
import { observable, computed, action, observe } from 'mobx';
import { observer, inject } from 'mobx-react';
import StudentDashboard from './dashboard';
import CourseNagModal from '../onboarding/course-nag';
import TermsModal from '../terms-modal';
import onboardingForCourse from '../../models/course/onboarding';
import Courses from '../../models/courses-map';

@inject((allStores, props) => ({
  tourContext: ( props.tourContext || allStores.tourContext ),
}))
@observer
export default class StudentDashboardShell extends React.PureComponent {

  static propTypes = {
    params: React.PropTypes.shape({
      courseId: React.PropTypes.string,
    }).isRequired,
    tourContext: React.PropTypes.object,
  }

  @computed get course() {
    return Courses.get(this.props.params.courseId);
  }

  ux = onboardingForCourse(this.course, this.props.tourContext);

  componentWillMount() {
    this.ux.mount(); // ux will use this to start silencing tours while it's displaying payment nags
  }

  componentWillUnmount() {
    this.ux.close(); // ux will tell context it's ok to display tours
  }

  render() {
    const { params, params: { courseId } } = this.props;

    if (this.ux.paymentIsPastDue) {
      return <CourseNagModal ux={this.ux} />;
    }

    return (
      <div className="student-dashboard ">
        <TermsModal />
        <CourseNagModal ux={this.ux} />
        <LoadableItem
          id={courseId}
          store={StudentDashboardStore}
          actions={StudentDashboardActions}
          renderItem={() => <StudentDashboard params={params} courseId={courseId} />}
        />
      </div>
    );
  }
}<commit_msg>comment rational for nag modal<commit_after>import React from 'react';

import { StudentDashboardStore, StudentDashboardActions } from '../../flux/student-dashboard';
import LoadableItem from '../loadable-item';
import { observable, computed, action, observe } from 'mobx';
import { observer, inject } from 'mobx-react';
import StudentDashboard from './dashboard';
import CourseNagModal from '../onboarding/course-nag';
import TermsModal from '../terms-modal';
import onboardingForCourse from '../../models/course/onboarding';
import Courses from '../../models/courses-map';

@inject((allStores, props) => ({
  tourContext: ( props.tourContext || allStores.tourContext ),
}))
@observer
export default class StudentDashboardShell extends React.PureComponent {

  static propTypes = {
    params: React.PropTypes.shape({
      courseId: React.PropTypes.string,
    }).isRequired,
    tourContext: React.PropTypes.object,
  }

  @computed get course() {
    return Courses.get(this.props.params.courseId);
  }

  ux = onboardingForCourse(this.course, this.props.tourContext);

  componentWillMount() {
    this.ux.mount(); // ux will use this to start silencing tours while it's displaying payment nags
  }

  componentWillUnmount() {
    this.ux.close(); // ux will tell context it's ok to display tours
  }

  render() {
    const { params, params: { courseId } } = this.props;

    // if student is past due BE will raise "forbidden" if we load the dashboard data
    if (this.ux.paymentIsPastDue) {
      return <CourseNagModal ux={this.ux} />;
    }

    return (
      <div className="student-dashboard ">
        <TermsModal />
        <CourseNagModal ux={this.ux} />
        <LoadableItem
          id={courseId}
          store={StudentDashboardStore}
          actions={StudentDashboardActions}
          renderItem={() => <StudentDashboard params={params} courseId={courseId} />}
        />
      </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.13404539385847797, 'fraction_numerical': 0.0, 'mean_word_length': 3.320645905420992, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, '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': '3863986', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1094, 'n_words': 271}