<commit_before>import React, { Component } from 'react';
import {
	View,
	Text,
	Image,
	TouchableHighlight
} from 'react-native';

import _ from 'lodash';
import moment from 'moment';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import { decodeHTML, getBloggerAvatar }  from '../../common';
import Config from '../../config';
import { ComponentStyles, CommonStyles, StyleConfig } from '../../style';

class NewsRow extends Component {

	constructor(props) {
	    super(props);
	    this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
	}

	getNewsInfo(){
		const { news } = this.props;
		let newsInfo = {};
		if (news && news.Id) {
			newsInfo = { ...news };
			newsInfo.Title = decodeHTML(news.Title);
			if (news.Summary) {
				newsInfo.Summary = _.truncate(decodeHTML(news.Summary), { length : 70 });
			}
			newsInfo.DateAdded = moment(news.DateAdded).startOf('minute').fromNow();
			newsInfo.TopicIcon = news.TopicIcon;
		}
		return newsInfo;
	}

	renderNewsImg(newsInfo){
		return (
			<Image ref={view => this.imgView=view}
				style={ [ ComponentStyles.avatar, CommonStyles.m_r_2] }
				source={ {uri:newsInfo.TopicIcon} }>
			</Image>
		)
	}

	renderNewsTitle(newsInfo){
		return (
			<View style={ [ CommonStyles.flexRow, CommonStyles.flexItemsMiddle, CommonStyles.m_b_1 ] }>
				<Text style={ [CommonStyles.text_black, CommonStyles.font_md, CommonStyles.line_height_md ] }>
					{ newsInfo.Title }
				</Text>
			</View>
		)
	}

	renderNewsDescr(newsInfo){
		return (
			<View style={ [ CommonStyles.m_b_2 ] }>
				<Text style={ [ CommonStyles.text_gray, CommonStyles.font_xs, CommonStyles.line_height_sm ] }>
					{ newsInfo.Summary }
				</Text>
			</View>
		)
	}

	renderNewsMeta(newsInfo){
		return (
			<View style={ [ CommonStyles.flexRow, CommonStyles.flexItemsBetween ] }>
				<View style={[ CommonStyles.flexRow, CommonStyles.flexItemsMiddle ]}>
					<Image ref={view => this.imgView=view}
						style={ [ ComponentStyles.avatar_mini, CommonStyles.m_r_1] }
						source={ {uri:newsInfo.TopicIcon} }>
					</Image>
					<Text style={ CommonStyles.text_gray }>
						{ newsInfo.DateAdded }
					</Text>
				</View>
				<View>
					<Text style={ [ CommonStyles.text_primary ] }>
						{ newsInfo.CommentCount + ' / ' + newsInfo.ViewCount }
					</Text>
				</View>
			</View>
		)
	}
	<commit_msg>news row style<commit_after>import React, { Component } from 'react';
import {
	View,
	Text,
	Image,
	TouchableHighlight
} from 'react-native';

import _ from 'lodash';
import moment from 'moment';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import { decodeHTML, getBloggerAvatar }  from '../../common';
import Config from '../../config';
import { ComponentStyles, CommonStyles, StyleConfig } from '../../style';

class NewsRow extends Component {

	constructor(props) {
	    super(props);
	    this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
	}

	getNewsInfo(){
		const { news } = this.props;
		let newsInfo = {};
		if (news && news.Id) {
			newsInfo = { ...news };
			newsInfo.Title = decodeHTML(news.Title);
			if (news.Summary) {
				newsInfo.Summary = _.truncate(decodeHTML(news.Summary), { length : 70 });
			}
			newsInfo.DateAdded = moment(news.DateAdded).startOf('minute').fromNow();
			newsInfo.TopicIcon = news.TopicIcon;
		}
		return newsInfo;
	}

	renderNewsImg(newsInfo){
		return (
			<Image ref={view => this.imgView=view}
				style={ [ ComponentStyles.avatar, CommonStyles.m_r_2] }
				source={ {uri:newsInfo.TopicIcon} }>
			</Image>
		)
	}

	renderNewsTitle(newsInfo){
		return (
			<View style={ [ CommonStyles.m_b_1 ] }>
				<Text style={ [CommonStyles.text_black, CommonStyles.font_md, CommonStyles.line_height_md ] }>
					{ newsInfo.Title }
				</Text>
			</View>
		)
	}

	renderNewsDescr(newsInfo){
		return (
			<View style={ [ CommonStyles.m_b_2 ] }>
				<Text style={ [ CommonStyles.text_gray, CommonStyles.font_xs, CommonStyles.line_height_sm ] }>
					{ newsInfo.Summary }
				</Text>
			</View>
		)
	}

	renderNewsMeta(newsInfo){
		return (
			<View style={ [ CommonStyles.flexRow, CommonStyles.flexItemsBetween ] }>
				<View style={[ CommonStyles.flexRow, CommonStyles.flexItemsMiddle ]}>
					<Image ref={view => this.imgView=view}
						style={ [ ComponentStyles.avatar_mini, CommonStyles.m_r_2] }
						source={ {uri:newsInfo.TopicIcon} }>
					</Image>
					<Text style={ CommonStyles.text_gray }>
						{ newsInfo.DateAdded }
					</Text>
				</View>
				<View>
					<Text style={ [ CommonStyles.text_primary ] }>
						{ newsInfo.CommentCount + ' / ' + newsInfo.ViewCount }
					</Text>
				</View>
			</View>
		)
	}
	
{'fraction_non_alphanumeric': 0.15054685824576453, 'fraction_numerical': 0.0025734505683036673, 'mean_word_length': 3.43767840152236, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 51, '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': '1671124', 'n_tokens_mistral': 1843, 'n_tokens_neox': 1598, 'n_words': 288}