From e6a4eeaeb15577e6d3fdf7ed159bf788a17b8afc Mon Sep 17 00:00:00 2001 From: Mike Fitzpatrick Date: Fri, 9 Aug 2019 02:01:39 -0400 Subject: [PATCH] - more tweaks and fixes.... still not running --- app/actions/auctionStatus.js | 2 +- .../UserProfileButton/UserProfileButton.js | 2 +- .../Profile/EditProfile.container.js | 4 ++-- app/components/Profile/EditProfile.js | 2 +- app/components/Profile/Profile.container.js | 19 ++----------------- app/components/Profile/Profile.stateProps.js | 15 +++++++++++++++ .../Profile/ViewProfile.container.js | 4 ++-- app/screens/Events.container.js | 7 +++---- app/screens/Events.js | 16 +++++++--------- 9 files changed, 34 insertions(+), 37 deletions(-) create mode 100644 app/components/Profile/Profile.stateProps.js diff --git a/app/actions/auctionStatus.js b/app/actions/auctionStatus.js index c3df807..b0e1616 100644 --- a/app/actions/auctionStatus.js +++ b/app/actions/auctionStatus.js @@ -1,6 +1,6 @@ import { List } from 'immutable'; -import { fetchAuctionStatus as fetchActionStatusApi } from '../api/actionStatus.js'; +import { fetchAuctionStatus as fetchActionStatusApi } from '../api/auctionStatus.js'; import { AUCTIONS_UPDATED } from '../constants/actionTypes.js'; import { getActiveEventId } from '../selectors/activeEvent.js'; import { getAuthToken } from '../selectors/auth.js'; diff --git a/app/components/AppHeader/UserProfileButton/UserProfileButton.js b/app/components/AppHeader/UserProfileButton/UserProfileButton.js index d422310..ce99358 100644 --- a/app/components/AppHeader/UserProfileButton/UserProfileButton.js +++ b/app/components/AppHeader/UserProfileButton/UserProfileButton.js @@ -38,7 +38,7 @@ UserProfileButton.propTypes = { isRegisteredAccount: PropTypes.bool, }; -UserProfileButton.propTypes = { +UserProfileButton.defaultProps = { avatarUrl: null, initials: null, isRegisteredAccount: false, diff --git a/app/components/Profile/EditProfile.container.js b/app/components/Profile/EditProfile.container.js index e109147..1ab0a64 100644 --- a/app/components/Profile/EditProfile.container.js +++ b/app/components/Profile/EditProfile.container.js @@ -1,11 +1,11 @@ import { connect } from 'react-redux'; import { getProfile } from '../../selectors/profile.js'; -import { commonProfileStateToProps } from './Profile.container.js'; +import { matchStateToProps as matchCommonStateProps } from './Profile.stateProps.js'; import EditProfile from './EditProfile.js'; const matchStateToProps = (state) => { - const commonProps = commonProfileStateToProps(state); + const commonProps = matchCommonStateProps(state); const profile = getProfile(state); return { diff --git a/app/components/Profile/EditProfile.js b/app/components/Profile/EditProfile.js index 9c0a3d4..42997c5 100644 --- a/app/components/Profile/EditProfile.js +++ b/app/components/Profile/EditProfile.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { Button, Text, TextInput, View } from 'react-native'; import { Avatar } from 'react-native-elements'; -import { getEmailAvailability, getNomAvailability } from '../api/profile.js'; +import { getEmailAvailability, getNomAvailability } from '../../api/profile.js'; import EditNomDeBid from './EditNomDeBid.js'; import styles from './Profile.styles.js'; diff --git a/app/components/Profile/Profile.container.js b/app/components/Profile/Profile.container.js index 694cb6d..b93dadf 100644 --- a/app/components/Profile/Profile.container.js +++ b/app/components/Profile/Profile.container.js @@ -1,24 +1,9 @@ import { connect } from 'react-redux'; -import { getProfile, isGeneratedNomDeBid } from '../selectors/profile.js'; - +import { matchStateToProps } from './Profile.stateProps.js'; import Profile from './Profile.js'; -export const commonProfileStateToProps = (state) => { - const profile = getProfile(state); - - return { - addresses: profile.get('addresses').toArray(), - avatar: profile.get('avatar'), - email: profile.get('email'), - initials: profile.get('initials'), - isGeneratedNomDeBid: isGeneratedNomDeBid(state), - nomDeBid: profile.get('nomDeBid'), - phones: profile.get('phones'), - }; -}; - export default connect( - commonProfileStateToProps, + matchStateToProps, null, )(Profile); diff --git a/app/components/Profile/Profile.stateProps.js b/app/components/Profile/Profile.stateProps.js new file mode 100644 index 0000000..cdcb45e --- /dev/null +++ b/app/components/Profile/Profile.stateProps.js @@ -0,0 +1,15 @@ +import { getProfile, isGeneratedNomDeBid } from '../../selectors/profile.js'; + +export const matchStateToProps = (state) => { + const profile = getProfile(state); + + return { + addresses: profile.get('addresses').toArray(), + avatar: profile.get('avatar'), + email: profile.get('email'), + initials: profile.get('initials'), + isGeneratedNomDeBid: isGeneratedNomDeBid(state), + nomDeBid: profile.get('nomDeBid'), + phones: profile.get('phones'), + }; +}; diff --git a/app/components/Profile/ViewProfile.container.js b/app/components/Profile/ViewProfile.container.js index 474addd..4d1b9d3 100644 --- a/app/components/Profile/ViewProfile.container.js +++ b/app/components/Profile/ViewProfile.container.js @@ -1,13 +1,13 @@ import { connect } from 'react-redux'; import { getProfile } from '../../selectors/profile.js'; -import { commonProfileStateToProps } from './Profile.container.js'; +import { matchStateToProps as matchCommonStateProps } from './Profile.stateProps.js'; import { isRegisteredAccount } from '../../selectors/profile.js'; import ViewProfile from './ViewProfile.js'; const matchStateToProps = (state) => { - const commonProps = commonProfileStateToProps(state); + const commonProps = matchCommonStateProps(state); const profile = getProfile(state); return { diff --git a/app/screens/Events.container.js b/app/screens/Events.container.js index 06301e2..6440073 100644 --- a/app/screens/Events.container.js +++ b/app/screens/Events.container.js @@ -6,10 +6,9 @@ import { getEventsAsList } from '../selectors/events.js'; import Events from './Events.js'; -const matchStateToProps = (state) => { - const events = getEventsAsList(state); - return { events }; -}; +const matchStateToProps = (state) => ({ + events: getEventsAsList(state), +}); const mapDispatchToProps = (dispatch) => ({ fetchEvents: () => dispatch(fetchEvents()), diff --git a/app/screens/Events.js b/app/screens/Events.js index e269038..2cf008a 100644 --- a/app/screens/Events.js +++ b/app/screens/Events.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { FlatList, StyleSheet, View } from 'react-native'; -import EventListItem from '../components/Events/EventListItem.js'; +import EventListItem from '../containers/Events/EventListItem.js'; export default class Events extends Component { static get propTypes() { @@ -17,20 +17,15 @@ export default class Events extends Component { static get defaultProps() { return { - events: new List(), + events: [], }; } constructor(props) { super(props); - this._setActiveEvent = this.setActiveEvent.bind(this); } - componentDidMount() { - this.props.fetchEvents(); - } - setActiveEvent(eventId) { this.props.setActiveEvent(eventId); } @@ -38,7 +33,7 @@ export default class Events extends Component { _keyExtractor = (event, index) => `${event.id}_${index}`; _renderEventListItem = ({ event }) => ( - + ); render() { @@ -67,5 +62,8 @@ const styles = StyleSheet.create({ alignItems: 'center', backgroundColor: '#F5FCFF', }, - eventListContentContainer: {}, + eventListContentContainer: { + alignItems: 'stretch', + justifyContent: 'flex-start', + }, });