<commit_before>import React, { PropTypes, Component } from 'react';
import LeftPanel from './components/LeftPanel';
import HomePage from './pages/HomePage';
import TranslationProvider from './i18n/TranslationProvider';
import GuestBanner from './components/GuestBanner';
import connectToStores from './utils/connectToStores';
import LoginStore from './stores/LoginStore';
import RouterActionCreators from './actions/RouterActionCreators';

function getState(props) {
    const isLoggedIn = LoginStore.isLoggedIn();
    const isGuest = LoginStore.isGuest();
    return {isLoggedIn, isGuest};
}

@connectToStores([LoginStore], getState)
export default class App extends Component {

    static contextTypes = {
        router: PropTypes.object.isRequired
    };

    static propTypes = {
        children  : PropTypes.object,
        // Injected by @connectToStores:
        isLoggedIn: PropTypes.bool.isRequired,
        isGuest   : PropTypes.bool.isRequired
    };

    componentWillReceiveProps(nextProps) {
        const routeChanged = nextProps.location.pathname !== this.props.location.pathname;
        if (routeChanged) {
            setTimeout(() => RouterActionCreators.nextRoute(nextProps.location.pathname), 0);
        }
    }

    render() {
        const {children, isLoggedIn, isGuest} = this.props;
        return (
            <TranslationProvider>
                <div className="App">
                    { isLoggedIn ? <LeftPanel/> : '' }
                    { children ? children : <HomePage {...this.props}/> }
                    { isGuest ? <GuestBanner/> : ''}
                </div>
            </TranslationProvider>
        );
    }
}<commit_msg>QS-1395: Close panel when pressing back button<commit_after>import React, { PropTypes, Component } from 'react';
import LeftPanel from './components/LeftPanel';
import HomePage from './pages/HomePage';
import TranslationProvider from './i18n/TranslationProvider';
import GuestBanner from './components/GuestBanner';
import connectToStores from './utils/connectToStores';
import LoginStore from './stores/LoginStore';
import RouterActionCreators from './actions/RouterActionCreators';

function getState(props) {
    const isLoggedIn = LoginStore.isLoggedIn();
    const isGuest = LoginStore.isGuest();
    return {isLoggedIn, isGuest};
}

@connectToStores([LoginStore], getState)
export default class App extends Component {

    static contextTypes = {
        router: PropTypes.object.isRequired
    };

    static propTypes = {
        children  : PropTypes.object,
        // Injected by @connectToStores:
        isLoggedIn: PropTypes.bool.isRequired,
        isGuest   : PropTypes.bool.isRequired
    };

    componentWillReceiveProps(nextProps) {
        const routeChanged = nextProps.location.pathname !== this.props.location.pathname;
        if (routeChanged) {
            nekunoApp.closePanel();
            setTimeout(() => RouterActionCreators.nextRoute(nextProps.location.pathname), 0);
        }
    }

    render() {
        const {children, isLoggedIn, isGuest} = this.props;
        return (
            <TranslationProvider>
                <div className="App">
                    { isLoggedIn ? <LeftPanel/> : '' }
                    { children ? children : <HomePage {...this.props}/> }
                    { isGuest ? <GuestBanner/> : ''}
                </div>
            </TranslationProvider>
        );
    }
}
{'fraction_non_alphanumeric': 0.11420204978038068, 'fraction_numerical': 0.0029282576866764276, 'mean_word_length': 2.6417910447761193, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '7097906', 'n_tokens_mistral': 960, 'n_tokens_neox': 912, 'n_words': 203}