<commit_before>import React, { PropTypes } from 'react';
import { browserHistory } from 'react-router';

import { Tabs, Tab } from 'material-ui/Tabs';

import ActionBook from 'material-ui/svg-icons/action/book';
import SocialPeople from 'material-ui/svg-icons/social/people';
import AvLibraryBooks from 'material-ui/svg-icons/av/library-books';

const NavigationBar = () => {

    const menuItems = [
        {
            path: "/authors",
            icon: <SocialPeople />,
            title: "AUTHORS"
        },
        {
            path: "/books",
            icon: <AvLibraryBooks />,
            title: "BOOKS"
        },
        {
            path: "/library",
            icon: <ActionBook />,
            title: "LIBRARY"
        }
    ];

    const handleActive = (tab) => {
        browserHistory.push(tab.props['value']);
    };

    const getSelectionIndex = () => {
        return menuItems.findIndex(item => item.path === window.location.pathname);
    };

    return (
        <Tabs initialSelectedIndex={getSelectionIndex()} value={window.location.pathname}>
            {menuItems.map((item) => {
                return (<Tab key={item.path}
                            icon={item.icon}
                            value={item.path}
                            onActive={handleActive}
                            label={item.title}
                        />);
            })}
        </Tabs>
    );
};

NavigationBar.propTypes = {
};

export default NavigationBar;<commit_msg>Preserve navigation<commit_after>import React, { PropTypes } from 'react';
import { browserHistory } from 'react-router';

import { Tabs, Tab } from 'material-ui/Tabs';

import ActionBook from 'material-ui/svg-icons/action/book';
import SocialPeople from 'material-ui/svg-icons/social/people';
import AvLibraryBooks from 'material-ui/svg-icons/av/library-books';

const NavigationBar = () => {

    const menuItems = [
        {
            path: "/authors",
            icon: <SocialPeople />,
            title: "AUTHORS"
        },
        {
            path: "/books",
            icon: <AvLibraryBooks />,
            title: "BOOKS"
        },
        {
            path: "/library",
            icon: <ActionBook />,
            title: "LIBRARY"
        }
    ];

    const handleActive = (tab) => {
        browserHistory.push(tab.props['value']);
    };

    const getSelectionIndex = () => {
        return menuItems.findIndex(item => item.path === window.location.pathname);
    };

    const getPath = () => {
        return  "/" + window.location.pathname.split("/")[1];
    };

    return (
        <Tabs initialSelectedIndex={getSelectionIndex()} value={getPath()}>
            {menuItems.map((item) => {
                return (<Tab key={item.path}
                            icon={item.icon}
                            value={item.path}
                            onActive={handleActive}
                            label={item.title}
                        />);
            })}
        </Tabs>
    );
};

NavigationBar.propTypes = {
};

export default NavigationBar;
{'fraction_non_alphanumeric': 0.13970826580226905, 'fraction_numerical': 0.00032414910858995135, 'mean_word_length': 1.660344827586207, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 26, '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': '4877441', 'n_tokens_mistral': 863, 'n_tokens_neox': 834, 'n_words': 154}