<commit_before>
import React, { Component } from 'react'
import { Link } from 'react-router'
import { connect } from 'react-redux'

class Nav extends Component {

  render() {
    return (
      <nav className="navbar navbar-default" role="navigation">
        <div className="container">
          <div className="navbar-header">
            <button type="button" className="navbar-toggle" data-toggle="collapse" data-target="#navbar-brand-centered">
              <span className="sr-only">Toggle navigation</span>
              <span className="icon-bar"></span>
              <span className="icon-bar"></span>
              <span className="icon-bar"></span>
            </button>

            <div className="navbar-brand navbar-brand-centered">Brand</div>
            </div>

            <div className="collapse navbar-collapse" id="navbar-brand-centered">

            { this.props.User ? <ul className="nav navbar-nav">
              <li><Link to={'home'}>Home</Link></li>
              <li><Link to={'wishlist'}>Wishlist</Link></li>
              <li><Link to={'currentlyReading'}>Currently Reading</Link></li>
              <li><Link to={'completed'}>Completed</Link></li>
            </ul> : null }

            { this.props.User ? <ul className="nav navbar-nav navbar-right">
              <li><Link to={'/'} className="navbar-right">Logout</Link></li>
            </ul> : null }
            

          </div>
        </div>
      </nav>
    )
  }
}

function mapStateToProps(state) {
  return { User: state.User }
}

export default connect(mapStateToProps, null)(Nav)<commit_msg>added functioning logout button to nav<commit_after>
import React, { Component } from 'react'
import { Link, browserHistory } from 'react-router'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { getUser, logout } from '../actions/index'

class Nav extends Component {

  componentWillMount() {
    this.props.getUser()
  }

  submitLogout() {
    this.props.logout()
      .then(() => {
          browserHistory.push('/')
        })
  }

  render() {
    return (
      <nav className="navbar navbar-default" role="navigation">
          <div className="navbar-header">
            <button type="button" className="navbar-toggle" data-toggle="collapse" data-target="#navbar-brand-centered">
              <span className="sr-only">Toggle navigation</span>
              <span className="icon-bar"></span>
              <span className="icon-bar"></span>
              <span className="icon-bar"></span>
            </button>

            <div className="navbar-brand navbar-brand-centered">Reading Buddy</div>
            </div>

            <div className="collapse navbar-collapse" id="navbar-brand-centered">

            { this.props.User ? <ul className="nav navbar-nav">
              <li><Link to={'home'}>Home</Link></li>
              <li><Link to={'wishlist'}>Wishlist</Link></li>
              <li><Link to={'currentlyReading'}>Currently Reading</Link></li>
              <li><Link to={'completed'}>Completed</Link></li>
            </ul> : null }

            { this.props.User ? <ul className="nav navbar-nav navbar-right">
              <li><a className="navbar-right logoutLink" onClick={this.submitLogout.bind(this)}>Logout</a></li>
            </ul> : null }
            

          </div>
      </nav>
    )
  }
}

function mapStateToProps(state) {
  return { User: state.User }
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators({ getUser, logout }, dispatch)
}

export default connect(mapStateToProps, mapDispatchToProps)(Nav)
{'fraction_non_alphanumeric': 0.15935591338145474, 'fraction_numerical': 0.0, 'mean_word_length': 2.457773512476008, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 90, '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': '2467502', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1015, 'n_words': 202}