Merge branch 'feature/PROFILE_-_Registration' of honey.fitz.guru:eventment-app into feature/PROFILE_-_Registration

# Conflicts:
#	app/components/AppHeader/HeaderContentLeft.js
#	app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.js
This commit is contained in:
2019-08-08 20:58:01 -04:00
44 changed files with 432 additions and 242 deletions

View File

@@ -4,7 +4,12 @@ import PropTypes from 'prop-types';
import BackIcon from './IconButtons/BackIcon.js';
import EventsIcon from './IconButtons/EventsIcon.js';
export default function HeaderContentLeft({ activeRoute, hasMultipleEvents, navigation }) {
export default function HeaderContentLeft({
activeRoute,
hasActiveEvent,
hasMultipleEvents,
navigation,
}) {
const _goBack = () => {
if (hasActiveEvent) {
navigation.goBack();
@@ -32,10 +37,12 @@ export default function HeaderContentLeft({ activeRoute, hasMultipleEvents, navi
HeaderContentLeft.propTypes = {
activeRoute: PropTypes.string.isRequired,
hasActiveEvent: PropTypes.bool,
hasMultipleEvents: PropTypes.bool,
navigation: PropTypes.func.isRequired,
};
HeaderContentLeft.defaultProps = {
hasActiveEvent: false,
hasMultipleEvents: false,
};

View File

@@ -6,7 +6,9 @@ import HeaderContentRight from './HeaderContentRight.js';
const matchStateToProps = (state, ownProps) => ({
avatarUrl: getProfileAvatarUrl(state),
hideUserProfileButton: ownProps.navigation.state.routeName === 'Profile',
hideUserProfileButton:
['Profile', 'Register', 'SignInOrRegister'].indexOf(ownProps.navigation.state.routeName) >
-1,
});
export default connect(

View File

@@ -6,15 +6,16 @@ import { Text, TouchableOpacity, View } from 'react-native';
import styles from './EventTitle.styles.js';
export default function EventTitle({ action, date, end, name, start }) {
const _generateEventTitle = () => {
const whenString = `${date} | ${start} - ${end}`;
const whenString = `${date} | ${start} - ${end}`;
const _generateEventTitle = () => (
<View style={styles.eventInfo}>
<Text style={styles.eventName}>{name}</Text>
<Text style={styles.eventDate}>{whenString}</Text>
</View>
);
return (
<View style={styles.eventInfo}>
<Text style={styles.eventName}>{name}</Text>
<Text style={styles.eventDate}>{whenString}</Text>
</View>
);
};
if (action) {
return <TouchableOpacity onPress={action}>{_generateEventTitle()}</TouchableOpacity>;

View File

@@ -1,11 +1,17 @@
import { connect } from 'react-redux';
import { getProfileAvatarUrl } from '../../../selectors/profile.js';
import {
getProfileAvatarUrl,
getUserInitials,
isRegisteredAccount,
} from '../../../selectors/profile.js';
import UserProfileButton from './UserProfileButton.js';
const matchStateToProps = (state) => ({
avatarUrl: getProfileAvatarUrl(state),
initials: getUserInitials(state),
isRegisteredAccount: isRegisteredAccount(state),
});
export default connect(

View File

@@ -2,11 +2,16 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Image, TouchableOpacity, View } from 'react-native';
import { Icon } from 'react-native-elements';
import { Avatar, Icon } from 'react-native-elements';
import styles from './UserProfileButton.styles.js';
export default function UserProfileButton({ avatarUrl, navigation }) {
export default function UserProfileButton({
avatarUrl,
initials,
isRegisteredAccount,
navigation,
}) {
const _goToProfile = () => {
navigation.navigate('Profile');
return false;
@@ -14,10 +19,12 @@ export default function UserProfileButton({ avatarUrl, navigation }) {
return (
<TouchableOpacity onPress={_goToProfile}>
{avatarUrl !== null ? (
<View style={styles.avatarWrap}>
<Image source={{ uri: avatarUrl }} />
</View>
{isRegisteredAccount !== null ? (
avatarUrl !== null ? (
<Avatar source={{ uri: avatarUrl }} />
) : (
<Avatar title={initials} />
)
) : (
<Icon name="ei-user" type="evilicons" size={28} />
)}
@@ -27,8 +34,12 @@ export default function UserProfileButton({ avatarUrl, navigation }) {
UserProfileButton.propTypes = {
avatarUrl: PropTypes.string,
initials: PropTypes.string,
isRegisteredAccount: PropTypes.bool,
};
UserProfileButton.propTypes = {
avatarUrl: null,
initials: null,
isRegisteredAccount: false,
};