<commit_before>import React from 'react';
import { connect } from 'react-redux';
import FlatButton from 'material-ui/lib/flat-button';
import Popover from 'material-ui/lib/popover/popover';
import PopoverAnimationFromTop from 'material-ui/lib/popover/popover-animation-from-top';
import AuthForm from './Auth/AuthForm';
import LogoBarBtn from './LogoBarBtn';
import appActions from '../actions/appActions';

class LoginOut extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      open: false,
    };
    this.handleLogout = this.handleLogout.bind(this);
    this.handleAuthOpen = this.handleAuthOpen.bind(this);
    this.handleRequestClose = this.handleRequestClose.bind(this);
    this.componentWillMount = this.componentWillMount.bind(this);
  }
  componentWillMount() {
  }
  handleAuthOpen(event) {
    this.setState({
      open: true,
      anchorEl: event.currentTarget,
    });
  }
  handleLogout() {
    localStorage.removeItem('pd.token');
    localStorage.removeItem('pd.loggedIn');
    console.log(this.props.history);
    this.props.dispatch(appActions.setLoggedIn(false));
    this.props.history.push({ pathname: '/splash' });
  }
  handleRequestClose() {
    this.setState({
      open: false,
    });
  }
  checkLogin() {
    if (this.props.loggedIn) {
      return (<span><LogoBarBtn label="profile" link="/profile"/><FlatButton onTouchTap={ this.handleLogout } label="Logout" secondary={true} /></span>);
    } else {
      return <FlatButton onTouchTap={ this.handleAuthOpen } label="Login" secondary={true} />;
    }
  }
  render() {
    return (
      <div className="box end-xs">
        { this.checkLogin() }
        <Popover
          open={this.state.open}
          anchorEl={this.state.anchorEl}
          anchorOrigin={{"horizontal":"right","vertical":"bottom"}}
          targetOrigin={{"horizontal":"right","vertical":"top"}}
          onRequestClose={this.handleRequestClose}
          animation={PopoverAnimationFromTop}
        >
          <div style={{"padding":20}}>
            <AuthForm dispatch={ this.props.dispatch }submissionType={'login'} history={this.props.history} onSubmit={this.handleRequestClose} />
          </div>
        </Popover><commit_msg>Added the about button to logoBar.<commit_after>import React from 'react';
import { connect } from 'react-redux';
import FlatButton from 'material-ui/lib/flat-button';
import Popover from 'material-ui/lib/popover/popover';
import PopoverAnimationFromTop from 'material-ui/lib/popover/popover-animation-from-top';
import AuthForm from './Auth/AuthForm';
import LogoBarBtn from './LogoBarBtn';
import appActions from '../actions/appActions';

class LoginOut extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      open: false,
    };
    this.handleLogout = this.handleLogout.bind(this);
    this.handleAuthOpen = this.handleAuthOpen.bind(this);
    this.handleRequestClose = this.handleRequestClose.bind(this);
    this.componentWillMount = this.componentWillMount.bind(this);
  }
  componentWillMount() {
  }
  handleAuthOpen(event) {
    this.setState({
      open: true,
      anchorEl: event.currentTarget,
    });
  }
  handleLogout() {
    localStorage.removeItem('pd.token');
    localStorage.removeItem('pd.loggedIn');
    console.log(this.props.history);
    this.props.dispatch(appActions.setLoggedIn(false));
    this.props.history.push({ pathname: '/splash' });
  }
  handleRequestClose() {
    this.setState({
      open: false,
    });
  }
  checkLogin() {
    if (this.props.loggedIn) {
      return (
        <span>
          <LogoBarBtn label="profile" link="/profile"/>
          <LogoBarBtn label="about" link="/about"/>
          <FlatButton onTouchTap={ this.handleLogout } label="Logout" secondary={true} />
        </span>);
    } else {
      return (
        <span>
          <LogoBarBtn label="about" link="/about"/>
          <FlatButton onTouchTap={ this.handleAuthOpen } label="Login" secondary={true} />
        </span>
      );
    }
  }
  render() {
    return (
      <div className="box end-xs">
        { this.checkLogin() }
        <Popover
          open={this.state.open}
          anchorEl={this.state.anchorEl}
          anchorOrigin={{"horizontal":"right","vertical":"bottom"}}
          targetOrigin={{"horizontal":"right","vertical":"top"}}
          onRequestClose={this.handleRequestClose}
          animation={PopoverAnimationFromTop}
        >
          <div style={{"padding":20}}>
            <AuthForm dispatch={ this.props.dispatch }submissionType={'login'} history={this.props.history} onSubmit={this.handleRequestClose} />
          </div>
        </Popover>
{'fraction_non_alphanumeric': 0.14884516680923868, 'fraction_numerical': 0.000855431993156544, 'mean_word_length': 3.1983842010771992, 'pattern_counts': {'":': 10, '<': 29, '<?xml version=': 0, '>': 29, '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': '5738828', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1407, 'n_words': 234}