From 0f618fdd78fdebae709202a3a969fc4d94575a6d Mon Sep 17 00:00:00 2001 From: Mike Fitzpatrick Date: Fri, 9 Aug 2019 02:52:31 -0400 Subject: [PATCH] - Reorg andf cleanup. Maintainability. --- app/components/AppHeader/HeaderContentLeft.js | 1 - .../AppHeader/HeaderTitle/HeaderTitle.js | 1 - .../AppHeader/IconButtons/BackIcon.js | 2 +- .../AppHeader/IconButtons/EventsIcon.js | 2 +- .../Auction/AuctionListItem.container.js} | 4 ++-- app/components/Auction/AuctionListItem.js | 4 ++-- .../AuctionPriceAndBidCount.container.js} | 2 +- .../Auction/BidStatus.container.js} | 2 +- .../Events/EventListItem.container.js} | 2 +- app/containers/Events.js | 22 ------------------- app/router.js | 2 +- app/screens/Auction.js | 2 +- app/screens/Events.js | 8 ++++--- 13 files changed, 16 insertions(+), 38 deletions(-) rename app/{containers/Auction/AuctionListItem.js => components/Auction/AuctionListItem.container.js} (89%) rename app/{containers/Auction/AuctionPriceAndBidCount.js => components/Auction/AuctionPriceAndBidCount.container.js} (81%) rename app/{containers/Auction/BidStatus.js => components/Auction/BidStatus.container.js} (83%) rename app/{containers/Events/EventListItem.js => components/Events/EventListItem.container.js} (92%) delete mode 100644 app/containers/Events.js diff --git a/app/components/AppHeader/HeaderContentLeft.js b/app/components/AppHeader/HeaderContentLeft.js index 37c9f6f..4485c24 100644 --- a/app/components/AppHeader/HeaderContentLeft.js +++ b/app/components/AppHeader/HeaderContentLeft.js @@ -39,7 +39,6 @@ HeaderContentLeft.propTypes = { activeRoute: PropTypes.string.isRequired, hasActiveEvent: PropTypes.bool, hasMultipleEvents: PropTypes.bool, - navigation: PropTypes.func.isRequired, }; HeaderContentLeft.defaultProps = { diff --git a/app/components/AppHeader/HeaderTitle/HeaderTitle.js b/app/components/AppHeader/HeaderTitle/HeaderTitle.js index cfca91e..06e5d36 100644 --- a/app/components/AppHeader/HeaderTitle/HeaderTitle.js +++ b/app/components/AppHeader/HeaderTitle/HeaderTitle.js @@ -50,7 +50,6 @@ HeaderTitle.propTypes = { activeRoute: PropTypes.string.isRequired, hasActiveEvent: PropTypes.bool, hasMultipleEvents: PropTypes.bool.isRequired, - navigation: PropTypes.func.isRequired, }; HeaderTitle.defaultProps = { diff --git a/app/components/AppHeader/IconButtons/BackIcon.js b/app/components/AppHeader/IconButtons/BackIcon.js index f839cfb..2be4679 100644 --- a/app/components/AppHeader/IconButtons/BackIcon.js +++ b/app/components/AppHeader/IconButtons/BackIcon.js @@ -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 ( diff --git a/app/components/AppHeader/IconButtons/EventsIcon.js b/app/components/AppHeader/IconButtons/EventsIcon.js index 2f37b28..9a7e21b 100644 --- a/app/components/AppHeader/IconButtons/EventsIcon.js +++ b/app/components/AppHeader/IconButtons/EventsIcon.js @@ -5,7 +5,7 @@ import { TouchableOpacity } from 'react-native'; import { Icon } from 'react-native-elements'; export default function EventsIcon({ action }) { - const renderEventsIcon = () => ; + const renderEventsIcon = () => ; if (action) { return {renderEventsIcon()}; diff --git a/app/containers/Auction/AuctionListItem.js b/app/components/Auction/AuctionListItem.container.js similarity index 89% rename from app/containers/Auction/AuctionListItem.js rename to app/components/Auction/AuctionListItem.container.js index d46bd2a..d7449e2 100644 --- a/app/containers/Auction/AuctionListItem.js +++ b/app/components/Auction/AuctionListItem.container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import { placeBid } from '../../actions/auction.js'; -import AuctionListItem from '../../components/Auction/AuctionListItem.js'; +import AuctionListItem from './AuctionListItem.js'; const mapStateToProps = (state, ownProps) => { const { item } = ownProps; @@ -27,5 +27,5 @@ const mapDispatchToProps = (dispatch) => ({ export default connect( mapStateToProps, - null, + mapDispatchToProps, )(AuctionListItem); diff --git a/app/components/Auction/AuctionListItem.js b/app/components/Auction/AuctionListItem.js index df3b2b9..defd25d 100644 --- a/app/components/Auction/AuctionListItem.js +++ b/app/components/Auction/AuctionListItem.js @@ -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'; diff --git a/app/containers/Auction/AuctionPriceAndBidCount.js b/app/components/Auction/AuctionPriceAndBidCount.container.js similarity index 81% rename from app/containers/Auction/AuctionPriceAndBidCount.js rename to app/components/Auction/AuctionPriceAndBidCount.container.js index aa3fdb8..cf89a71 100644 --- a/app/containers/Auction/AuctionPriceAndBidCount.js +++ b/app/components/Auction/AuctionPriceAndBidCount.container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import { getItemBidCount, getItemPrice } from '../../selectors/auctions.js'; -import AuctionPriceAndBidCount from '../../components/Auction/AuctionPriceAndBidCount.js'; +import AuctionPriceAndBidCount from './AuctionPriceAndBidCount.js'; function mapStateToProps(state, ownProps) { const { itemId } = ownProps; diff --git a/app/containers/Auction/BidStatus.js b/app/components/Auction/BidStatus.container.js similarity index 83% rename from app/containers/Auction/BidStatus.js rename to app/components/Auction/BidStatus.container.js index c636410..0686a43 100644 --- a/app/containers/Auction/BidStatus.js +++ b/app/components/Auction/BidStatus.container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import { isBiddingItem, isWinningItem } from '../../selectors/auctions.js'; -import AuctionPriceAndBidCount from '../../components/Auction/BidStatus.js'; +import AuctionPriceAndBidCount from './BidStatus.js'; function mapStateToProps(state, ownProps) { const { itemId } = ownProps; diff --git a/app/containers/Events/EventListItem.js b/app/components/Events/EventListItem.container.js similarity index 92% rename from app/containers/Events/EventListItem.js rename to app/components/Events/EventListItem.container.js index fa95e0b..af96c20 100644 --- a/app/containers/Events/EventListItem.js +++ b/app/components/Events/EventListItem.container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux'; import { setActiveEvent } from '../../actions/events.js'; -import EventListItem from '../../components/Events/EventListItem.js'; +import EventListItem from './EventListItem.js'; const mapStateToProps = (state, ownProps) => { const { event } = ownProps; diff --git a/app/containers/Events.js b/app/containers/Events.js deleted file mode 100644 index 6eb0ea5..0000000 --- a/app/containers/Events.js +++ /dev/null @@ -1,22 +0,0 @@ -import { connect } from 'react-redux'; - -import { fetchEvents } from '../actions/events.js'; -import { getEventsAsList } from '../selectors/events.js'; - -import Events from '../screens/Events.js'; - -const matchStateToProps = (state) => { - const events = getEventsAsList(state); - console.log('events:', events); - - return { events }; -}; - -const mapDispatchToProps = (dispatch) => ({ - fetchEvents: () => dispatch(fetchEvents(dispatch)), -}); - -export default connect( - matchStateToProps, - mapDispatchToProps, -)(Events); diff --git a/app/router.js b/app/router.js index 1799cc6..0bfd54e 100644 --- a/app/router.js +++ b/app/router.js @@ -145,7 +145,7 @@ export const Tabs = createBottomTabNavigator({ navigationOptions: { tabBarLabel: 'Profile', tabBarIcon: ({ tintColor }) => ( - + ), }, }, diff --git a/app/screens/Auction.js b/app/screens/Auction.js index 9623222..a6205ab 100644 --- a/app/screens/Auction.js +++ b/app/screens/Auction.js @@ -7,7 +7,7 @@ import { FlatList, Text, View } from 'react-native'; import { SORT_MODES, AUCTION_VIEW_MODES } from '../constants/constants.js'; import FilterBar from '../components/Auction/FilterBar.js'; -import AuctionListItem from '../containers/Auction/AuctionListItem.js'; +import AuctionListItem from '../components/Auction/AuctionListItem.container.js'; import styles from './Auction.styles.js'; diff --git a/app/screens/Events.js b/app/screens/Events.js index 2cf008a..f95f6c5 100644 --- a/app/screens/Events.js +++ b/app/screens/Events.js @@ -2,9 +2,9 @@ import { List } from 'immutable'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { FlatList, StyleSheet, View } from 'react-native'; +import { ActivityIndicator, FlatList, StyleSheet, View } from 'react-native'; -import EventListItem from '../containers/Events/EventListItem.js'; +import EventListItem from '../components/Events/EventListItem.container.js'; export default class Events extends Component { static get propTypes() { @@ -41,7 +41,7 @@ export default class Events extends Component { return ( - {events.size > 0 && ( + {events.size > 0 ? ( + ) : ( + )} );