<commit_before>import React from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import { markRead, markBeingRead }  from '../../actions/firebase_actions';

function mapDispatchToProps(dispatch) {
  return bindActionCreators({
    markRead,
    markBeingRead
  }, dispatch);
}

function mapStateToProps(state) {
  return { currentUser: state.currentUser };
}

class Book extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      show: false
    }
  }

  markRead(id) {
    this.props.markRead(id);
  }

  getBookActions(status, beingRead) {
    return (
      <div>
        {!status && <button type="submit" className="btn btn-default btn-block" onClick={() => this.markRead(this.props.id)}>Mark as read</button>}
        {!beingRead && !status && <button type="submit" className="btn btn-default btn-block" onClick={() => this.props.markBeingRead(this.props.id)}>Reading</button>}
      </div>
    )
  }

  render() {
    const { title, authorFirst, authorLast, length, imageURL, status, beingRead } = this.props;
    return (
      <div className='book' onMouseEnter={() => this.setState({ show: true })}
                                onMouseLeave={() => this.setState({ show: false })}>
        <img className={`bookCover ${this.state.show ? 'hover' : ''}`} src={imageURL} />
        <div className={`bookInfo ${this.state.show ? '' : 'behind'}`}>
          {title} by {authorFirst} {authorLast}
          { this.props.currentUser && this.props.currentUser.uid == 'zjZzerHEdqSXFwyi0QOH16hdoNu2' && this.getBookActions(status, beingRead)}
        </div>
      </div>
		)
	}

}

export default connect(mapStateToProps, mapDispatchToProps)(Book);<commit_msg>Pages included in book hover<commit_after>import React from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import { markRead, markBeingRead }  from '../../actions/firebase_actions';

function mapDispatchToProps(dispatch) {
  return bindActionCreators({
    markRead,
    markBeingRead
  }, dispatch);
}

function mapStateToProps(state) {
  return { currentUser: state.currentUser };
}

class Book extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      show: false
    }
  }

  markRead(id) {
    this.props.markRead(id);
  }

  getBookActions(status, beingRead) {
    return (
      <div>
        {!status && <button type="submit" className="btn btn-default btn-block" onClick={() => this.markRead(this.props.id)}>Mark as read</button>}
        {!beingRead && !status && <button type="submit" className="btn btn-default btn-block" onClick={() => this.props.markBeingRead(this.props.id)}>Reading</button>}
      </div>
    )
  }

  render() {
    const { title, authorFirst, authorLast, length, imageURL, status, beingRead } = this.props;
    return (
      <div className='book' onMouseEnter={() => this.setState({ show: true })}
                                onMouseLeave={() => this.setState({ show: false })}>
        <img className={`bookCover ${this.state.show ? 'hover' : ''}`} src={imageURL} />
        <div className={`bookInfo ${this.state.show ? '' : 'behind'}`}>
          {title} by {authorFirst} {authorLast}
          { this.props.currentUser && this.props.currentUser.uid == 'zjZzerHEdqSXFwyi0QOH16hdoNu2' && this.getBookActions(status, beingRead)}
          ({ length } pages)
        </div>
      </div>
		)
	}

}

export default connect(mapStateToProps, mapDispatchToProps)(Book);
{'fraction_non_alphanumeric': 0.15774487471526197, 'fraction_numerical': 0.002277904328018223, 'mean_word_length': 3.353159851301115, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 33, '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': '7537296', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1103, 'n_words': 223}