<commit_before>import React, { Component } from 'react';
import { createCategory } from '../actions';
import { connect } from 'react-redux';

class Header extends Component {
    componentWillMount() {
      const serverPath = 'http://localhost:5001';
      const authorizationHeader = { 'Authorization': 'myKey' };

      fetch(`${serverPath}/categories`, { headers: authorizationHeader })
      .then(res => res.json())
      .then(res => res.categories.forEach(category => this.props.createCategory(category), this));
    }

    render() {
      return (
        <div className="header">
          <h1 className="header__headline">Readable</h1>
          <nav className="header__navigation">
            {
              this.props.categories.map(category => 
                <a href={category.path} key={category.name}>{category.name}</a>
              )
            }
          </nav>
        </div>
      )
    }
}

function mapStateToProps(state) {
  return state;
}

function mapDispatchToProps(dispatch) {
  return {
    createCategory: category => dispatch(createCategory(category))
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(Header);<commit_msg>add button to see posts from all categories<commit_after>import React, { Component } from 'react';
import { createCategory } from '../actions';
import { connect } from 'react-redux';

class Header extends Component {
    componentWillMount() {
      const serverPath = 'http://localhost:5001';
      const authorizationHeader = { 'Authorization': 'myKey' };

      fetch(`${serverPath}/categories`, { headers: authorizationHeader })
      .then(res => res.json())
      .then(res => res.categories.forEach(category => this.props.createCategory(category), this));
    }

    render() {
      return (
        <div className="header">
          <h1 className="header__headline">Readable</h1>
          <nav className="header__navigation">
            <a href="/">all</a>
            {
              this.props.categories.map(category => 
                <a href={category.path} key={category.name}>{category.name}</a>
              )
            }
          </nav>
        </div>
      )
    }
}

function mapStateToProps(state) {
  return state;
}

function mapDispatchToProps(dispatch) {
  return {
    createCategory: category => dispatch(createCategory(category))
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(Header);
{'fraction_non_alphanumeric': 0.13760330578512397, 'fraction_numerical': 0.0049586776859504135, 'mean_word_length': 2.7828125, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 31, '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': '226529', 'n_tokens_mistral': 667, 'n_tokens_neox': 652, 'n_words': 132}