- The fix is in! Linty fresh and pretty...

This commit is contained in:
Mike Fitzpatrick
2019-08-08 16:18:08 -04:00
parent dfc4daf696
commit ebb6f47455
52 changed files with 453 additions and 259 deletions

View File

@@ -7,8 +7,6 @@ import HeaderTitle from './HeaderTitle/HeaderTitle.container.js';
import HeaderContentLeft from './HeaderContentLeft.container.js';
import HeaderContentRight from './HeaderContentRight.container.js';
import styles from './AppHeader.styles.js';
export default class AppHeader extends Component {
static get propTypes() {
return {

View File

@@ -1,12 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Text, TouchableOpacity, View } from 'react-native';
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();
@@ -35,9 +38,11 @@ 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

@@ -1,5 +1,6 @@
import { connect } from 'react-redux';
import { hasActiveEvent } from '../../../../selectors/activeEvent.js';
import { getActiveEvent, getDefaultEvent } from '../../../../selectors/events.js';
import EventTitle from './EventTitle.js';

View File

@@ -6,12 +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 = () => (
<View style={styles.eventInfo}>
<Text style={styles.eventName}>{name}</Text>
<Text style={styles.eventDate}>{`${date} | ${start} - ${end}`}</Text>
</View>
);
const _generateEventTitle = () => {
const whenString = `${date} | ${start} - ${end}`;
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,6 +1,6 @@
import { StyleSheet } from 'react-native';
export default (styles = StyleSheet.create({
export default StyleSheet.create({
eventInfo: {
flexDirection: 'row',
},
@@ -11,4 +11,4 @@ export default (styles = StyleSheet.create({
eventDate: {
flex: 1,
},
}));
});

View File

@@ -7,6 +7,10 @@ import EventTitle from './EventTitle/EventTitle.container.js';
import styles from './HeaderTitle.styles.js';
const STRINGS = {
PROFILE: 'Profile',
};
export default function HeaderTitle({
activeRoute,
hasActiveEvent,
@@ -30,13 +34,13 @@ export default function HeaderTitle({
if (activeRoute === 'Events') {
return (
<TouchableOpacity onPress={_goBack}>
<Text style={styles.screenHeader}>Profile</Text>
<Text style={styles.screenHeader}>{STRINGS.PROFILE}</Text>
</TouchableOpacity>
);
}
if (activeRoute === 'Profile') {
return <Text style={styles.screenHeader}>Profile</Text>;
return <Text style={styles.screenHeader}>{STRINGS.PROFILE}</Text>;
}
return <EventTitle action={hasMultipleEvents ? _showEvents : null} />;

View File

@@ -1,6 +1,6 @@
import { StyleSheet } from 'react-native';
export default (styles = StyleSheet.create({
export default StyleSheet.create({
filterBar: {
backgroundColor: '#0F0',
flexDirection: 'row',
@@ -11,4 +11,4 @@ export default (styles = StyleSheet.create({
view: {
flex: 2,
},
}));
});

View File

@@ -7,7 +7,7 @@ import { Icon } from 'react-native-elements';
export default function BackIcon({ action }) {
return (
<TouchableOpacity onPress={action}>
<Icon name="ei-chevron-left" type="evilicons" size={28} />;
<Icon name="ei-chevron-left" type="evilicons" size={28} />
</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,
};