/*
 * HomePage
 *
 * This is the first thing users see of our App, at the '/' route
 */

import React from 'react';
import Helmet from 'react-helmet';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';

import AtPrefix from './AtPrefix';
import CenteredSection from './CenteredSection';
import Form from './Form';
import H2 from 'components/H2';
import Input from './Input';
import List from 'components/List';
import ListItem from 'components/ListItem';
import LoadingIndicator from 'components/LoadingIndicator';
import RepoListItem from 'containers/RepoListItem';
import Section from './Section';
import messages from './messages';
import { loadRepos } from '../App/actions';
import { changeUsername } from './actions';
import { selectUsername } from './selectors';
import { selectRepos, selectLoading, selectError } from 'containers/App/selectors';

import { bindActionCreators } from 'redux';
import { compose, withContext, getContext, withHandlers } from 'recompose';
import * as actions from './actions';

const HomePage = ({ username, onChangeUsernameCreator }) => {
  return (
    <div>
      <Input
        id="username"
        type="text"
        placeholder="mxstbr"
        value={username}
        onChange={onChangeUsernameCreator}
      />
    </div>
  );
};

HomePage.propTypes = {
  onChangeUsernameCreator: React.PropTypes.func,
};

// export function mapDispatchToProps(dispatch) {
//   return {
//     onChangeUsername: (evt) => dispatch(changeUsername(evt.target.value)),
//     onSubmitForm: (evt) => {
//       if (evt !== undefined && evt.preventDefault) evt.preventDefault();
//       dispatch(loadRepos());
//     },
//   };
// }

const mapStateToProps = createStructuredSelector({
  repos: selectRepos(),
  username: selectUsername(),
  loading: selectLoading(),
  error: selectError(),
});

// Wrap the component to inject dispatch and state into it
// export default connect(mapStateToProps, mapDispatchToProps)(HomePage);
export default compose(
  connect(mapStateToProps, (dispatch) => ({
    actions: bindActionCreators(actions, dispatch),
  })),
  withContext({
    actions: React.PropTypes.object.isRequired,
  }, (props) => ({
    actions: props.actions,
  })),
  getContext({
    actions: React.PropTypes.object.isRequired,
  }),
  withHandlers({
    onChangeUsernameCreator: (props) => (event) => {
      props.actions.changeUsername(event.target.value);
    },
  }),
)(HomePage);

@@ -113,90 +113,8 @@
 t';%0A
-import Helmet from 'react-helmet';%0Aimport %7B FormattedMessage %7D from 'react-intl';%0A
 impo
@@ -213,518 +213,27 @@
 ort 
-AtPrefix from './AtPrefix';%0Aimport CenteredSection from './CenteredSection';%0Aimport Form from './Form';%0Aimport H2 from 'components/H2';%0Aimport Input from './Input';%0Aimport List from 'components/List';%0Aimport ListItem from 'components/ListItem';%0Aimport LoadingIndicator from 'components/LoadingIndicator';%0Aimport RepoListItem from 'containers/RepoListItem';%0Aimport Section from './Section';%0Aimport messages from './messages';%0Aimport %7B loadRepos %7D from '../App/actions';%0Aimport %7B changeUsername %7D from './actions
+Input from './Input
 ';%0Ai
@@ -861,316 +861,46 @@
 nc,%0A
-%7D;%0A%0A// export function mapDispatchToProps(dispatch) %7B%0A//   return %7B%0A//     onChangeUsername: (evt) =%3E dispatch(changeUsername(evt.target.value)),%0A//     onSubmitForm: (evt) =%3E %7B%0A//       if (evt !== undefined && evt.preventDefault) evt.preventDefault();%0A//       dispatch(loadRepos());%0A//     %7D,%0A//   %7D;%0A// %7D
+  username: React.PropTypes.string,%0A%7D;
 %0A%0Aco
@@ -1063,141 +1063,8 @@
 );%0A%0A
-// Wrap the component to inject dispatch and state into it%0A// export default connect(mapStateToProps, mapDispatchToProps)(HomePage);%0A
 expo

Remove unused code