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

import { updateAttendance } from '../actions';
import FacebookLink from './FacebookLink';

class Attendance extends Component {
  constructor(props) {
    super(props)

    const { attended } = props.attendance.attributes;
    this.state = { attended }
  }

  renderFacebookLink() {
    const { attributes } = this.props.attendance;

    let fromFB = _.find(attributes.origins, { name: 'Facebook' });

    if (fromFB) {
      const { identifiers } = attributes.person.data.attributes;
      const fbIdentifier = _.find(identifiers, (identifier) => {
        return identifier.indexOf('facebook') >= 0;
      });

      return <FacebookLink id={fbIdentifier} />;
    }
  }

  updateAttended(attended) {
    const id = this.props.attendance.id;
    const eventId = this.props.eventId;

    this.setState({ attended });
    this.props.updateAttendance({ id, eventId, attended });
  }

  render() {
    const attendee = this.props.attendance.attributes.person.data.attributes;
    const { attended } = this.state;

    return (
      <div className='list-group-item'>
        <div className='col-8' style={{ display: 'flex', alignItems: 'center' }}>
          <div style={{ marginRight: '20px' }}>
            <div>
              {`${attendee['given-name']} ${attendee['family-name']}`}
            </div>

            <div>
              <small>{`${attendee['primary-email-address']}`}</small>
            </div>
          </div>
<commit_msg>adding links to person profile from event attendance page<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';

import { updateAttendance } from '../actions';
import FacebookLink from './FacebookLink';
import { Link } from 'react-router-dom';
import EmailLink from './EmailLink';
import { membersPath } from '../utils/Pathnames';

class Attendance extends Component {
  constructor(props) {
    super(props)

    const { attended } = props.attendance.attributes;
    this.state = { attended }
  }

  emailAddressLink() {
    const email = this.props.member['primary-email-address']

    if (email)
      return <a href={`mailto:${email}`} className='fa fa-envelope-o'/>
  }

  renderFacebookLink() {
    const { attributes } = this.props.attendance;

    let fromFB = _.find(attributes.origins, { name: 'Facebook' });

    if (fromFB) {
      const { identifiers } = attributes.person.data.attributes;
      const fbIdentifier = _.find(identifiers, (identifier) => {
        return identifier.indexOf('facebook') >= 0;
      });

      return <FacebookLink id={fbIdentifier} />;
    }
  }

  updateAttended(attended) {
    const id = this.props.attendance.id;
    const eventId = this.props.eventId;

    this.setState({ attended });
    this.props.updateAttendance({ id, eventId, attended });
  }

  render() {
    const attendee = this.props.attendance.attributes.person.data.attributes;
    const person = this.props.attendance.attributes.person;
    const { attended } = this.state;

    
    return (
      <div className='list-group-item'>
        <div className='col-8' style={{ display: 'flex', alignItems: 'center' }}>
          <div style={{ marginRight: '20px' }}>
            <div>
              <Link to={`${membersPath()}/${person.data.id}`}>
                {attendee['given-name']} {attendee['family-name']}
              </Link>
            </div>

            <div>
              <small>{`${attendee['primary-email-address']}`}</small>
            </div>
          </div>

{'fraction_non_alphanumeric': 0.15268877124547228, 'fraction_numerical': 0.0022290331568682086, 'mean_word_length': 2.7710084033613445, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1784936', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1062, 'n_words': 227}