- Reorg andf cleanup. Maintainability.
This commit is contained in:
@@ -39,7 +39,6 @@ HeaderContentLeft.propTypes = {
|
||||
activeRoute: PropTypes.string.isRequired,
|
||||
hasActiveEvent: PropTypes.bool,
|
||||
hasMultipleEvents: PropTypes.bool,
|
||||
navigation: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
HeaderContentLeft.defaultProps = {
|
||||
|
||||
@@ -50,7 +50,6 @@ HeaderTitle.propTypes = {
|
||||
activeRoute: PropTypes.string.isRequired,
|
||||
hasActiveEvent: PropTypes.bool,
|
||||
hasMultipleEvents: PropTypes.bool.isRequired,
|
||||
navigation: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
HeaderTitle.defaultProps = {
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { TouchableOpacity } from 'react-native';
|
||||
import { Icon } from 'react-native-elements';
|
||||
import Icon from 'react-native-vector-icons';
|
||||
|
||||
export default function BackIcon({ action }) {
|
||||
return (
|
||||
|
||||
@@ -5,7 +5,7 @@ import { TouchableOpacity } from 'react-native';
|
||||
import { Icon } from 'react-native-elements';
|
||||
|
||||
export default function EventsIcon({ action }) {
|
||||
const renderEventsIcon = () => <Icon name="ei-calendar" type="evilicons" size={28} />;
|
||||
const renderEventsIcon = () => <Icon name="calendar" type="evilicon" size={28} />;
|
||||
|
||||
if (action) {
|
||||
return <TouchableOpacity onPress={action}>{renderEventsIcon()}</TouchableOpacity>;
|
||||
|
||||
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);
|
||||
31
app/components/Events/EventListItem.container.js
Normal file
31
app/components/Events/EventListItem.container.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { setActiveEvent } from '../../actions/events.js';
|
||||
import EventListItem from './EventListItem.js';
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const { event } = ownProps;
|
||||
|
||||
return {
|
||||
description: event.get('description'),
|
||||
endTime: event.get('endTime'),
|
||||
id: event.get('id'),
|
||||
images: event.get('images').toArray(),
|
||||
isTicketed: event.get('isTicketed'),
|
||||
postCount: event.get('posts').size,
|
||||
showFrom: event.get('showFrom'),
|
||||
showUntil: event.get('showUntil'),
|
||||
startTime: event.get('startTime'),
|
||||
tagline: event.get('tagline'),
|
||||
title: event.get('title'),
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setActiveEvent: (eventId) => dispatch(setActiveEvent(eventId)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(EventListItem);
|
||||
Reference in New Issue
Block a user