<commit_before>// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.


var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx');
var UserStore = require('../stores/user_store.jsx');

var Constants = require('../utils/constants.jsx');

function getStateFromStores() {
    return { teams: UserStore.getTeams() };
}

var NavbarDropdown = React.createClass({
    handleLogoutClick: function(e) {
        e.preventDefault();
        client.logout();
    },
    blockToggle: false,
    componentDidMount: function() {
        UserStore.addTeamsChangeListener(this._onChange);

        var self = this;
        $(this.refs.dropdown.getDOMNode()).on('hide.bs.dropdown', function(e) {
            self.blockToggle = true;
            setTimeout(function(){self.blockToggle = false;}, 100);
        });
    },
    componentWillUnmount: function() {
        UserStore.removeTeamsChangeListener(this._onChange);
    },
    _onChange: function() {
        if (this.isMounted()) {
            var newState = getStateFromStores();
            if (!utils.areStatesEqual(newState, this.state)) {
                this.setState(newState);
            }<commit_msg>added .off() for dropdown hide event on LHS header<commit_after>// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.


var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx');
var UserStore = require('../stores/user_store.jsx');

var Constants = require('../utils/constants.jsx');

function getStateFromStores() {
    return { teams: UserStore.getTeams() };
}

var NavbarDropdown = React.createClass({
    handleLogoutClick: function(e) {
        e.preventDefault();
        client.logout();
    },
    blockToggle: false,
    componentDidMount: function() {
        UserStore.addTeamsChangeListener(this._onChange);

        var self = this;
        $(this.refs.dropdown.getDOMNode()).on('hide.bs.dropdown', function(e) {
            self.blockToggle = true;
            setTimeout(function(){self.blockToggle = false;}, 100);
        });
    },
    componentWillUnmount: function() {
        UserStore.removeTeamsChangeListener(this._onChange);

        $(this.refs.dropdown.getDOMNode()).off('hide.bs.dropdown');
    },
    _onChange: function() {
        if (this.isMounted()) {
            var newState = getStateFromStores();
            if (!utils.areStatesEqual(newState, this.state)) {
                this.setState(newState);
            }
{'fraction_non_alphanumeric': 0.14526233359436178, 'fraction_numerical': 0.00548159749412686, 'mean_word_length': 2.8134328358208953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3616798', 'n_tokens_mistral': 766, 'n_tokens_neox': 743, 'n_words': 143}