<commit_before>import PropTypes from 'prop-types';
import React, { Component, Fragment } from 'react';
import { FormattedMessage } from 'react-intl';
import { NavLink } from 'react-router-dom';

export default class SectionHeadline extends Component {

  static propTypes = {
    timelineId: PropTypes.string.isRequired,
    to: PropTypes.string.isRequired,
    pinned: PropTypes.bool.isRequired,
    onlyMedia: PropTypes.bool.isRequired,
    onClick: PropTypes.func,
  };

  shouldComponentUpdate (nextProps) {
    return (
      this.props.onlyMedia !== nextProps.onlyMedia ||
      this.props.pinned !== nextProps.pinned ||
      this.props.to !== nextProps.to ||
      this.props.timelineId !== nextProps.timelineId
    );
  }

  handleClick = e => {
    const { onClick } = this.props;

    if (typeof onClick === 'function') {
      e.preventDefault();

      onClick.call(this, e);
    }
  }

  render () {
    const { timelineId, to, pinned, onlyMedia } = this.props;

    return (
      <div className={`${timelineId}-timeline__section-headline`}>
        {pinned ? (
          <Fragment>
            <a href={to} className={!onlyMedia ? 'active' : undefined} onClick={this.handleClick}>
              <FormattedMessage id='timeline.posts' defaultMessage='Toots' />
            </a>
            <a href={`${to}/media`} className={onlyMedia ? 'active' : undefined} onClick={this.handleClick}>
              <FormattedMessage id='timeline.media' defaultMessage='Media' />
            </a>
          </Fragment>
        ) : (
          <Fragment>
            <NavLink exact to={to} replace><FormattedMessage id='timeline.posts' defaultMessage='Toots' /></NavLink>
            <NavLink exact to={`${to}/media`} replace><FormattedMessage id='timeline.media' defaultMessage='Media' /></NavLink>
          </Fragment>
        )}<commit_msg>Do not replace history state<commit_after>import PropTypes from 'prop-types';
import React, { Component, Fragment } from 'react';
import { FormattedMessage } from 'react-intl';
import { NavLink } from 'react-router-dom';

export default class SectionHeadline extends Component {

  static propTypes = {
    timelineId: PropTypes.string.isRequired,
    to: PropTypes.string.isRequired,
    pinned: PropTypes.bool.isRequired,
    onlyMedia: PropTypes.bool.isRequired,
    onClick: PropTypes.func,
  };

  shouldComponentUpdate (nextProps) {
    return (
      this.props.onlyMedia !== nextProps.onlyMedia ||
      this.props.pinned !== nextProps.pinned ||
      this.props.to !== nextProps.to ||
      this.props.timelineId !== nextProps.timelineId
    );
  }

  handleClick = e => {
    const { onClick } = this.props;

    if (typeof onClick === 'function') {
      e.preventDefault();

      onClick.call(this, e);
    }
  }

  render () {
    const { timelineId, to, pinned, onlyMedia } = this.props;

    return (
      <div className={`${timelineId}-timeline__section-headline`}>
        {pinned ? (
          <Fragment>
            <a href={to} className={!onlyMedia ? 'active' : undefined} onClick={this.handleClick}>
              <FormattedMessage id='timeline.posts' defaultMessage='Toots' />
            </a>
            <a href={`${to}/media`} className={onlyMedia ? 'active' : undefined} onClick={this.handleClick}>
              <FormattedMessage id='timeline.media' defaultMessage='Media' />
            </a>
          </Fragment>
        ) : (
          <Fragment>
            <NavLink exact to={to}><FormattedMessage id='timeline.posts' defaultMessage='Toots' /></NavLink>
            <NavLink exact to={`${to}/media`}><FormattedMessage id='timeline.media' defaultMessage='Media' /></NavLink>
          </Fragment>
        )}
{'fraction_non_alphanumeric': 0.14390442573988596, 'fraction_numerical': 0.0, 'mean_word_length': 2.817616580310881, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 39, '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': '3407576', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1072, 'n_words': 218}