<commit_before>import React from 'react';
import {
	connect,
} from 'react-redux';
import {
	PropTypes,
} from 'prop-types';

import {
	invalidateDate,
	updateDate,
	invalidateTweets,
	fetchTweetsIfNeeded,
} from '../actions';

import Navigation from '../components/Navigation';
import Tweets from '../components/Tweets';

import {
	dateToString,
} from '../utils/date';

class View extends React.Component {
	componentWillMount() {
		const date = new Date(`${this.props.match.params.date} ${this.props.match.params.hour}:00:00`);

		const {
			dispatch,
		} = this.props;

		dispatch(invalidateDate());
		dispatch(updateDate(date));
		dispatch(invalidateTweets());
		dispatch(fetchTweetsIfNeeded(date));
	}

	render() {
		let tweets;
		if(this.props.tweets.length === 0) {
			if(this.props.isFetching) {
				tweets = (
					<div className="attached ui segment">loading...</div>
				);
			}
			else {
				tweets = (
					<div className="attached ui segment">none</div>
				);
			}
		}
		else {
			tweets = (
				<Tweets style={{
					'opacity': this.props.isFetching ? 0.5 : 1,
				}} tweets={this.props.tweets} />
			);
		}

		return (
			<div className="container">
				<Navigation />

				<h4 className="ui top attached block header">{ dateToString(this.props.date) }</h4>
				{ tweets }<commit_msg>add refresh button<commit_after>import React from 'react';
import {
	connect,
} from 'react-redux';
import {
	PropTypes,
} from 'prop-types';

import {
	invalidateDate,
	updateDate,
	invalidateTweets,
	fetchTweetsIfNeeded,
} from '../actions';

import Navigation from '../components/Navigation';
import Tweets from '../components/Tweets';

import {
	dateToString,
} from '../utils/date';

class View extends React.Component {
	componentWillMount() {
		const date = new Date(`${this.props.match.params.date} ${this.props.match.params.hour}:00:00`);

		const {
			dispatch,
		} = this.props;

		dispatch(invalidateDate());
		dispatch(updateDate(date));
		dispatch(invalidateTweets());
		dispatch(fetchTweetsIfNeeded(date));

		this.refreshTweets = this.refreshTweets.bind(this);
	}

	refreshTweets() {
		const date = new Date(`${this.props.match.params.date} ${this.props.match.params.hour}:00:00`);

		const {
			dispatch,
		} = this.props;

		dispatch(invalidateTweets());
		dispatch(fetchTweetsIfNeeded(date));
	}

	render() {
		let tweets;
		if(this.props.tweets.length === 0) {
			if(this.props.isFetching) {
				tweets = (
					<div className="attached ui segment">loading...</div>
				);
			}
			else {
				tweets = (
					<div className="attached ui segment">none</div>
				);
			}
		}
		else {
			tweets = (
				<Tweets style={{
					'opacity': this.props.isFetching ? 0.5 : 1,
				}} tweets={this.props.tweets} />
			);
		}

		return (
			<div className="container">
				<Navigation />

				<h4 className="ui top attached block header">{ dateToString(this.props.date) }</h4>
				{ tweets }
				<div onClick={ this.refreshTweets } className="ui attached button">refresh</div>
{'fraction_non_alphanumeric': 0.16253351206434316, 'fraction_numerical': 0.00804289544235925, 'mean_word_length': 3.52959028831563, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '6683559', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1033, 'n_words': 195}