<commit_before>import React, { Component } from 'react';
import { Link } from 'react-router';
import './App.css';

const LINKS = [
  {path: "/", name: "Songsim"},
  {path: "/about", name: "About"},
  {path: "/gallery", name: "Gallery"}
];

class App extends Component {
  renderNavLink = (link) => {
    return (<li className={this.props.location.pathname === link.path ? "active" : ""}
            key={link.name}
          >
            <Link to={link.path}>{link.name}</Link></li>);
  }
  render() {
    var links = LINKS.map(this.renderNavLink);
    return (
      <div className="App">
        <nav className="navbar navbar-default">
          <div className="container-fluid">
            <ul className="nav navbar-nav">
              {links}
            </ul>
          </div>
        </nav>

        {this.props.children}
      </div>
    );
  }
}

export default App;
<commit_msg>navbar bugfix<commit_after>import React, { Component } from 'react';
import { Link } from 'react-router';
import './App.css';

const LINKS = [
  {path: "/", name: "Songsim"},
  {path: "/about", name: "About"},
  {path: "/gallery", name: "Gallery"}
];

class App extends Component {
  renderNavLink = (link) => {
    // I'm sure there's a better way to do this...
    let active = link.path === "/" ? 
        !LINKS.some((l) => 
            ( l.path !== "/" && this.props.location.pathname.startsWith(l.path))
        )
        : 
        this.props.location.pathname.startsWith(link.path)
    ;
    return (<li className={active ? "active" : ""}
            key={link.name}
          >
            <Link to={link.path}>{link.name}</Link></li>);
  }
  render() {
    var links = LINKS.map(this.renderNavLink);
    console.log(this.props.location);
    return (
      <div className="App">
        <nav className="navbar navbar-default">
          <div className="container-fluid">
            <ul className="nav navbar-nav">
              {links}
            </ul>
          </div>
        </nav>

        {this.props.children}
      </div>
    );
  }
}

export default App;

{'fraction_non_alphanumeric': 0.18023255813953487, 'fraction_numerical': 0.0, 'mean_word_length': 2.119335347432024, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 30, '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': '2787082', 'n_tokens_mistral': 675, 'n_tokens_neox': 654, 'n_words': 141}