<commit_before>import React from 'react';
import { Link } from 'react-router';
import MainNav from '../../components/Navigation/MainNav';

import ExploreMap from '../../containers/Explore/ExploreMap';
import ExploreMapSidebar from '../../containers/Explore/ExploreSidebar';
import ExploreMapLegend from '../../containers/Explore/ExploreLegend';

import ShareModal from '../Modal/ShareModal';
import Button from '../Button/Button';

import metadata from 'json!../../metadata.json';
import logoImage from '../../../images/prep-logo.png';

class Explore extends React.Component {

  constructor() {
    super();
    this.state = {
      modalShareOpen: false
    };
  }

  getChildContext() {
    return {
      location: {
        pathname: this.props.location.pathname,
        query: this.props.location.query,
        params: this.props.params
      }
    };
  }

  componentWillMount() {
    this.currentData = this.getData('pathname', 'explore');
    if (!this.props.data.list.length) {
      const { query } = this.props.params;
      if (query && query.activeDatasets) {
        this.props.getDatasets(query.activeDatasets.split(','));
      } else {
        this.props.getDatasets();
      }
    }
    document.title = this.currentData.title;
  }

  componentWillUpdate() {
    this.currentData = this.getData('pathname', 'explore');
    document.title = this.currentData.title;
  }

  getData(key, value) {
    let data = null;
    for (let i = metadata.length - 1; i >= 0; i--) {
      if (metadata[i][key] === value) {
        data = metadata[i];
        break;
      }
    }
    return data;
  }

  render() {
    const currentData = this.currentData;

    return (
      <div className="l-explore -theme-2">
        <header className="l-header -expanded">
          <div className={`l-header-nav -short ${currentData.name === 'home' ? '-no-bg' : ''}`}>
            <div className="row align-middle">
              <div className="column small-10 medium-4">
                <Link to={'/'} className="logo">
                  <img src={logoImage} alt="Partnership for Resilience and Preparedness" />
                </Link>
              </div>
              <div className="column small-2 medium-8">
                <MainNav />
              </div>
            </div>
          </div>
          <div className="l-header-tools-map">
            <a className="c-button -action -theme-color" href="http://prepdata.sdgs.opendata.arcgis.com/" target="_blank"> Open data portal </a>
            <Button themeColor click={() => this.setState({ modalShareOpen: true })}> Share </Button>
          </div>
        </header>

        <ExploreMapSidebar />
        <ExploreMap />
        <ExploreMapLegend />

        {this.state.modalShareOpen &&
          <ShareModal
            title={"Share this page"}
            url={window.location.href}
            opened={this.state.modalShareOpen}
            close={() => this.setState({ modalShareOpen: false })}
          />
        }

      </div>
    );
  }
}

Explore.childContextTypes = {
  location: React.PropTypes.object
};

Explore.propTypes = {
  getDatasets: React.PropTypes.func.isRequired,
  data: React.PropTypes.any.isRequired,
  location: React.PropTypes.object.isRequired,
  params: React.PropTypes.object.isRequired
};

export default Explore;
<commit_msg>Fix initial layers load<commit_after>import React from 'react';
import { Link } from 'react-router';
import MainNav from '../../components/Navigation/MainNav';

import ExploreMap from '../../containers/Explore/ExploreMap';
import ExploreMapSidebar from '../../containers/Explore/ExploreSidebar';
import ExploreMapLegend from '../../containers/Explore/ExploreLegend';

import ShareModal from '../Modal/ShareModal';
import Button from '../Button/Button';

import metadata from 'json!../../metadata.json';
import logoImage from '../../../images/prep-logo.png';

class Explore extends React.Component {

  constructor() {
    super();
    this.state = {
      modalShareOpen: false
    };
  }

  getChildContext() {
    return {
      location: {
        pathname: this.props.location.pathname,
        query: this.props.location.query,
        params: this.props.params
      }
    };
  }

  componentWillMount() {
    this.currentData = this.getData('pathname', 'explore');
    if (!this.props.data.list.length) {
      const { query } = this.props.location;
      if (query && query.activeDatasets) {
        this.props.getDatasets(query.activeDatasets.split(','));
      } else {
        this.props.getDatasets();
      }
    }
    document.title = this.currentData.title;
  }

  componentWillUpdate() {
    this.currentData = this.getData('pathname', 'explore');
    document.title = this.currentData.title;
  }

  getData(key, value) {
    let data = null;
    for (let i = metadata.length - 1; i >= 0; i--) {
      if (metadata[i][key] === value) {
        data = metadata[i];
        break;
      }
    }
    return data;
  }

  render() {
    const currentData = this.currentData;

    return (
      <div className="l-explore -theme-2">
        <header className="l-header -expanded">
          <div className={`l-header-nav -short ${currentData.name === 'home' ? '-no-bg' : ''}`}>
            <div className="row align-middle">
              <div className="column small-10 medium-4">
                <Link to={'/'} className="logo">
                  <img src={logoImage} alt="Partnership for Resilience and Preparedness" />
                </Link>
              </div>
              <div className="column small-2 medium-8">
                <MainNav />
              </div>
            </div>
          </div>
          <div className="l-header-tools-map">
            <a className="c-button -action -theme-color" href="http://prepdata.sdgs.opendata.arcgis.com/" target="_blank"> Open data portal </a>
            <Button themeColor click={() => this.setState({ modalShareOpen: true })}> Share </Button>
          </div>
        </header>

        <ExploreMapSidebar />
        <ExploreMap />
        <ExploreMapLegend />

        {this.state.modalShareOpen &&
          <ShareModal
            title={"Share this page"}
            url={window.location.href}
            opened={this.state.modalShareOpen}
            close={() => this.setState({ modalShareOpen: false })}
          />
        }

      </div>
    );
  }
}

Explore.childContextTypes = {
  location: React.PropTypes.object
};

Explore.propTypes = {
  getDatasets: React.PropTypes.func.isRequired,
  data: React.PropTypes.any.isRequired,
  location: React.PropTypes.object.isRequired,
  params: React.PropTypes.object.isRequired
};

export default Explore;

{'fraction_non_alphanumeric': 0.15123271196632593, 'fraction_numerical': 0.0024052916416115455, 'mean_word_length': 2.2612745098039215, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 61, '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': '4369457', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1981, 'n_words': 399}