<commit_before>import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import classNames from 'classnames';
import Velocity from 'velocity-animate';
import screenfull from 'screenfull';
import TimeAgo from 'react-timeago';

import ThreadPost from '../ThreadPost';
import Background from '../Background';
import Spinner from '../Spinner';

import {closeThread} from "../../actions/thread.actions";

class Thread extends React.Component {
    constructor() {
        super()
        this.onThreadClose = this.onThreadClose.bind(this)
    }

    componentDidMount() {
        console.error('oi2')
        $(this.refs.thread).on('click', '.fullscreen', function(event){
            event.stopPropagation()
            console.log('Worked!!!', this)
        });
    }

    componentDidUpdate(prevProps) {
        const { thread } = this.props;
        if (prevProps.thread.length !== thread.length){
            // Thread created or destroyed
            this.threadToggle(this.refs.thread);            
        } 
    }

    render() {
        const { thread, isFetching } = this.props
        const threadWrapClasses = classNames({
            "thread-wrap": true,
            "thread-wrap-active": thread.length || isFetching
        });

        console.info(`Rendering Thread with ${thread.length} posts`);
        

        return (
            <div className={threadWrapClasses}>
                <Background 
                    isVisible={thread.length || isFetching} 
                    closeBackground={this.onThreadClose}/>
                <Spinner 
                    isSpinning={isFetching}/>
                <div 
                    className="thread"
                    ref="thread">
                    {thread.map( 
                        post => {
                            console.log(post.time);
                            return (
                                <ThreadPost 
                                    key={post.id} 
                                    post={post}>
                                    <TimeAgo date={1473868185674}/>
                                </ThreadPost>
                            )<commit_msg>Add fullscreen functionality for thread images<commit_after>import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import classNames from 'classnames';
import Velocity from 'velocity-animate';
import screenfull from 'screenfull';
import TimeAgo from 'react-timeago';

import ThreadPost from '../ThreadPost';
import Background from '../Background';
import Spinner from '../Spinner';

import {closeThread} from "../../actions/thread.actions";

class Thread extends React.Component {
    constructor() {
        super()
        this.onThreadClose = this.onThreadClose.bind(this)
    }

    componentDidMount() {
        $(this.refs.thread).on('click', '.fa-stack', function(event){
            event.stopPropagation()
            if (screenfull.enabled) {
                const target = $(event.target)
                                    .parents('.fullscreen')
                                    .next()[0]
                console.warn(target)
                screenfull.toggle(target);
            }
        });
    }

    componentWillUnmount() {
        $(this.refs.thread).off('click')
    }

    componentDidUpdate(prevProps) {
        const { thread } = this.props;
        if (prevProps.thread.length !== thread.length){
            // Thread created or destroyed
            this.threadToggle(this.refs.thread);            
        } 
    }

    render() {
        const { thread, isFetching } = this.props
        const threadWrapClasses = classNames({
            "thread-wrap": true,
            "thread-wrap-active": thread.length || isFetching
        });

        console.info(`Rendering Thread with ${thread.length} posts`);
        

        return (
            <div className={threadWrapClasses}>
                <Background 
                    isVisible={thread.length || isFetching} 
                    closeBackground={this.onThreadClose}/>
                <Spinner 
                    isSpinning={isFetching}/>
                <div 
                    className="thread"
                    ref="thread">
                    {thread.map( 
                        post => {
                            console.log(post.time);
                            return (
                                <ThreadPost 
                                    key={post.id} 
                                    post={post}>
                                    <TimeAgo date={post.tim || post.time}/>
                                </ThreadPost>
                            )
{'fraction_non_alphanumeric': 0.11015164279696714, 'fraction_numerical': 0.0031592249368155014, 'mean_word_length': 1.4045569620253164, 'pattern_counts': {'":': 4, '<': 17, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '347141', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1108, 'n_words': 238}