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

import Styles from '../styles/Styles';
import Color from '../styles/Color';

import ViewText from './ViewText';
import Icon from 'react-native-vector-icons/FontAwesome';
import { getFormAvailability } from '../api/Forms';

const FormListItem = React.createClass({
  propTypes: {
    title: React.PropTypes.string.isRequired,
    surveyId: React.PropTypes.string.isRequired,
    trigger: React.PropTypes.object,
  },

  getInitialState() {
    console.log(this.props.trigger)
    return {
      state: null,
      availability: {
        availableTimeTriggers: 0,
        nextTimeTrigger: false,
        geofenceTriggersInRange: 0,
      },
    };
  },

  componentWillReceiveProps(nextProps) {
    if (!nextProps.status) {
      return;
    }

    if (this.state.status !== nextProps.status) {
      // this.update(nextProps.status);
    }
  },

  componentDidMount() {
    // this.update(this.props.status);
  },

  /* Methods */

  /* Render */
  renderIcon() {
    let icon = null;
    switch (this.props.type) {
      default:
        icon = <Icon name='circle-o' size={24} color={Color.secondary} />;
    }
    return (
      <View style={{paddingTop: 4}}>
        {icon}
      </View>
    );
  },

  renderStatusText() {
    const trigger = this.props.trigger;
    if (!trigger) {
      console.warn(`No trigger found`);
      return null;
    }

    if (trigger.completed) {
      return <ViewText textStyle={Styles.survey.itemDescription}>Completed.</ViewText>;
    } else if (trigger.datetime) {
      if (trigger.datetime < Date.now()) {
        return <ViewText textStyle={Styles.survey.itemDescription}>Form available.</ViewText>;
      } else {
        return <ViewText textStyle={Styles.survey.itemDescription}>Scheduled: {moment(trigger.datetime).fromNow()}.</ViewText>;
      }
    } else if (trigger.latitude && trigger.longitude) {<commit_msg>Adds icons to form list items<commit_after>import React from 'react';
import {
  View,
  Text,
} from 'react-native';
import moment from 'moment';

import Styles from '../styles/Styles';
import Color from '../styles/Color';

import ViewText from './ViewText';
import Icon from 'react-native-vector-icons/FontAwesome';
import { getFormAvailability } from '../api/Forms';

const FormListItem = React.createClass({
  propTypes: {
    title: React.PropTypes.string.isRequired,
    surveyId: React.PropTypes.string.isRequired,
    trigger: React.PropTypes.object,
  },

  getInitialState() {
    console.log(this.props.trigger)
    return {
      state: null,
      availability: {
        availableTimeTriggers: 0,
        nextTimeTrigger: false,
        geofenceTriggersInRange: 0,
      },
    };
  },

  componentWillReceiveProps(nextProps) {
    if (!nextProps.status) {
      return;
    }

    if (this.state.status !== nextProps.status) {
      // this.update(nextProps.status);
    }
  },

  componentDidMount() {
    // this.update(this.props.status);
  },

  /* Methods */

  /* Render */
  renderIcon() {
    const trigger = this.props.trigger;
    let icon = null;
    let color = Color.secondary;

    if (!trigger) {
      return (
        <View style={{paddingTop: 4}}>
          <Icon name='circle-o' size={24} color={Color.secondary} />
        </View>
      );
    } else if (trigger.completed) {
      icon = <Icon name='check-circle' size={24} color={Color.positive} />;
    } else if (trigger.datetime) {
      if (trigger.datetime < Date.now()) {
        color = Color.positive;
      }
      icon = <Icon name='clock-o' size={24} color={color} />;
    } else if (trigger.latitude && trigger.longitude) {
      if (trigger.inRange) {
        color = Color.positive;
      }
      icon = <Icon name='map-marker' size={24} color={color} />;
    }

    return (
      <View style={{paddingTop: 4}}>
        {icon}
      </View>
    );
  },

  renderStatusText() {
    const trigger = this.props.trigger;
    if (!trigger) {
      console.warn(`No trigger found`);
      return null;
    }

    if (trigger.completed) {
      return <ViewText textStyle={Styles.survey.itemDescription}>Completed.</ViewText>;
    } else if (trigger.datetime) {
      if (trigger.datetime < Date.now()) {
        return <ViewText textStyle={Styles.survey.itemDescription}>Form available.</ViewText>;
      } else {
        return <ViewText textStyle={Styles.survey.itemDescription}>Scheduled: {moment(trigger.datetime).fromNow()}.</ViewText>;
      }
    } else if (trigger.latitude && trigger.longitude) {
{'fraction_non_alphanumeric': 0.14731558271497164, 'fraction_numerical': 0.003710170231340026, 'mean_word_length': 2.732084690553746, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 26, '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': '5369459', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1404, 'n_words': 288}