<commit_before>import { default as React, PropTypes } from 'react';
import { map } from 'lodash';
import { connect } from 'react-redux';
import Link from '../../common/components/link/index';
import PathItem from '../../common/components/path/index';
import SavedPathLink from '../../common/components/saved_path_link/index';
import Loading from '../../common/components/loading/index';

class Explore extends React.Component {

  render() {
    const { path, preview_url } = this.props;
    return (
      <div className="l-explore">
        <div className="l-path">
          <div className="path-list">
            {map(path, (url) => <PathItem url={url} key={url} /> )}
          </div>
          <Loading />
          <SavedPathLink />
        </div>
        <ul className='l-links'>
          {map(path, (url) => <Link key={url} url={url} /> )}
        </ul>
      </div>
    );
  }
}


function mapStateToProps(state) {
  return {
    path: state.path,
    preview_url: state.preview_url
  }
}

Explore = connect(mapStateToProps)(Explore);
export default Explore;<commit_msg>toggle view and map<commit_after>import { default as React, PropTypes } from 'react';
import { map } from 'lodash';
import { connect } from 'react-redux';
import Link from '../../common/components/link/index';
import PathItem from '../../common/components/path/index';
import SavedPathLink from '../../common/components/saved_path_link/index';
import Loading from '../../common/components/loading/index';
import PathMap from '../../common/components/path_map/index';
import ViewMode from '../../common/components/view_mode/index';

class Explore extends React.Component {

  render() {
    const { path, preview_url, view_mode } = this.props;

    return (
      <div className="l-explore">
        <div className="l-path">
          <div className="path-list">
            {map(path, (url) => <PathItem url={url} key={url} /> )}
          </div>
          <Loading />
          <SavedPathLink />
        </div>
        <div className="l-contents">
          {(() => {
            if (view_mode == 'explore') {
              return (
                <ul className='l-links'>
                  {map(path, (url) => <Link key={url} url={url} /> )}
                </ul>
              );
            } else {
              return (
                <div className="l-map">
                  <PathMap />
                </div>
              );
            }
          })()}
        </div>
        <div className="l-view-mode">
          <ViewMode />
        </div>
      </div>
    );
  }
}


function mapStateToProps(state) {
  return {
    path: state.path,
    preview_url: state.preview_url,
    view_mode: state.view_mode
  }
}

Explore = connect(mapStateToProps)(Explore);
export default Explore;
{'fraction_non_alphanumeric': 0.16198704103671707, 'fraction_numerical': 0.0, 'mean_word_length': 2.0877777777777777, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 40, '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': '7117820', 'n_tokens_mistral': 829, 'n_tokens_neox': 821, 'n_words': 184}