<commit_before>import { Meteor } from 'meteor/meteor';
import { PropTypes } from 'prop-types';
import React, { Component, Fragment } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { _Courses } from '../../api/courses/courses';
import { _Units } from '../../api/units/units';
import Courses from './content/Courses.jsx';
import { FloatingButton } from './Utilities/Utilities.jsx';
import ImgSlider from '../components/layouts/ImageSlider';
import * as Config from '../../../config.json';
import { Loader } from './Loader';
import ErrorBoundary from './ErrorBoundary'; // eslint-disable-line
import { ThemeContext } from '../containers/AppWrapper';

export class Home extends Component {
  componentDidMount() {
    if (!Config.isConfigured) {
      FlowRouter.go('/setup');
    }
  }

  renderCourses() {
    let index = 0;
    const { courses } = this.props;
    if (!courses) {
      return <span> No Courses </span>;
    } else if (courses.length === 0) {
      return <p> There are no Contents yet </p>;
    }
    return courses.map(cours => <Courses key={index++} course={cours} />);
  }

  render() {
    const { courseReady } = this.props;
    return (
      <ErrorBoundary>
        <ThemeContext.Consumer>
          {color => (
            <Fragment>
              <ImgSlider isDark={color.isDark} />
              <div className="container ">
                <div className="row ">
                  {courseReady ? this.renderCourses() : <Loader />}
                </div>
                <FloatingButton />
              </div>
            </Fragment>
          )}
        </ThemeContext.Consumer>
      </ErrorBoundary>
    );
  }
}

Home.propTypes = {
  unit: PropTypes.array,
  courses: PropTypes.array,
  subsReady: PropTypes.bool,
  courseReady: PropTypes.bool,
};

export default withTracker(() => {
  const handle = Meteor.subscribe('courses');
  Meteor.subscribe('slides');
  Meteor.subscribe('titles');
  return {
    courseReady: handle.ready(),
    unit: _Units.find().fetch(),
    courses: _Courses
      .find(
        {},
        {
          fields: {
            name: 1,
            details: 1,
          },
        },
      )
      .fetch(),
  };
})(Home);
<commit_msg>fixed the isDark issue in imgSlider<commit_after>import { Meteor } from 'meteor/meteor';
import { PropTypes } from 'prop-types';
import React, { Component, Fragment } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { _Courses } from '../../api/courses/courses';
import { _Units } from '../../api/units/units';
import Courses from './content/Courses.jsx';
import { FloatingButton } from './Utilities/Utilities.jsx';
import ImgSlider from '../components/layouts/ImageSlider';
import * as Config from '../../../config.json';
import { Loader } from './Loader';
import ErrorBoundary from './ErrorBoundary'; // eslint-disable-line
import { ThemeContext } from '../containers/AppWrapper';

export class Home extends Component {
  componentDidMount() {
    if (!Config.isConfigured) {
      FlowRouter.go('/setup');
    }
  }

  renderCourses() {
    let index = 0;
    const { courses } = this.props;
    if (!courses) {
      return <span> No Courses </span>;
    } else if (courses.length === 0) {
      return <p> There are no Contents yet </p>;
    }
    return courses.map(cours => <Courses key={index++} course={cours} />);
  }

  render() {
    const { courseReady } = this.props;
    return (
      <ErrorBoundary>
        <ThemeContext.Consumer>
          {({ state }) => (
            <Fragment>
              <ImgSlider isDark={state.isDark} />
              <div className="container ">
                <div className="row ">
                  {courseReady ? this.renderCourses() : <Loader />}
                </div>
                <FloatingButton />
              </div>
            </Fragment>
          )}
        </ThemeContext.Consumer>
      </ErrorBoundary>
    );
  }
}

Home.propTypes = {
  unit: PropTypes.array,
  courses: PropTypes.array,
  subsReady: PropTypes.bool,
  courseReady: PropTypes.bool,
};

export default withTracker(() => {
  const handle = Meteor.subscribe('courses');
  Meteor.subscribe('slides');
  Meteor.subscribe('titles');
  return {
    courseReady: handle.ready(),
    unit: _Units.find().fetch(),
    courses: _Courses
      .find(
        {},
        {
          fields: {
            name: 1,
            details: 1,
          },
        },
      )
      .fetch(),
  };
})(Home);

{'fraction_non_alphanumeric': 0.1558731576596695, 'fraction_numerical': 0.001786511835640911, 'mean_word_length': 2.236271676300578, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 45, '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': '337502', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1342, 'n_words': 309}