<commit_before>import React, {PropTypes} from 'react'
import {Link, browserHistory} from 'react-router'
import Drawer from 'material-ui/Drawer'
import MenuItem from 'material-ui/MenuItem'
import SearchQuery from './containers/SearchQuery'
import Footer from './components/Footer'
import LoginAvatar from './LoginAvatar'
import { connect } from 'react-redux'

/* eslint-disable no-unused-vars */
import globalStyles from './global.css'
/* eslint-enable no-unused-vars */
import './Layout.css'
import {injectIntl} from 'react-intl'
import menuIcon from './img/menu-icon.png'
import ppLogo from './img/pp-logo.png'

import HelpBar from './components/HelpBar'

class Layout extends React.Component {
  static propTypes = {
    isAuthenticated: PropTypes.bool.isRequired,
    profile: PropTypes.object.isRequired
  }
  constructor (props) {
    super(props)
    this.state = {open: false}
    this.setState = this.setState.bind(this)
    this.handleToggle = this.handleToggle.bind(this)
    this.handleClose = this.handleClose.bind(this)
    this.touchTitle = this.touchTitle.bind(this)
  }

  handleToggle () {
    this.setState({open: !this.state.open})
  }

  handleClose () {
    this.setState({open: false})
  }

  touchTitle () {
    browserHistory.push('/')
  }

  render () {
    const { auth, profile, isAuthenticated } = this.props

    let children = null
    if (this.props.children && this.props.route) {
      children = React.cloneElement(this.props.children, {
        auth: this.props.route.auth // sends auth instance from route to children
      })
    }
    let locale = this.props.intl.locale
    let home = `/${locale}/`

    return (
      <div>
        <div className='nav-bar-component'>
          <div className='nav-bar-wrapper'>
            <div className='logo-area'>
              <a href='#' onClick={this.handleToggle} className='menu-icon'><img src={menuIcon} alt='' /></a>
              <a href={home} className='logo'><img src={ppLogo} alt='' /></a>
            </div>
            <div className='search-box-area'>
              <SearchQuery />
            </div>
            <LoginAvatar auth={auth} isAuthenticated={isAuthenticated} profile={profile} className='login-area' />
          </div>
        </div>
        <Drawer
          className='drawer'
          docked={false}
          width={300}
          open={this.state.open}
          onRequestChange={(open) => this.setState({open})}>
          <MenuItem containerElement={<Link to={'/'+locale} />}
            onTouchTap={this.handleClose}>Home</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/about'} />}
            onTouchTap={this.handleClose}>About</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/teaching'} />}
            onTouchTap={this.handleClose}>Teaching</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/research'} />}
            onTouchTap={this.handleClose}>Research</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/profile'} />}<commit_msg>Make clicking on the navbar logo do a smooth repaint, not a full reload<commit_after>import React, {PropTypes} from 'react'
import {Link, browserHistory} from 'react-router'
import Drawer from 'material-ui/Drawer'
import MenuItem from 'material-ui/MenuItem'
import SearchQuery from './containers/SearchQuery'
import Footer from './components/Footer'
import LoginAvatar from './LoginAvatar'
import { connect } from 'react-redux'

/* eslint-disable no-unused-vars */
import globalStyles from './global.css'
/* eslint-enable no-unused-vars */
import './Layout.css'
import {injectIntl} from 'react-intl'
import menuIcon from './img/menu-icon.png'
import ppLogo from './img/pp-logo.png'

import HelpBar from './components/HelpBar'

class Layout extends React.Component {
  static propTypes = {
    isAuthenticated: PropTypes.bool.isRequired,
    profile: PropTypes.object.isRequired
  }
  constructor (props) {
    super(props)
    this.state = {open: false}
    this.setState = this.setState.bind(this)
    this.handleToggle = this.handleToggle.bind(this)
    this.handleClose = this.handleClose.bind(this)
    this.touchTitle = this.touchTitle.bind(this)
  }

  handleToggle () {
    this.setState({open: !this.state.open})
  }

  handleClose () {
    this.setState({open: false})
  }

  touchTitle () {
    browserHistory.push('/')
  }

  render () {
    const { auth, profile, isAuthenticated } = this.props

    let children = null
    if (this.props.children && this.props.route) {
      children = React.cloneElement(this.props.children, {
        auth: this.props.route.auth // sends auth instance from route to children
      })
    }
    let locale = this.props.intl.locale
    let home = `/${locale}/`

    return (
      <div>
        <div className='nav-bar-component'>
          <div className='nav-bar-wrapper'>
            <div className='logo-area'>
              <a href='#' onClick={this.handleToggle} className='menu-icon'><img src={menuIcon} alt='' /></a>
              <Link to={'/'+locale} className='logo'><img src={ppLogo} alt='Go Home' /></Link>
            </div>
            <div className='search-box-area'>
              <SearchQuery />
            </div>
            <LoginAvatar auth={auth} isAuthenticated={isAuthenticated} profile={profile} className='login-area' />
          </div>
        </div>
        <Drawer
          className='drawer'
          docked={false}
          width={300}
          open={this.state.open}
          onRequestChange={(open) => this.setState({open})}>
          <MenuItem containerElement={<Link to={'/'+locale} />}
            onTouchTap={this.handleClose}>Home</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/about'} />}
            onTouchTap={this.handleClose}>About</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/teaching'} />}
            onTouchTap={this.handleClose}>Teaching</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/research'} />}
            onTouchTap={this.handleClose}>Research</MenuItem>
          <MenuItem containerElement={<Link to={'/'+locale+'/profile'} />}
{'fraction_non_alphanumeric': 0.15305956825190717, 'fraction_numerical': 0.0009738678785911378, 'mean_word_length': 2.895069532237674, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 67, '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': '3570246', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1817, 'n_words': 374}