<commit_before>import React, { Component } from 'react';
import Relay from 'react-relay';
import { Navbar, Nav, NavItem, NavDropdown, MenuItem, Glyphicon } from 'react-bootstrap';

import { clearLoginObj } from '../../reusable/auth';

class Navigator extends Component {
	constructor(props) {
		super(props);
		this.state = {
			showOverlay: true,
			widthSize: window.outerWidth,
			isClosed: false,
			toggled: null,
		};

		this.doLogout = this.doLogout.bind(this);
		this.hamburgerCross = this.hamburgerCross.bind(this);
	}

	hamburgerCross() {
		if (this.state.isClosed) {
			document.getElementById('hamburger-element').classList.remove('is-open');
			document.getElementById('hamburger-element').classList.add('is-closed');
			this.setState({ isClosed: false, showOverlay: false, toggled: null });
		} else {
			document.getElementById('hamburger-element').classList.remove('is-closed');
			document.getElementById('hamburger-element').classList.add('is-open');
			this.setState({ isClosed: true, showOverlay: true, toggled: 'toggled' });
		}
	}

	doLogout() {
		clearLoginObj();
	}

	render() {
		console.log('NAV state', this.state);
		return (
			<div>
				{ (this.state.widthSize >= 768) ?
					(
						<Navbar>
							<Navbar.Header>
								<Navbar.Brand>
									<a href="/">Memoirs</a>
								</Navbar.Brand>
							</Navbar.Header>
						<Nav className="floating-right-nav-item">
							<NavItem eventKey={1} href="#">Memoirs</NavItem>
							<NavDropdown eventKey={3} title={this.props.userInfo.name} id="basic-nav-dropdown">
								<MenuItem eventKey={3.3}>Create Memoir</MenuItem>
								<MenuItem divider />
								<MenuItem href="#/login" onClick={this.doLogout}>Logout</MenuItem>
							</NavDropdown>
						</Nav>
						</Navbar>
					) : (
						<div id="wrapper" className={this.state.toggled}>
							{this.state.showOverlay ? <div className="overlay" style={{display: this.state.isClosed? 'block': 'none'}}></div> : null}
							<nav className="navbar navbar-inverse navbar-fixed-top" id="sidebar-wrapper" role="navigation">
								<ul className="nav sidebar-nav">
									<li className="sidebar-brand">
										<a href="#">Memoirs</a>
									</li>
									<li>
										<a href="#"><i className="fa fa-fw fa-home"></i> Home</a>
									</li>
									<li>
										<a href="#/login"><i className="fa fa-fw fa-sign-out"></i> Logout</a>
									</li>
								</ul>
							</nav>
							<div id="page-content-wrapper">
								<button id="hamburger-element" type="button" className="hamburger is-closed animated fadeInLeft" onClick={this.hamburgerCross}>
									<span className="hamb-top"></span>
									<span className="hamb-middle"></span>
									<span className="hamb-bottom"></span>
								</button>
							</div>
						</div><commit_msg>Use react router Link rather than anchor tag<commit_after>import React, { Component } from 'react';
import Relay from 'react-relay';
import { Navbar, Nav, NavItem, NavDropdown, MenuItem, Glyphicon } from 'react-bootstrap';
import { Link, hashHistory } from 'react-router';

import { clearLoginObj } from '../../reusable/auth';

class Navigator extends Component {
	constructor(props) {
		super(props);
		this.state = {
			showOverlay: true,
			widthSize: window.outerWidth,
			isClosed: false,
			toggled: null,
		};

		this.goToMemoir = this.goToMemoir.bind(this);
		this.doLogout = this.doLogout.bind(this);
		this.hamburgerCross = this.hamburgerCross.bind(this);
	}

	hamburgerCross() {
		if (this.state.isClosed) {
			document.getElementById('hamburger-element').classList.remove('is-open');
			document.getElementById('hamburger-element').classList.add('is-closed');
			this.setState({ isClosed: false, showOverlay: false, toggled: null });
		} else {
			document.getElementById('hamburger-element').classList.remove('is-closed');
			document.getElementById('hamburger-element').classList.add('is-open');
			this.setState({ isClosed: true, showOverlay: true, toggled: 'toggled' });
		}
	}

	goToMemoir() {
		hashHistory.push('/memoir');
		this.setState({ isClosed: true, showOverlay: true, toggled: 'toggled' });
	}

	doLogout() {
		clearLoginObj();
	}

	render() {
		return (
			<div>
				{ (this.state.widthSize >= 768) ?
					(
						<Navbar>
							<Navbar.Header>
								<Navbar.Brand>
									<a href="/">Memoirs</a>
								</Navbar.Brand>
							</Navbar.Header>
						<Nav className="floating-right-nav-item">
							<NavItem eventKey={1} href="#">Memoirs</NavItem>
							<NavDropdown eventKey={3} title={this.props.userInfo.name} id="basic-nav-dropdown">
								<MenuItem href="#/memoir" onClick={this.goToMemoir}>Create Memoir</MenuItem>
								<MenuItem divider />
								<MenuItem href="#/login" onClick={this.doLogout}>Logout</MenuItem>
							</NavDropdown>
						</Nav>
						</Navbar>
					) : (
						<div id="wrapper" className={this.state.toggled}>
							{this.state.showOverlay ? <div className="overlay" style={{display: this.state.isClosed? 'block': 'none'}}></div> : null}
							<nav className="navbar navbar-inverse navbar-fixed-top" id="sidebar-wrapper" role="navigation">
								<ul className="nav sidebar-nav">
									<li className="sidebar-brand">
										<Link to={'/welcome'}>Memoirs</Link>
									</li>
									<li>
										<Link to={'/welcome'}><i className="fa fa-fw fa-home"></i> Home</Link>
									</li>
									<li>
										<Link to={'/memoir'}><i className="fa fa-fw fa-file"></i> Create Memoir</Link>
									</li>
									<li>
										<Link to={'/login'} onClick={this.doLogout}><i className="fa fa-fw fa-sign-out"></i> Logout</Link>
									</li>
								</ul>
							</nav>
							<div id="page-content-wrapper">
								<button id="hamburger-element" type="button" className="hamburger is-closed animated fadeInLeft" onClick={this.hamburgerCross}>
									<span className="hamb-top"></span>
									<span className="hamb-middle"></span>
									<span className="hamb-bottom"></span>
								</button>
							</div>
						</div>
{'fraction_non_alphanumeric': 0.17378252168112074, 'fraction_numerical': 0.0020013342228152103, 'mean_word_length': 3.0795918367346937, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 119, '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': '4123810', 'n_tokens_mistral': 2609, 'n_tokens_neox': 1947, 'n_words': 354}