<commit_before>import React from 'react';
import counterpart from 'counterpart';
import classnames from 'classnames';
import {routerShape} from 'react-router/lib/PropTypes';
import PassContext from '../components/pass-context';
import { Link, IndexLink } from 'react-router';
import Translate from 'react-translate-component';
import AdminOnly from '../components/admin-only';
import TriggeredModalForm from 'modal-form/triggered';
import ZooniverseLogo from '../partials/zooniverse-logo';
import AccountBar from './account-bar';
import LoginBar from './login-bar';

import style from './site-nav.styl';
void style;

const MAX_MOBILE_WIDTH = 875;

counterpart.registerTranslations('en', {
  siteNav: {
    home: 'Zooniverse',
    projects: 'Projects',
    about: 'About',
    collect: 'Collect',
    talk: 'Talk',
    daily: 'Daily Zooniverse',
    blog: 'Blog',
    lab: 'Build a project',
    admin: 'Admin',
    notifications: 'Notifications',
  },
});

const SiteNav = React.createClass({
  resizeTimeout: NaN,

  contextTypes: {
    initialLoadComplete: React.PropTypes.bool,
    user: React.PropTypes.object,
    router: routerShape,
    geordi: React.PropTypes.object,
  },

  propTypes: {
    onToggle: React.PropTypes.func,
  },

  getInitialState() {
    return {
      isMobile: true
    };
  },

  componentDidMount() {
    this.handleResize();
    addEventListener('resize', this.handleResize);
  },

  componentWillUnmount() {
    addEventListener('resize', this.handleResize);
  },

  handleResize() {
    if (!isNaN(this.resizeTimeout)) {
      clearTimeout(this.resizeTimeout);
    }
    this.resizeTimeout = setTimeout(() => {
      this.setState({
        isMobile: innerWidth < MAX_MOBILE_WIDTH,
      }, () => {
        this.resizeTimeout = NaN;
      });
    }, 100);
  },

  componentWillReceiveProps(nextProps, nextContext) {
    this.logClick = !!nextContext &&
      !!nextContext.geordi &&<commit_msg>removeEventListener on unmount<commit_after>import React from 'react';
import counterpart from 'counterpart';
import classnames from 'classnames';
import {routerShape} from 'react-router/lib/PropTypes';
import PassContext from '../components/pass-context';
import { Link, IndexLink } from 'react-router';
import Translate from 'react-translate-component';
import AdminOnly from '../components/admin-only';
import TriggeredModalForm from 'modal-form/triggered';
import ZooniverseLogo from '../partials/zooniverse-logo';
import AccountBar from './account-bar';
import LoginBar from './login-bar';

import style from './site-nav.styl';
void style;

const MAX_MOBILE_WIDTH = 875;

counterpart.registerTranslations('en', {
  siteNav: {
    home: 'Zooniverse',
    projects: 'Projects',
    about: 'About',
    collect: 'Collect',
    talk: 'Talk',
    daily: 'Daily Zooniverse',
    blog: 'Blog',
    lab: 'Build a project',
    admin: 'Admin',
    notifications: 'Notifications',
  },
});

const SiteNav = React.createClass({
  resizeTimeout: NaN,

  contextTypes: {
    initialLoadComplete: React.PropTypes.bool,
    user: React.PropTypes.object,
    router: routerShape,
    geordi: React.PropTypes.object,
  },

  propTypes: {
    onToggle: React.PropTypes.func,
  },

  getInitialState() {
    return {
      isMobile: true
    };
  },

  componentDidMount() {
    this.handleResize();
    addEventListener('resize', this.handleResize);
  },

  componentWillUnmount() {
    removeEventListener('resize', this.handleResize);
  },

  handleResize() {
    if (!isNaN(this.resizeTimeout)) {
      clearTimeout(this.resizeTimeout);
    }
    this.resizeTimeout = setTimeout(() => {
      this.setState({
        isMobile: innerWidth < MAX_MOBILE_WIDTH,
      }, () => {
        this.resizeTimeout = NaN;
      });
    }, 100);
  },

  componentWillReceiveProps(nextProps, nextContext) {
    this.logClick = !!nextContext &&
      !!nextContext.geordi &&
{'fraction_non_alphanumeric': 0.13828689370485037, 'fraction_numerical': 0.0030959752321981426, 'mean_word_length': 3.654261704681873, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1423599', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1173, 'n_words': 260}