import { connect } from 'react-redux';

import { getActiveEvent, getDefaultEvent } from '../../../../selectors/events.js';

import EventTitle from './EventTitle.js';

const matchStateToProps = (state) => {
    const event = hasActiveEvent(state) ? getActiveEvent(state) : getDefaultEvent(state);

    return {
        date: event.get('date'),
        end: event.get('end'),
        name: event.get('name'),
        start: event.get('start'),
    };
};

export default connect(
    matchStateToProps,
    null,
)(EventTitle);
