- Reorg andf cleanup. Maintainability.
This commit is contained in:
31
app/components/Auction/AuctionListItem.container.js
Normal file
31
app/components/Auction/AuctionListItem.container.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { placeBid } from '../../actions/auction.js';
|
||||
|
||||
import AuctionListItem from './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,
|
||||
mapDispatchToProps,
|
||||
)(AuctionListItem);
|
||||
@@ -5,8 +5,8 @@ import { StyleSheet, TouchableOpacity, Text, Image, View } from 'react-native';
|
||||
|
||||
import GallerySwiper from 'react-native-gallery-swiper';
|
||||
|
||||
import AuctionPriceAndBidCount from '../../containers/Auction/AuctionPriceAndBidCount.js';
|
||||
import BidStatus from '../../containers/Auction/BidStatus.js';
|
||||
import AuctionPriceAndBidCount from './AuctionPriceAndBidCount.container.js';
|
||||
import BidStatus from './BidStatus.container.js';
|
||||
|
||||
import { ITEM_TYPES } from '../../constants/constants.js';
|
||||
import { formatPrice, getAuctionTime } from '../../library/helpers.js';
|
||||
|
||||
19
app/components/Auction/AuctionPriceAndBidCount.container.js
Normal file
19
app/components/Auction/AuctionPriceAndBidCount.container.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { getItemBidCount, getItemPrice } from '../../selectors/auctions.js';
|
||||
|
||||
import AuctionPriceAndBidCount from './AuctionPriceAndBidCount.js';
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
const { itemId } = ownProps;
|
||||
|
||||
return {
|
||||
bidCount: getItemBidCount(state, itemId),
|
||||
currentPrice: getItemPrice(state, itemId),
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
)(AuctionPriceAndBidCount);
|
||||
19
app/components/Auction/BidStatus.container.js
Normal file
19
app/components/Auction/BidStatus.container.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { isBiddingItem, isWinningItem } from '../../selectors/auctions.js';
|
||||
|
||||
import AuctionPriceAndBidCount from './BidStatus.js';
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
const { itemId } = ownProps;
|
||||
|
||||
return {
|
||||
isBidding: isBiddingItem(state, itemId),
|
||||
isWinning: isWinningItem(state, itemId),
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
)(AuctionPriceAndBidCount);
|
||||
Reference in New Issue
Block a user