- Linting... Prettier...

This commit is contained in:
2019-08-07 01:59:10 -04:00
parent 3dc8589fb4
commit 847c9b192a
102 changed files with 2161 additions and 2109 deletions

View File

@@ -5,7 +5,10 @@ import { fetchEvents } from '../../actions/events.js';
import AppHeader from './AppHeader.js';
const matchDispatchToProps = (dispatch) => ({
fetchEvents: () => dispatch(fetchEvents()),
fetchEvents: () => dispatch(fetchEvents()),
});
export default connect(null, matchDispatchToProps)(AppHeader);
export default connect(
null,
matchDispatchToProps,
)(AppHeader);

View File

@@ -10,27 +10,26 @@ import HeaderContentRight from './HeaderContentRight.container.js';
import styles from './AppHeader.styles.js';
export default class AppHeader extends Component {
static get propTypes() {
return {
fetchEvents: PropTypes.func.isRequired,
};
}
static get propTypes() {
return {
fetchEvents: PropTypes.func.isRequired,
};
}
componentDidMount() {
this.props.fetchEvents();
}
componentDidMount() {
this.props.fetchEvents();
}
render() {
const { navigation } = this.props;
render () {
const { navigation } = this.props;
return (
<Header
placement="left"
leftComponent={<HeaderContentRight navigation={navigation} />}
centerComponent={<HeaderTitle navigation={navigation} />}
rightComponent={<HeaderContentLeft navigation={navigation} />}
/>
);
}
return (
<Header
placement="left"
leftComponent={<HeaderContentRight navigation={navigation} />}
centerComponent={<HeaderTitle navigation={navigation} />}
rightComponent={<HeaderContentLeft navigation={navigation} />}
/>
);
}
}

View File

@@ -5,12 +5,15 @@ import { hasMultipleEvents } from '../../selectors/events.js';
import HeaderContentLeft from './HeaderContentLeft.js';
const matchStateToProps = (state, ownProps) => {
const { routeName } = ownProps.navigation.state;
const { routeName } = ownProps.navigation.state;
return {
activeRoute: routeName,
hasMultipleEvents: hasMultipleEvents(state),
};
return {
activeRoute: routeName,
hasMultipleEvents: hasMultipleEvents(state),
};
};
export default connect(matchStateToProps, null)(HeaderContentLeft);
export default connect(
matchStateToProps,
null,
)(HeaderContentLeft);

View File

@@ -1,53 +1,43 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
Text,
TouchableOpacity,
View,
} from 'react-native';
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, hasMultipleEvents, navigation }) {
const _goBack = () => {
if (hasActiveEvent) {
navigation.goBack();
return false;
}
const _goBack = () => {
if (hasActiveEvent) {
navigation.goBack();
return false;
console.log('nowhere to go...');
};
const _showEvents = () => {
navigation.navigate('Events');
return false;
};
if (activeRoute === 'Events') {
return <EventsIcon action={_goBack} />;
}
console.log('nowhere to go...');
};
if (activeRoute === 'Profile') {
return <BackIcon action={_goBack} />;
}
const _showEvents = () => {
navigation.navigate('Events');
return false;
};
if (activeRoute === 'Events') {
return <EventsIcon action={_goBack} />;
}
if (activeRoute === 'Profile') {
return <BackIcon action={_goBack} />;
}
return <EventsIcon action={hasMultipleEvents ? _showEvents : null} />
return <EventsIcon action={hasMultipleEvents ? _showEvents : null} />;
}
HeaderContentLeft.propTypes = {
activeRoute: PropTypes.string.isRequired,
hasActiveEvent: PropTypes.bool,
navigation: PropTypes.func.isRequired,
activeRoute: PropTypes.string.isRequired,
hasActiveEvent: PropTypes.bool,
navigation: PropTypes.func.isRequired,
};
HeaderContentLeft.defaultProps = {
hasActiveEvent: false,
hasActiveEvent: false,
};

View File

@@ -5,8 +5,11 @@ import { getProfileAvatarUrl } from '../../selectors/profile.js';
import HeaderContentRight from './HeaderContentRight.js';
const matchStateToProps = (state, ownProps) => ({
avatarUrl: getProfileAvatarUrl(state),
hideUserProfileButton: ownProps.navigation.state.routeName === 'Profile',
avatarUrl: getProfileAvatarUrl(state),
hideUserProfileButton: ownProps.navigation.state.routeName === 'Profile',
});
export default connect(matchStateToProps, null)(HeaderContentRight);
export default connect(
matchStateToProps,
null,
)(HeaderContentRight);

View File

@@ -4,14 +4,13 @@ import PropTypes from 'prop-types';
import UserProfileButton from './UserProfileButton/UserProfileButton.container.js';
export default function HeaderContentRight({ hideUserProfileButton, navigation }) {
if (hideUserProfileButton) {
return null;
}
if (hideUserProfileButton) {
return null;
}
return <UserProfileButton />;
return <UserProfileButton />;
}
HeaderContentRight.propTypes = {
hideUserProfileButton: PropTypes.bool.isRequired,
hideUserProfileButton: PropTypes.bool.isRequired,
};

View File

@@ -5,14 +5,17 @@ import { getActiveEvent, getDefaultEvent } from '../../../../selectors/events.js
import EventTitle from './EventTitle.js';
const matchStateToProps = (state) => {
const event = hasActiveEvent(state) ? getActiveEvent(state) : getDefaultEvent(state);
const event = hasActiveEvent(state) ? getActiveEvent(state) : getDefaultEvent(state);
return {
date: event.get('date'),
end: event.get('end'),
name: event.get('name'),
start: event.get('start'),
};
return {
date: event.get('date'),
end: event.get('end'),
name: event.get('name'),
start: event.get('start'),
};
};
export default connect(matchStateToProps, null)(EventTitle);
export default connect(
matchStateToProps,
null,
)(EventTitle);

View File

@@ -1,43 +1,33 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
Text,
TouchableOpacity,
View,
} from 'react-native';
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>
);
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>
);
if (action) {
return <TouchableOpacity onPress={action}>{_generateEventTitle()}</TouchableOpacity>;
}
if (action) {
return <TouchableOpacity onPress={action}>{_generateEventTitle()}</TouchableOpacity>;
}
return _generateEventTitle();
return _generateEventTitle();
}
EventTitle.propTypes = {
action: PropTypes.func,
date: PropTypes.string.isRequired,
end: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
start: PropTypes.string.isRequired,
action: PropTypes.func,
date: PropTypes.string.isRequired,
end: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
start: PropTypes.string.isRequired,
};
EventTitle.defaultProps = {
action: null,
action: null,
};

View File

@@ -1,14 +1,14 @@
import { StyleSheet } from 'react-native';
export const styles = StyleSheet.create({
eventInfo: {
flexDirection: 'row',
},
eventName: {
flex: 1,
fontWeight: 'bold',
},
eventDate: {
flex: 1,
},
});
export default (styles = StyleSheet.create({
eventInfo: {
flexDirection: 'row',
},
eventName: {
flex: 1,
fontWeight: 'bold',
},
eventDate: {
flex: 1,
},
}));

View File

@@ -6,13 +6,16 @@ import { hasMultipleEvents } from '../../../selectors/events.js';
import HeaderTitle from './HeaderTitle.js';
const matchStateToProps = (state, ownProps) => {
const { routeName } = ownProps.navigation.state;
const { routeName } = ownProps.navigation.state;
return {
activeRoute: routeName,
hasActiveEvent: hasActiveEvent(state),
hasMultipleEvents: hasMultipleEvents(state),
};
return {
activeRoute: routeName,
hasActiveEvent: hasActiveEvent(state),
hasMultipleEvents: hasMultipleEvents(state),
};
};
export default connect(matchStateToProps, null)(HeaderTitle);
export default connect(
matchStateToProps,
null,
)(HeaderTitle);

View File

@@ -1,60 +1,54 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
Text,
TouchableOpacity,
View,
} from 'react-native';
import { Text, TouchableOpacity, View } from 'react-native';
import EventTitle from './EventTitle/EventTitle.container.js';
import styles from './HeaderTitle.styles.js';
export default function HeaderTitle({
activeRoute,
hasActiveEvent,
hasMultipleEvents,
navigation,
activeRoute,
hasActiveEvent,
hasMultipleEvents,
navigation,
}) {
const _goBack = () => {
if (hasActiveEvent) {
navigation.goBack();
return false;
}
const _goBack = () => {
if (hasActiveEvent) {
navigation.goBack();
return false;
console.log('nowhere to go...');
};
const _showEvents = () => {
navigation.navigate('Events');
return false;
};
if (activeRoute === 'Events') {
return (
<TouchableOpacity onPress={_goBack}>
<Text style={styles.screenHeader}>Profile</Text>
</TouchableOpacity>
);
}
console.log('nowhere to go...');
};
if (activeRoute === 'Profile') {
return <Text style={styles.screenHeader}>Profile</Text>;
}
const _showEvents = () => {
navigation.navigate('Events');
return false;
};
if (activeRoute === 'Events') {
return (
<TouchableOpacity onPress={_goBack}>
<Text style={styles.screenHeader}>Profile</Text>
</TouchableOpacity>
);
}
if (activeRoute === 'Profile') {
return <Text style={styles.screenHeader}>Profile</Text>;
}
return <EventTitle action={hasMultipleEvents ? _showEvents : null} />
return <EventTitle action={hasMultipleEvents ? _showEvents : null} />;
}
HeaderTitle.propTypes = {
activeRoute: PropTypes.string.isRequired,
hasActiveEvent: PropTypes.bool,
hasMultipleEvents: PropTypes.bool.isRequired,
navigation: PropTypes.func.isRequired,
activeRoute: PropTypes.string.isRequired,
hasActiveEvent: PropTypes.bool,
hasMultipleEvents: PropTypes.bool.isRequired,
navigation: PropTypes.func.isRequired,
};
HeaderTitle.defaultProps = {
hasActiveEvent: false,
hasActiveEvent: false,
};

View File

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

View File

@@ -5,13 +5,13 @@ import { TouchableOpacity } from 'react-native';
import { Icon } from 'react-native-elements';
export default function BackIcon({ action }) {
return (
<TouchableOpacity onPress={action}>
<Icon name="ei-chevron-left" type="evilicons" size={28} />;
</TouchableOpacity>
);
return (
<TouchableOpacity onPress={action}>
<Icon name="ei-chevron-left" type="evilicons" size={28} />;
</TouchableOpacity>
);
}
BackIcon.propTypes = {
action: PropTypes.func.isRequired,
action: PropTypes.func.isRequired,
};

View File

@@ -5,20 +5,19 @@ 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="ei-calendar" type="evilicons" size={28} />;
if (action) {
return <TouchableOpacity onPress={action}>{renderEventsIcon()}</TouchableOpacity>;
}
if (action) {
return <TouchableOpacity onPress={action}>{renderEventsIcon()}</TouchableOpacity>;
}
return renderEventsIcon();
return renderEventsIcon();
}
EventsIcon.propTypes = {
action: PropTypes.func,
action: PropTypes.func,
};
EventsIcon.defaultProps = {
action: null,
action: null,
};

View File

@@ -5,7 +5,10 @@ import { getProfileAvatarUrl } from '../../../selectors/profile.js';
import UserProfileButton from './UserProfileButton.js';
const matchStateToProps = (state) => ({
avatarUrl: getProfileAvatarUrl(state),
avatarUrl: getProfileAvatarUrl(state),
});
export default connect(matchStateToProps, null)(UserProfileButton);
export default connect(
matchStateToProps,
null,
)(UserProfileButton);

View File

@@ -7,29 +7,28 @@ import { Icon } from 'react-native-elements';
import styles from './UserProfileButton.styles.js';
export default function UserProfileButton({ avatarUrl, navigation }) {
const _goToProfile = () => {
navigation.navigate('Profile');
return false;
};
const _goToProfile = () => {
navigation.navigate('Profile');
return false;
};
return (
<TouchableOpacity onPress={_goToProfile}>
{avatarUrl !== null ? (
<View style={styles.avatarWrap}>
<Image source={{ uri: avatarUrl }} />
</View>
) : (
<Icon name="ei-user" type="evilicons" size={28} />
)}
</TouchableOpacity>
);
return (
<TouchableOpacity onPress={_goToProfile}>
{avatarUrl !== null ? (
<View style={styles.avatarWrap}>
<Image source={{ uri: avatarUrl }} />
</View>
) : (
<Icon name="ei-user" type="evilicons" size={28} />
)}
</TouchableOpacity>
);
}
UserProfileButton.propTypes = {
avatarUrl: PropTypes.string,
avatarUrl: PropTypes.string,
};
UserProfileButton.propTypes = {
avatarUrl: null,
avatarUrl: null,
};