<commit_before>import React from "react";
import { connect } from "react-redux";
import queryString from "query-string";
import { changePageQuery } from "../../actions/navigation";
import { Timeline } from "./extras";

@connect()
export class Focus extends React.Component { // eslint-disable-line
  constructor(props) {
    super(props);
    this.state = {
      timeoutRef: null,
      __html: props.blockHTML,
      style: {opacity: 1},
    };
  }
  static defaultProps = {
    delay: 300
  }
  componentWillReceiveProps(nextProps) {
    if (this.props.url === nextProps.url) {
      return;
    }
    if (this.state.timeoutRef) {
      clearTimeout(this.state.timeoutRef);
    }
    if (!nextProps.url) {
      return;
    }
    const ref = setTimeout(
      () => {
        this.setState({timeoutRef: null, __html: this.props.blockHTML, style: {opacity: 1}});
        this.props.dispatch(changePageQuery({query: queryString.parse(nextProps.url.split('?')[1]), push: true}));
      },
      this.props.delay
    );
    this.setState({timeoutRef: ref, style: {opacity: 0}});
  }

  render() {
    const margin = 20;
    return (
      <div style={{
        minWidth: `${this.props.width - 2 * margin}px`,
        minHeight: `${this.props.height - 2 * margin}px`,
        maxHeight: `${this.props.height - 2 * margin}px`,
        padding: "0px",
        margin: `${margin}px`,
        borderTop: "thin solid #AAA",
        borderBottom: "thin solid #AAA"
      }}
      >
        <div style={{fontSize: 26}}>
          {this.props.title}
        </div>
        <br/><commit_msg>narrative block scrolls instead of overflowing<commit_after>import React from "react";
import { connect } from "react-redux";
import queryString from "query-string";
import { changePageQuery } from "../../actions/navigation";
import { Timeline } from "./extras";
import ReactDOM from "react-dom";

@connect()
export class Focus extends React.Component { // eslint-disable-line
  constructor(props) {
    super(props);
    this.state = {
      timeoutRef: null,
      __html: props.blockHTML,
      style: {opacity: 1},
    };
  }
  static defaultProps = {
    delay: 300
  }
  componentWillReceiveProps(nextProps) {
    if (this.props.url === nextProps.url) {
      return;
    }
    if (this.state.timeoutRef) {
      clearTimeout(this.state.timeoutRef);
    }
    if (!nextProps.url) {
      return;
    }
    const ref = setTimeout(
      () => {
        this.setState({timeoutRef: null, __html: this.props.blockHTML, style: {opacity: 1}});
        this.props.dispatch(changePageQuery({query: queryString.parse(nextProps.url.split('?')[1]), push: true}));
        ReactDOM.findDOMNode(this).scrollTop = 0;
      },
      this.props.delay
    );
    this.setState({timeoutRef: ref, style: {opacity: 0}});
  }

  render() {
    const margin = 20;
    return (
      <div style={{
        minWidth: `${this.props.width - 2 * margin}px`,
        minHeight: `${this.props.height - 2 * margin}px`,
        maxHeight: `${this.props.height - 2 * margin}px`,
        padding: "0px",
        margin: `${margin}px`,
        borderTop: "thin solid #AAA",
        borderBottom: "thin solid #AAA",
        overflow: "auto"
      }}
      >
        <div style={{fontSize: 26}}>
          {this.props.title}
        </div>
        <br/>
{'fraction_non_alphanumeric': 0.1568271268543748, 'fraction_numerical': 0.009385407205570693, 'mean_word_length': 2.507430997876858, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2994594', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1043, 'n_words': 230}