<commit_before>import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  Navigator,
  Dimensions,
  TouchableOpacity
} from 'react-native';
import Image from 'react-native-image-progress';
import * as Progress from 'react-native-progress';

import TextPingFang from './TextPingFang';
import NotificationDetailPage from '../pages/NotificationDetailPage';

const WIDTH = Dimensions.get("window").width
const HEIGHT = Dimensions.get("window").height

export default class NotificationCell extends Component {
  static defaultProps = {}
  constructor(props) {
    super(props);
    this.state = {
      title: this.props.notification.title,
      content: this.props.notification.content,
      image: this.props.notification.image,
      time: this.props.notification.time,
      type: this.props.notification.type,
      url: this.props.notification.url,
    };
  }

  formatDate(time) {
    var month = (time.getMonth() + 1 < 10)? ('0' + (time.getMonth() + 1)) : time.getMonth() + 1;     
    var date = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();   
    var hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours();     
    var minute = time.getMinutes()< 10 ? '0' + time.getMinutes() : time.getMinutes();     
    return month+"-"+date+" "+hour+":"+minute;    
  }

  onJump(page,params) {
    this.props.navigator.push({
      component: page,
      params: params
    })
  }

  render() {
    var d = new Date(this.state.time)
    var time = this.formatDate(d);
    let CoverImage = null;
    if (this.state.type == 1) {
      CoverImage = <Image 
        style={styles.image} 
        source={{uri:this.state.image}} 
        indicator={Progress.Circle}
        />
    }
    const cell = (
      <View style={styles.container}>

        <View style={styles.timeStampContainer}>
          <TextPingFang style={styles.timeStamp}>
            {time}
          </TextPingFang>
        </View>

        <View style={styles.contentContainer}>
          <TextPingFang style={styles.title}>
            {this.state.title}
          </TextPingFang>
          <View style={styles.line}></View>
          {CoverImage}

          <TextPingFang style={styles.content}>
            {this.state.content}
          </TextPingFang>

          <View style={styles.line}></View>
          <TouchableOpacity
            onPress={()=>{
              this.onJump(NotificationDetailPage, {
                url: this.props.notification.url
              })
            }}>
          <View style={styles.detailConteainer}>
              <TextPingFang style={styles.detailTitle}>
                查看详情
              </TextPingFang>  
            <Image style={styles.detailIcon} source={require('../../res/images/right1.png')} />
          </View>
          </TouchableOpacity>
        </View>
      </View>
    );

    return (
      <TouchableOpacity>
        {cell}
      </TouchableOpacity>
    );
  }
}

var styles = StyleSheet.create({
  container: {
    flexDirection:'column',
    marginLeft:12,
    marginRight:12,
    alignItems: "center",
  },
  timeStampContainer: {
    margin: 10,
    backgroundColor:"#DBE2E8",
    borderRadius: 20 / 667 * HEIGHT,
    width:80,
    height:20,
    alignItems: "center"
  },
  timeStamp: {
    fontSize: 10,
    margin: 3,
    color: 'white',
  },
  contentContainer: {
    backgroundColor:"white",<commit_msg>1.优化了通知单元格<commit_after>import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  Navigator,
  Dimensions,
  TouchableOpacity
} from 'react-native';
import Image from 'react-native-image-progress';
import * as Progress from 'react-native-progress';

import TextPingFang from './TextPingFang';
import NotificationDetailPage from '../pages/NotificationDetailPage';

const WIDTH = Dimensions.get("window").width
const HEIGHT = Dimensions.get("window").height

export default class NotificationCell extends Component {
  static defaultProps = {}
  constructor(props) {
    super(props);
    this.state = {
      title: this.props.notification.title,
      content: this.props.notification.content,
      image: this.props.notification.image,
      time: this.props.notification.time,
      type: this.props.notification.type,
      url: this.props.notification.url,
    };
  }

  formatDate(time) {
    var month = (time.getMonth() + 1 < 10)? ('0' + (time.getMonth() + 1)) : time.getMonth() + 1;
    var date = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
    var hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours();
    var minute = time.getMinutes()< 10 ? '0' + time.getMinutes() : time.getMinutes();
    return month+"-"+date+" "+hour+":"+minute;
  }

  onJump(page,params) {
    this.props.navigator.push({
      component: page,
      params: params
    })
  }

  render() {
    var d = new Date(this.state.time)
    var time = this.formatDate(d);
    let CoverImage = null;
    if (this.state.type == 1) {
      CoverImage = <Image
        style={styles.image}
        source={{uri:this.state.image}}
        indicator={Progress.Circle}
        />
    }

    return (
      <View style={styles.container}>

        <View style={styles.timeStampContainer}>
          <TextPingFang style={styles.timeStamp}>
            {time}
          </TextPingFang>
        </View>

        <View style={styles.contentContainer}>
          <TextPingFang style={styles.title}>
            {this.state.title}
          </TextPingFang>
          <View style={styles.line}></View>
          {CoverImage}

          <TextPingFang style={styles.content}>
            {this.state.content}
          </TextPingFang>

          <View style={styles.line}></View>
          <TouchableOpacity
            onPress={()=>{
              this.onJump(NotificationDetailPage, {
                url: this.props.notification.url
              })
            }}>
          <View style={styles.detailConteainer}>
              <TextPingFang style={styles.detailTitle}>
                查看详情
              </TextPingFang>
            <Image style={styles.detailIcon} source={require('../../res/images/right1.png')} />
          </View>
          </TouchableOpacity>
        </View>
      </View>
    );
  }
}

var styles = StyleSheet.create({
  container: {
    flexDirection:'column',
    marginLeft:12,
    marginRight:12,
    alignItems: "center",
  },
  timeStampContainer: {
    margin: 10,
    backgroundColor:"#DBE2E8",
    borderRadius: 20 / 667 * HEIGHT,
    width:80,
    height:20,
    alignItems: "center"
  },
  timeStamp: {
    fontSize: 10,
    margin: 3,
    color: 'white',
  },
  contentContainer: {
    backgroundColor:"white",
{'fraction_non_alphanumeric': 0.1435866626614599, 'fraction_numerical': 0.011264644037248422, 'mean_word_length': 2.342871485943775, 'pattern_counts': {'":': 2, '<': 61, '<?xml version=': 0, '>': 55, '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': '5875866', 'n_tokens_mistral': 2145, 'n_tokens_neox': 2072, 'n_words': 390}