<commit_before>import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import { connect } from 'react-redux'

import Hostname from 'components/Hostname'
import Summary from 'components/Summary'

import Waypoint from 'react-waypoint'
import ProgressiveImage from 'react-progressive-image'

import * as ArticleActions from 'actions/Articles'

@connect()
class Article extends Component {

    trackEngagement = e => this.props.dispatch(
        ArticleActions.engage(this.props.object.id, (this.props.index + 7))
    )

    trackImpression = () => this.props.dispatch(
        ArticleActions.impression(this.props.object.id)
    )

    handleImgLoad = (src, id) => {
        if (src == null || src.indexOf('track') != -1) {
            document.getElementById(id).src = '../img/app/placeholder.png'
        }
    }

    render() {

        return (
            <div className="article">
                <div className="article-inner">
                    <Waypoint onEnter={() => {
                        this.trackImpression(this.props.object.id)
                    }} />
                    <a
                        href={this.props.object.articleUrl}
                        target="_blank"
                        data-id={this.props.object.id}
                        data-position={this.props.index}
                        onClick={this.trackEngagement}>
                        <ProgressiveImage src={this.props.object.imageSrc} placeholder='../img/app/placeholder.png'>
                            {(src) =>
                                <img
                                    src={src}
                                    alt={this.props.object.articleUrl}
                                    height="180"
                                    width="270"
                                    onLoad={() => this.handleImgLoad(src, this.props.object.id)}
                                    id={this.props.object.id} />
                            }
                        </ProgressiveImage>
                    </a>
                    <h2>
                        <a
                            href={this.props.object.articleUrl}
                            target="_blank"
                            onClick={this.trackEngagement}>
                            {this.props.object.title}<commit_msg>Default placeholder image<commit_after>import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import { connect } from 'react-redux'

import Hostname from 'components/Hostname'
import Summary from 'components/Summary'

import Waypoint from 'react-waypoint'
import ProgressiveImage from 'react-progressive-image'

import * as ArticleActions from 'actions/Articles'

@connect()
class Article extends Component {

    trackEngagement = e => this.props.dispatch(
        ArticleActions.engage(this.props.object.id, (this.props.index + 7))
    )

    trackImpression = () => this.props.dispatch(
        ArticleActions.impression(this.props.object.id)
    )

    handleImgLoad = (src, id, err) => {
        if (src == null || src.indexOf('track') != -1) {
            document.getElementById(id).src = 'img/app/placeholder.png'
        }
        if (err) {
            document.getElementById(id).src = 'img/app/placeholder.png'
        }
    }

    render() {

        return (
            <div className="article">
                <div className="article-inner">
                    <Waypoint onEnter={() => {
                        this.trackImpression(this.props.object.id)
                    }} />
                    <a
                        href={this.props.object.articleUrl}
                        target="_blank"
                        data-id={this.props.object.id}
                        data-position={this.props.index}
                        onClick={this.trackEngagement}>
                        <ProgressiveImage src={this.props.object.imageSrc} placeholder='../img/app/placeholder.png'>
                            {(src) =>
                                <img
                                    src={src}
                                    alt={this.props.object.articleUrl}
                                    height="180"
                                    width="270"
                                    onLoad={() => this.handleImgLoad(src, this.props.object.id)}
                                    onError={() => this.handleImgLoad(src, this.props.object.id, true)}
                                    id={this.props.object.id} />
                            }
                        </ProgressiveImage>
                    </a>
                    <h2>
                        <a
                            href={this.props.object.articleUrl}
                            target="_blank"
                            onClick={this.trackEngagement}>
                            {this.props.object.title}
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.003683241252302026, 'mean_word_length': 1.227894257064722, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1684141', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1148, 'n_words': 198}