content: import React from 'react';
  import EventCard from './event_card';
  import SecondLoader from './second_loader';
  import { emit } from '../lib/dispatcher';
  
  function getEventCards(events, userEvents) {
  
    return events.map((event) => {
  
      const userEvent = userEvents.filter((uevent) => uevent.get('id') === event.get('id')).first();
  
      return (
  
        <EventCard
          key={event.get('id')}
          userAttending={userEvent !== undefined && userEvent.get('rsvp_status') === 'attending'}
          event={event} />
      );
    });
  }
  
  const EventsList = React.createClass({
  
    componentDidMount() {
  
      emit('GET_USER');
      emit('GET_EVENTS');
    },
    render() {
  
      if (this.props.events.size === 0) {
  
        return <SecondLoader />;
      }
  
      return <div>{getEventCards(this.props.events, this.props.userEvents)}</div>;
    }
  });
  
  export default EventsList;
  