<commit_before>// react
import React, { Component, PropTypes } from 'react';

// react-native
import { View, Text } from 'react-native';

// redux
import { connect } from 'react-redux';

import styles from './styles';

// styles
class Home extends Component {
  static propTypes = {
    athlete: PropTypes.shape({
      firstname: PropTypes.string,
      lastname: PropTypes.lastname,
    }).isRequired,
  };

  render() {
    const { athlete } = this.props;
    return (
      <View style={styles.home}>
        <Text>{ athlete.firstname }</Text>
        <Text>{ athlete.lastname }</Text>
      </View>
    );
  }
}

const getCurrentAthlete = athletes => Object.values(athletes)[0];

const mapStateToProps = state => ({
  athlete: getCurrentAthlete(state.entities.athletes),
});

export default connect(mapStateToProps)(Home);<commit_msg>update home view. add selector and update render function.<commit_after>// react
import React, { Component, PropTypes } from 'react';

// react-native
import { View, Text } from 'react-native';

// redux
import { connect } from 'react-redux';

import styles from './styles';

// styles
class Home extends Component {
  // TODO: fix proptypes validation issue with selectors.
  static propTypes = {
    athlete: PropTypes.shape({
      firstname: PropTypes.string,
      lastname: PropTypes.lastname,
    }).isRequired,
  };

  render() {
    const { athlete } = this.props;

    // TODO: temporary - find  more elegant way to di this!
    if (athlete !== undefined && Object.keys(athlete).length > 0) {
      return (
        <View style={styles.home}>
          <Text>{ athlete.firstname }</Text>
          <Text>{ athlete.lastname }</Text>
        </View>
      );
    }
    return null;
  }
}

// TODO: return array first item. Add parameter to return given athelte.
const getCurrentAthlete = athletes => Object.values(athletes)[0];

const mapStateToProps = state => ({
  athlete: getCurrentAthlete(state.entities.athletes),
});

export default connect(mapStateToProps)(Home);
{'fraction_non_alphanumeric': 0.13627353815659068, 'fraction_numerical': 0.0014866204162537165, 'mean_word_length': 3.154320987654321, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 20, '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': '3604397', 'n_tokens_mistral': 610, 'n_tokens_neox': 602, 'n_words': 167}