<commit_before>import React, {PureComponent} from 'react';
import {DateTime} from 'luxon';

import CircularProgress from 'material-ui/CircularProgress';
import FlatButton from 'material-ui/FlatButton';
import {Card, CardActions, CardHeader, CardText} from 'material-ui/Card';
import Paper from 'material-ui/Paper';

import config from '../config';

import './DocumentsList.css';

const styles = {
    progress: {
        marginTop: 40,
        textAlign: 'center'
    },
    paper: {
        margin: '8px',
        maxWidth: '900px',
        overflow: 'hidden'
    },
    cardTitle: {
        fontSize: '18px',
    },
    cardSubtitle: {
        fontSize: '15px',
        marginTop: '10px'
    },
    cardText: {
        fontSize: '16px',
        padding: '0 16px',
        lineHeight: '1.5'
    },
};

const expandedThreshold = 3000;

class DocumentsList extends PureComponent {
    render() {
        const requestInProcess = this.props.requestInProgress;

        this._expandedState = this.props.expandedState;

        return requestInProcess ?
            this._renderProgress() :
            this._renderDocs();
    }

    _renderProgress() {
        return (
            <div style={styles.progress}>
                <CircularProgress size={80} thickness={7} />
            </div>
        );
    }

    _renderDocs() {
        const docs = this.props.items || [];

        return (
            <div>
                {docs.map(this._renderDoc, this)}
            </div>
        );
    }

    _renderDoc(doc) {
        let expanded = this._expandedState[doc.id];
        if (expanded === undefined) {
            expanded = doc.description.length < expandedThreshold;
        }

        return (
            <Paper key={doc.id} zDepth={1} style={styles.paper}>
                <Card
                    initiallyExpanded={expanded}
                    onExpandChange={this._onCardExpandChange.bind(this, doc.id)}
                    className="document-card">
                    <CardHeader
                        titleStyle={styles.cardTitle}
                        subtitleStyle={styles.cardSubtitle}
                        showExpandableButton={true}
                        title={
                            <a href={doc.link}
                               target="_blank"
                               dangerouslySetInnerHTML={{ __html: doc.title }} /><commit_msg>Add rel=noopener to external links<commit_after>import React, {PureComponent} from 'react';
import {DateTime} from 'luxon';

import CircularProgress from 'material-ui/CircularProgress';
import FlatButton from 'material-ui/FlatButton';
import {Card, CardActions, CardHeader, CardText} from 'material-ui/Card';
import Paper from 'material-ui/Paper';

import config from '../config';

import './DocumentsList.css';

const styles = {
    progress: {
        marginTop: 40,
        textAlign: 'center'
    },
    paper: {
        margin: '8px',
        maxWidth: '900px',
        overflow: 'hidden'
    },
    cardTitle: {
        fontSize: '18px',
    },
    cardSubtitle: {
        fontSize: '15px',
        marginTop: '10px'
    },
    cardText: {
        fontSize: '16px',
        padding: '0 16px',
        lineHeight: '1.5'
    },
};

const expandedThreshold = 3000;

class DocumentsList extends PureComponent {
    render() {
        const requestInProcess = this.props.requestInProgress;

        this._expandedState = this.props.expandedState;

        return requestInProcess ?
            this._renderProgress() :
            this._renderDocs();
    }

    _renderProgress() {
        return (
            <div style={styles.progress}>
                <CircularProgress size={80} thickness={7} />
            </div>
        );
    }

    _renderDocs() {
        const docs = this.props.items || [];

        return (
            <div>
                {docs.map(this._renderDoc, this)}
            </div>
        );
    }

    _renderDoc(doc) {
        let expanded = this._expandedState[doc.id];
        if (expanded === undefined) {
            expanded = doc.description.length < expandedThreshold;
        }

        return (
            <Paper key={doc.id} zDepth={1} style={styles.paper}>
                <Card
                    initiallyExpanded={expanded}
                    onExpandChange={this._onCardExpandChange.bind(this, doc.id)}
                    className="document-card">
                    <CardHeader
                        titleStyle={styles.cardTitle}
                        subtitleStyle={styles.cardSubtitle}
                        showExpandableButton={true}
                        title={
                            <a href={doc.link}
                               target="_blank"
                               rel="noopener"
                               dangerouslySetInnerHTML={{ __html: doc.title }} />
{'fraction_non_alphanumeric': 0.11462859507552245, 'fraction_numerical': 0.0111731843575419, 'mean_word_length': 1.6575041231445848, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, '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': '2870328', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1276, 'n_words': 263}