<commit_before>"use strict";

var React = require('react')
  , Immutable = require('immutable')
  , UserHomepage
  , NonUserHomepage

UserHomepage = React.createClass({
  getInitialState() {
    return { activity: Immutable.List() }
  },

  componentDidMount() {
    var getLinks = require('../../../helpers/get_links')
      , { user } = this.props
      , activityURL = user.get('activity')

    fetch(activityURL, { headers: { Accept: 'application/json' }})
      .then(response => response.json())
      .then(data => data.results)
      .then(Immutable.fromJS)
      .then(activity => this.setState({ activity }))
  },

  render() {
    var ActivityList = require('./activity_list.jsx')
      , { user } = this.props
      , { activity } = this.state
      , projects

    projects = user
      .get('projects')
      .map(url => user.get('embedded').get(url))

    return (
      <div>
        <div>
          <a href="/auth/account/">Account settings</a>
          <hr />
        </div>

        <div className="row">
          <div className="span6">
            <h3>My projects</h3>
            {
              projects.map((project, i) =>
                <div key={i}>
                  <h3><a href={project.get('url')}>{ project.get('name') }</a></h3>
                  <div>
                    <a className="btn btn-primary" href={project.get('notes') + 'add/'}>
                      Add note
                    </a>
                  </div>
                </div>
              )
            }
          </div>
          <div className="span6">
            <h3>Recent activity</h3>
            <ActivityList activities={activity} />
          </div>
        </div>
      </div>
    )
  }
});


NonUserHomepage = React.createClass({
  render() {
    var { data } = this.props

    return (
      <div>
        <h1>Working Notes</h1>
        <p className="large">
          Working Notes is an <a href="http://github.com/editorsnotes">open-source</a>, web-based tool for recording, organizing, preserving, and opening access to research notes, built with the needs of documentary editing projects, archives, and library special collections in mind.
        </p>

        <h2>Sign up</h2>
        <p><a href="/auth/account/create">Create an account</a></p>

        <h2>Recently edited notes</h2>
        <ul>
        {
          data.get('results').map(note =>
            <li key={note.get('id')}>
              <a href={note.get('url')}>{ note.get('title') }</a>
              {' (by '}
              <a href={note.getIn(['project', 'url'])}>
               { note.getIn(['project', 'name']) }
              </a>
              {')'}
            </li>
          )
        }
        </ul>
      </div>
    )
  }
});


module.exports = React.createClass({
  displayName: 'Homepage',

  render() {
    var { user } = this.props
      , HomeComponent = user ? UserHomepage : NonUserHomepage

    return <HomeComponent {...this.props} />
  }
});<commit_msg>For the time being, take out "recently edited notes" from front page<commit_after>"use strict";

var React = require('react')
  , Immutable = require('immutable')
  , UserHomepage
  , NonUserHomepage

UserHomepage = React.createClass({
  getInitialState() {
    return { activity: Immutable.List() }
  },

  componentDidMount() {
    var getLinks = require('../../../helpers/get_links')
      , { user } = this.props
      , activityURL = user.get('activity')

    fetch(activityURL, { headers: { Accept: 'application/json' }})
      .then(response => response.json())
      .then(data => data.results)
      .then(Immutable.fromJS)
      .then(activity => this.setState({ activity }))
  },

  render() {
    var ActivityList = require('./activity_list.jsx')
      , { user } = this.props
      , { activity } = this.state
      , projects

    projects = user
      .get('projects')
      .map(url => user.get('embedded').get(url))

    return (
      <div>
        <div>
          <a href="/auth/account/">Account settings</a>
          <hr />
        </div>

        <div className="row">
          <div className="span6">
            <h3>My projects</h3>
            {
              projects.map((project, i) =>
                <div key={i}>
                  <h3><a href={project.get('url')}>{ project.get('name') }</a></h3>
                  <div>
                    <a className="btn btn-primary" href={project.get('notes') + 'add/'}>
                      Add note
                    </a>
                  </div>
                </div>
              )
            }
          </div>
          <div className="span6">
            <h3>Recent activity</h3>
            <ActivityList activities={activity} />
          </div>
        </div>
      </div>
    )
  }
});


NonUserHomepage = React.createClass({
  render() {
    var { data } = this.props

    return (
      <div>
        <h1>Working Notes</h1>
        <p className="large">
          Working Notes is an <a href="http://github.com/editorsnotes">open-source</a>, web-based tool for recording, organizing, preserving, and opening access to research notes, built with the needs of documentary editing projects, archives, and library special collections in mind.
        </p>

        <h2>Sign up</h2>
        <p><a href="/auth/account/create">Create an account</a></p>
      </div>
    )
  }
});


module.exports = React.createClass({
  displayName: 'Homepage',

  render() {
    var { user } = this.props
      , HomeComponent = user ? UserHomepage : NonUserHomepage

    return <HomeComponent {...this.props} />
  }
});
{'fraction_non_alphanumeric': 0.16090712742980562, 'fraction_numerical': 0.004679625629949604, 'mean_word_length': 1.8051489146895507, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 110, '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': '1067896', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1633, 'n_words': 351}