import { connect } from 'react-redux';

import { placeBid } from '../../actions/auction.js';

import AuctionListItem from '../../components/Auction/AuctionListItem.js';

const mapStateToProps = (state, ownProps) => {
    const { item } = ownProps;

    return {
        description: item.get('description'),
        donor: item.get('donor'),
        end: item.get('end'),
        id: item.get('id'),
        images: item.get('images').toArray(),
        start: item.get('start'),
        startingPrice: item.get('startingPrice'),
        subtitle: item.get('subtitle'),
        title: item.get('title'),
        type: item.get('type'),
    };
};

const mapDispatchToProps = (dispatch) => ({
    placeBid: (data) => dispatch(placeBid(data)),
});

export default connect(
    mapStateToProps,
    null,
)(AuctionListItem);
