<commit_before>import React, { Component } from 'react';
import Relay from 'react-relay';
import { Link } from 'react-router';
import moment from 'moment';
import _ from 'lodash';

// import EntryViewer from './EntryViewer';
import Icon from './Icon';

import styles from './css/Entry.module.css';

export class Entry extends Component {
    static colourVariants = [
        { className: styles.entryVariantA, dark: false },
        { className: styles.entryVariantB, dark: false },
        { className: styles.entryVariantC, dark: false },
        { className: styles.entryVariantD, dark: true },
        { className: styles.entryVariantE, dark: false },
        { className: styles.entryVariantF, dark: false },
        { className: styles.entryVariantG, dark: true },
        { className: styles.entryVariantI, dark: false },
        { className: styles.entryVariantJ, dark: true }
    ];

    constructor (props) {
        super(props);

        this.state = {};

        this.showViewer = this.showViewer.bind(this);
        this.hideViewer = this.hideViewer.bind(this);
    }

    showViewer (e) {
        e.preventDefault();

        if (this.props.withViewer) {
            this.setState({
                showEntryViewer: true
            });
        }
    }

    hideViewer () {
        this.setState({
            showEntryViewer: false
        });
    }

    render () {
        var entry = this.props.entry;
        var sentiment = entry.sentiment.type;
        var text = entry.media.text;
        var image = entry.media.image;
        var video = entry.media.video;
        var styleVariant = styles.entry;
        var randomisedStyle, backgroundImage;
        var isTextEntry = text && !image && !video;
        var lightIcon = true;

        if (isTextEntry) {
            randomisedStyle = this.constructor.colourVariants[_.random(0, this.constructor.colourVariants.length - 1)];
            styleVariant = randomisedStyle.className;

            if (randomisedStyle.dark) {
                lightIcon = false;
            }
        } else if (image) {
            backgroundImage = entry.media.imageThumbnail;
        } else if (video) {
            backgroundImage = entry.media.videoThumbnail;
        }

        return (
            <Link
                to={`/entry/${entry.id}`}<commit_msg>Show video on video entry EntryViewer<commit_after>import React, { Component } from 'react';
import Relay from 'react-relay';
import { Link } from 'react-router';
import moment from 'moment';
import _ from 'lodash';

// import EntryViewer from './EntryViewer';
import Icon from './Icon';

import styles from './css/Entry.module.css';

export class Entry extends Component {
    static colourVariants = [
        { className: styles.entryVariantA, dark: false },
        { className: styles.entryVariantB, dark: false },
        { className: styles.entryVariantC, dark: false },
        { className: styles.entryVariantD, dark: true },
        { className: styles.entryVariantE, dark: false },
        { className: styles.entryVariantF, dark: false },
        { className: styles.entryVariantG, dark: true },
        { className: styles.entryVariantI, dark: false },
        { className: styles.entryVariantJ, dark: true }
    ];

    constructor (props) {
        super(props);

        this.state = {};

        this.showViewer = this.showViewer.bind(this);
        this.hideViewer = this.hideViewer.bind(this);
    }

    showViewer (e) {
        e.preventDefault();

        if (this.props.withViewer) {
            this.setState({
                showEntryViewer: true
            });
        }
    }

    hideViewer () {
        this.setState({
            showEntryViewer: false
        });
    }

    render () {
        var entry = this.props.entry;
        var sentiment = entry.sentiment.type;
        var text = entry.media.text;
        var image = entry.media.image;
        var video = entry.media.video;
        var styleVariant = styles.entry;
        var randomisedStyle, backgroundImage;
        var isTextEntry = text && !image && !video;
        var lightIcon = true;

        if (isTextEntry) {
            randomisedStyle = this.constructor.colourVariants[_.random(0, this.constructor.colourVariants.length - 1)];
            styleVariant = randomisedStyle.className;

            if (randomisedStyle.dark) {
                lightIcon = false;
            }
        } else if (image) {
            backgroundImage = entry.media.imageThumbnail;
        } else if (video && this.props.thumbnailMode) {
            backgroundImage = entry.media.videoThumbnail;
        }

        return (
            <Link
                to={`/entry/${entry.id}`}
{'fraction_non_alphanumeric': 0.11405382315249893, 'fraction_numerical': 0.0008543357539513029, 'mean_word_length': 2.0890501319261214, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5181789', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1272, 'n_words': 305}