- 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

@@ -8,16 +8,19 @@ import { getAuctionItemsAsList } from '../selectors/items.js';
import Auction from './Auction.js';
const matchStateToProps = (state) => {
const items = getAuctionItemsAsList(state);
console.log('items:', items);
const items = getAuctionItemsAsList(state);
console.log('items:', items);
return { items };
return { items };
};
const mapDispatchToProps = (dispatch) => ({
changeViewMode: (mode) => dispatch(changeViewMode(mode)),
fetchItems: () => dispatch(fetchItems(dispatch)),
fetchStatus: () => dispatch(fetchAuctionStatus(dispatch)),
changeViewMode: (mode) => dispatch(changeViewMode(mode)),
fetchItems: () => dispatch(fetchItems(dispatch)),
fetchStatus: () => dispatch(fetchAuctionStatus(dispatch)),
});
export default connect(matchStateToProps, mapDispatchToProps)(Auction);
export default connect(
matchStateToProps,
mapDispatchToProps,
)(Auction);

View File

@@ -2,11 +2,7 @@ import { List } from 'immutable';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
FlatList,
Text,
View,
} from 'react-native';
import { FlatList, Text, View } from 'react-native';
import { SORT_MODES, AUCTION_VIEW_MODES } from '../constants/constants.js';
@@ -16,70 +12,74 @@ import AuctionListItem from '../containers/Auction/AuctionListItem.js';
import styles from './Auction.styles.js';
export default class Auction extends Component {
static get propTypes() {
return {
changeFilter: PropTypes.func,
changeViewMode: PropTypes.func.isRequired,
fetchItems: PropTypes.func.isRequired,
fetchStatus: PropTypes.func.isRequired,
items: PropTypes.oneOfType([
PropTypes.array,
PropTypes.instanceOf(List),
]),
};
}
static get propTypes() {
return {
changeFilter: PropTypes.func,
changeViewMode: PropTypes.func.isRequired,
fetchItems: PropTypes.func.isRequired,
fetchStatus: PropTypes.func.isRequired,
items: PropTypes.oneOfType([PropTypes.array, PropTypes.instanceOf(List)]),
};
}
static get defaultProps() {
return {
changeFilter: () => { console.log('Change Filter Default Prop', arguments); },
items: [],
};
}
static get defaultProps() {
return {
changeFilter: () => {
console.log('Change Filter Default Prop', arguments);
},
items: [],
};
}
constructor(props) {
super(props);
constructor(props) {
super(props);
this.changeFilter = this.changeFilter.bind(this);
this.changeViewMode = this.changeViewMode.bind(this);
this.changeFilter = this.changeFilter.bind(this);
this.changeViewMode = this.changeViewMode.bind(this);
this.state = {
sort: SORT_MODES.TITLE_ASC,
view: AUCTION_VIEW_MODES.ALL,
};
}
this.state = {
sort: SORT_MODES.TITLE_ASC,
view: AUCTION_VIEW_MODES.ALL,
};
}
componentDidMount() {
this.props.fetchStatus();
this.props.fetchItems();
}
componentDidMount() {
this.props.fetchStatus();
this.props.fetchItems();
}
changeFilter(filter) {
this.props.changeFilter('auction', filter);
}
changeFilter(filter) {
this.props.changeFilter('auction', filter);
}
_keyExtractor = (item, index) => `${item._id}_${index}`;
changeViewMode(viewMode) {
this.props.changeViewMode(viewMode);
}
_renderAuctionListItem = ({ item }) => <AuctionListItem item={item} />;
_keyExtractor = (item, index) => `${item.id}_${index}`;
render() {
const { items } = this.props;
const { sort, view } = this.state;
_renderAuctionListItem = ({ item }) => <AuctionListItem item={item} />;
return (
<View style={styles.container}>
<FilterBar
changeFilterer={this.changeFilter}
/>
{items.size > 0 && (
<FlatList
data={items}
keyExtractor={this._keyExtractor}
renderItem={this._renderAuctionListItem}
contentContainerStyle={styles.itemListContentContainer}
style={styles.itemList}
/>
)}
</View>
);
}
render() {
const { items } = this.props;
const { sort, view } = this.state;
return (
<View style={styles.container}>
<FilterBar
changeFilterer={this.changeFilter}
changeViewMode={this.changeViewMode}
/>
{items.size > 0 && (
<FlatList
data={items}
keyExtractor={this._keyExtractor}
renderItem={this._renderAuctionListItem}
contentContainerStyle={styles.itemListContentContainer}
style={styles.itemList}
/>
)}
</View>
);
}
}

View File

@@ -1,17 +1,17 @@
import { StyleSheet } from 'react-native';
export const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
itemList: {
width: '100%',
},
itemListContentContainer: {
alignItems: 'stretch',
justifyContent: 'flex-start',
},
});
export default (styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
itemList: {
width: '100%',
},
itemListContentContainer: {
alignItems: 'stretch',
justifyContent: 'flex-start',
},
}));

View File

@@ -1,32 +1,26 @@
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
export default class Checkout extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>
Checkout
</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Checkout</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});

View File

@@ -7,30 +7,33 @@ import { getActiveEvent, getDefaultEvent } from '../selectors/events.js';
import Event from './Event.js';
const matchStateToProps = (state) => {
const event = getActiveEvent(state) || getDefaultEvent(state) || new EventRecord();
const event = getActiveEvent(state) || getDefaultEvent(state) || new EventRecord();
if (!event) {
return {};
}
if (!event) {
return {};
}
return {
description: event.get('description'),
endTime: event.get('endTime'),
id: event.get('id'),
images: event.get('images').toArray(),
isTicketed: event.get('isTicketed'),
posts: event.get('posts').toArray(),
requireLoginToSeeAuction: event.get('requireLoginToSeeAuction'),
showFrom: event.get('showFrom'),
showUntil: event.get('showUntil'),
startTime: event.get('startTime'),
tagline: event.get('tagline'),
ticketClasses: event.get('ticketClasses').toArray(),
title: event.get('title'),
url: event.get('url'),
};
return {
description: event.get('description'),
endTime: event.get('endTime'),
id: event.get('id'),
images: event.get('images').toArray(),
isTicketed: event.get('isTicketed'),
posts: event.get('posts').toArray(),
requireLoginToSeeAuction: event.get('requireLoginToSeeAuction'),
showFrom: event.get('showFrom'),
showUntil: event.get('showUntil'),
startTime: event.get('startTime'),
tagline: event.get('tagline'),
ticketClasses: event.get('ticketClasses').toArray(),
title: event.get('title'),
url: event.get('url'),
};
};
const mapDispatchToProps = (dispatch) => ({});
export default connect(matchStateToProps, mapDispatchToProps)(Event);
export default connect(
matchStateToProps,
mapDispatchToProps,
)(Event);

View File

@@ -5,82 +5,76 @@ import { Text, View } from 'react-native';
import styles from './Event.styles.js';
export default class Event extends Component {
static get propTypes() {
return {
description: PropTypes.string,
endTime: PropTypes.string,
id: PropTypes.string,
images: PropTypes.arrayOf(
PropTypes.shape({
url: PropTypes.string,
}),
),
isTicketed: PropTypes.bool,
posts: PropTypes.arrayOf(
PropTypes.shape({
author: PropTypes.string,
content: PropTypes.string,
id: PropTypes.string,
isPublic: PropTypes.bool,
scheduledPost: PropTypes.bool,
sendNotification: PropTypes.bool,
timestamp: PropTypes.string,
title: PropTypes.string,
}),
),
requireLoginToSeeAuction: PropTypes.bool,
showFrom: PropTypes.string,
showUntil: PropTypes.string,
startTime: PropTypes.string,
tagline: PropTypes.string,
ticketClasses: PropTypes.arrayOf(
PropTypes.shape({
static get propTypes() {
return {
description: PropTypes.string,
endTime: PropTypes.string,
id: PropTypes.string,
images: PropTypes.arrayOf(
PropTypes.shape({
url: PropTypes.string,
}),
),
isTicketed: PropTypes.bool,
posts: PropTypes.arrayOf(
PropTypes.shape({
author: PropTypes.string,
content: PropTypes.string,
id: PropTypes.string,
isPublic: PropTypes.bool,
scheduledPost: PropTypes.bool,
sendNotification: PropTypes.bool,
timestamp: PropTypes.string,
title: PropTypes.string,
}),
),
requireLoginToSeeAuction: PropTypes.bool,
showFrom: PropTypes.string,
showUntil: PropTypes.string,
startTime: PropTypes.string,
tagline: PropTypes.string,
ticketClasses: PropTypes.arrayOf(PropTypes.shape({})),
title: PropTypes.string,
url: PropTypes.string,
};
}
}),
),
title: PropTypes.string,
url: PropTypes.string,
};
}
static get defaultProps() {
return {
images: null,
isTicketed: false,
posts: null,
requireLoginToSeeAuction: false,
tagline: null,
ticketClasses: null,
url: null,
};
}
static get defaultProps() {
return {
images: null,
isTicketed: false,
posts: null,
requireLoginToSeeAuction: false,
tagline: null,
ticketClasses: null,
url: null,
};
}
constructor(props) {
super(props);
}
constructor(props) {
super(props);
}
render() {
const {
description,
endTime,
images,
isTicketed,
requireLoginToSeeAuction,
showFrom,
showUntil,
startTime,
tagline,
ticketClasses,
title,
url,
} = this.props;
render() {
const {
description,
endTime,
images,
isTicketed,
requireLoginToSeeAuction,
showFrom,
showUntil,
startTime,
tagline,
ticketClasses,
title,
url,
} = this.props;
return (
<View style={styles.container}>
<Text style={styles.title}>
Event
</Text>
</View>
);
}
return (
<View style={styles.container}>
<Text style={styles.title}>Event</Text>
</View>
);
}
}

View File

@@ -1,17 +1,15 @@
import { StyleSheet } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
});
export default styles;
export default (styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
}));

View File

@@ -1,19 +1,22 @@
import { connect } from 'react-redux';
import { setActiveEvent } from '../actions/activeEvent.js';
import { fetchEvents } from '../actions/events.js';
import { getEventsAsList } from '../selectors/events.js';
import Events from './Events.js';
const matchStateToProps = (state) => {
const events = getEventsAsList(state);
console.log('events:', events);
return { events };
const events = getEventsAsList(state);
return { events };
};
const mapDispatchToProps = (dispatch) => ({
fetchEvents: () => dispatch(fetchEvents(dispatch)),
fetchEvents: () => dispatch(fetchEvents()),
setActiveEvent: (eventId) => dispatch(setActiveEvent(eventId)),
});
export default connect(matchStateToProps, mapDispatchToProps)(Events);
export default connect(
matchStateToProps,
mapDispatchToProps,
)(Events);

View File

@@ -1,58 +1,71 @@
import { List } from 'immutable';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import { FlatList, StyleSheet, Text, View } from 'react-native';
import EventListItem from '../components/Events/EventListItem.js';
export default class Events extends Component {
static get propTypes() {
return {
events: PropTypes.array.isRequired,
fetchEvents: PropTypes.func.isRequired,
};
}
static get propTypes() {
return {
events: PropTypes.instanceOf(List),
fetchEvents: PropTypes.func.isRequired,
setActiveEvent: PropTypes.func.isRequired,
};
}
constructor(props) {
super(props);
}
static get defaultProps() {
return {
events: new List(),
};
}
componentDidMount() {
this.props.fetchEvents();
}
constructor(props) {
super(props);
_keyExtractor = (event, index) => `${event._id}_${index}`;
this._setActiveEvent = this.setActiveEvent.bind(this);
}
_renderEventListItem = ({ event }) => <EventListItem event={event} />;
componentDidMount() {
this.props.fetchEvents();
}
render() {
const { events } = this.props;
setActiveEvent(eventId) {
this.props.setActiveEvent(eventId);
}
return (
<View style={styles.container}>
{events.size > 0 && (
<FlatList
data={events}
keyExtractor={this._keyExtractor}
renderItem={this._renderEventListItem}
contentContainerStyle={styles.eventListContentContainer}
style={styles.eventList}
/>
)}
</View>
_keyExtractor = (event, index) => `${event.id}_${index}`;
_renderEventListItem = ({ event }) => (
<EventListItem {...event} setActiveEvent={this.setActiveEvent} />
);
}
render() {
const { events } = this.props;
return (
<View style={styles.container}>
{events.size > 0 && (
<FlatList
data={events}
keyExtractor={this._keyExtractor}
renderItem={this._renderEventListItem}
contentContainerStyle={styles.eventListContentContainer}
style={styles.eventList}
/>
)}
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
eventListContentContainer: {
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
eventListContentContainer: {},
});

View File

@@ -1,32 +1,26 @@
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
export default class ImageDetail extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>
Item
</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Item</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});

View File

@@ -1,32 +1,26 @@
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
export default class Item extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>
Item
</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Item</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});

View File

@@ -1,32 +1,26 @@
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
export default class Login extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>
Login
</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Login</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});

View File

@@ -2,11 +2,7 @@ import { List } from 'immutable';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
FlatList,
Text,
View,
} from 'react-native';
import { FlatList, Text, View } from 'react-native';
import { SORT_MODES, AUCTION_VIEW_MODES } from '../constants/constants.js';
@@ -16,70 +12,67 @@ import AuctionListItem from '../containers/Auction/AuctionListItem.js';
//import styles from './Marketplace.styles.js';
export default class Marketplace extends Component {
static get propTypes() {
return {
changeFilter: PropTypes.func,
changeViewMode: PropTypes.func.isRequired,
fetchItems: PropTypes.func.isRequired,
fetchStatus: PropTypes.func.isRequired,
items: PropTypes.oneOfType([
PropTypes.array,
PropTypes.instanceOf(List),
]),
};
}
static get propTypes() {
return {
changeFilter: PropTypes.func,
changeViewMode: PropTypes.func.isRequired,
fetchItems: PropTypes.func.isRequired,
fetchStatus: PropTypes.func.isRequired,
items: PropTypes.oneOfType([PropTypes.array, PropTypes.instanceOf(List)]),
};
}
static get defaultProps() {
return {
changeFilter: () => { console.log('Change Filter Default Prop', arguments); },
items: [],
};
}
static get defaultProps() {
return {
changeFilter: () => {
console.log('Change Filter Default Prop', arguments);
},
items: [],
};
}
constructor(props) {
super(props);
constructor(props) {
super(props);
this.changeFilter = this.changeFilter.bind(this);
this.changeViewMode = this.changeViewMode.bind(this);
this.changeFilter = this.changeFilter.bind(this);
this.changeViewMode = this.changeViewMode.bind(this);
this.state = {
sort: SORT_MODES.TITLE_ASC,
view: AUCTION_VIEW_MODES.ALL,
};
}
this.state = {
sort: SORT_MODES.TITLE_ASC,
view: AUCTION_VIEW_MODES.ALL,
};
}
componentDidMount() {
this.props.fetchStatus();
this.props.fetchItems();
}
componentDidMount() {
this.props.fetchStatus();
this.props.fetchItems();
}
changeFilter(filter) {
this.props.changeFilter('auction', filter);
}
changeFilter(filter) {
this.props.changeFilter('auction', filter);
}
_keyExtractor = (item, index) => `${item._id}_${index}`;
_keyExtractor = (item, index) => `${item._id}_${index}`;
_renderAuctionListItem = ({ item }) => <AuctionListItem item={item} />;
_renderAuctionListItem = ({ item }) => <AuctionListItem item={item} />;
render() {
const { items } = this.props;
const { sort, view } = this.state;
render() {
const { items } = this.props;
const { sort, view } = this.state;
return (
<View style={styles.container}>
<FilterBar
changeFilterer={this.changeFilter}
/>
{items.size > 0 && (
<FlatList
data={items}
keyExtractor={this._keyExtractor}
renderItem={this._renderAuctionListItem}
contentContainerStyle={styles.itemListContentContainer}
style={styles.itemList}
/>
)}
</View>
);
}
return (
<View style={styles.container}>
<FilterBar changeFilterer={this.changeFilter} />
{items.size > 0 && (
<FlatList
data={items}
keyExtractor={this._keyExtractor}
renderItem={this._renderAuctionListItem}
contentContainerStyle={styles.itemListContentContainer}
style={styles.itemList}
/>
)}
</View>
);
}
}

View File

@@ -6,27 +6,30 @@ import { getNomDeBid, getProfile, isAllowedToBid } from '../selectors/profile.js
import Profile from './Profile.js';
const matchStateToProps = (state) => {
const profile = getProfile(state);
const profile = getProfile(state);
return {
hasLinkedApple: profile.get('hasLinkedApple'),
hasLinkedFacebook: profile.get('hasLinkedFacebook'),
hasLinkedGoogle: profile.get('hasLinkedGoogle'),
hasLocalAccount: profile.get('hasLocalAccount'),
hasRegisteredAcccount: profile.get('hasRegisteredAcccount'),
id: profile.get('id'),
isAllowedToBid: isAllowedToBid(state),
isVerified: profile.get('isVerified'),
lastName: profile.get('lastName'),
nomDeBid: getNomDeBid(state),
organizationIdentifier: profile.get('organizationIdentifier'),
paymentToken: profile.get('paymentToken'),
};
return {
hasLinkedApple: profile.get('hasLinkedApple'),
hasLinkedFacebook: profile.get('hasLinkedFacebook'),
hasLinkedGoogle: profile.get('hasLinkedGoogle'),
hasLocalAccount: profile.get('hasLocalAccount'),
hasRegisteredAcccount: profile.get('hasRegisteredAcccount'),
id: profile.get('id'),
isAllowedToBid: isAllowedToBid(state),
isVerified: profile.get('isVerified'),
lastName: profile.get('lastName'),
nomDeBid: getNomDeBid(state),
organizationIdentifier: profile.get('organizationIdentifier'),
paymentToken: profile.get('paymentToken'),
};
};
const mapDispatchToProps = (dispatch) => ({
fetchProfile: () => dispatch(fetchProfile(dispatch)),
updateProfile: () => dispatch(updateProfile(dispatch)),
fetchProfile: () => dispatch(fetchProfile(dispatch)),
updateProfile: () => dispatch(updateProfile(dispatch)),
});
export default connect(matchStateToProps, mapDispatchToProps)(Profile);
export default connect(
matchStateToProps,
mapDispatchToProps,
)(Profile);

View File

@@ -1,32 +1,26 @@
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
export default class Profile extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>
Profile
</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Profile</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});

View File

@@ -1,17 +1,16 @@
import { connect } from 'react-redux';
import {
checkEmailAvailability,
checkNomAvailability,
registerUser,
} from '../actions/profile.js';
import { checkEmailAvailability, checkNomAvailability, registerUser } from '../actions/profile.js';
import Register from './Register.js';
const mapDispatchToProps = (dispatch) => ({
checkEmail: (email) => dispatch(checkEmailAvailability(email)),
checkNomDeBid: (nomDeBid) => dispatch(checkNomAvailability(nomDeBid)),
doRegistration: (user) => dispatch(registerUser(user)),
checkEmail: (email) => dispatch(checkEmailAvailability(email)),
checkNomDeBid: (nomDeBid) => dispatch(checkNomAvailability(nomDeBid)),
doRegistration: (user) => dispatch(registerUser(user)),
});
export default connect(null, mapDispatchToProps)(Register);
export default connect(
null,
mapDispatchToProps,
)(Register);

View File

@@ -4,87 +4,95 @@ import { Text, View } from 'react-native';
import styles from './Register.styles.js';
export default class Register extends Component {
static get propTypes() {
return {
checkEmail: PropTypes.func.isRequired,
checkNomDeBid: PropTypes.func.isRequired,
doRegistration: PropTypes.func.isRequired,
// invalidEmail: PropTypes.bool.isRequired,
// invalidNomDeBid: PropTypes.bool.isRequired,
};
}
constructor() {
super(props);
this.state = {
addresses: [],
avatar: null,
email: null,
firstName: null,
lastName: null,
nomDeBid: null,
invalidEmail: false,
invalidNomDeBid: false,
password: null,
phones: [],
};
this._doRegistration = this._doRegistration.bind(this);
}
_doRegistration() {
if (!this.isFormComplete()) {
console.error('Incomplete form... how did the button become enabled?');
alert('Please complete all of the required fields. They have bold labels.');
return;
static get propTypes() {
return {
checkEmail: PropTypes.func.isRequired,
checkNomDeBid: PropTypes.func.isRequired,
doRegistration: PropTypes.func.isRequired,
// invalidEmail: PropTypes.bool.isRequired,
// invalidNomDeBid: PropTypes.bool.isRequired,
};
}
this.props.doRegistration(this.getUserRegistration());
}
constructor() {
super(props);
_validateEmail() {
this.props.checkEmail(this.state.email, (valid) => this.setState('invalidEmail', valid));
}
this.state = {
addresses: [],
avatar: null,
email: null,
firstName: null,
lastName: null,
nomDeBid: null,
invalidEmail: false,
invalidNomDeBid: false,
password: null,
phones: [],
};
_validateNomDeBid() {
this.props.checkNomDeBid(this.state.nomDeBid, (valid) => this.setState('invalidNomDeBid', valid));
}
this._doRegistration = this._doRegistration.bind(this);
}
getUserRegistration() {
return {
addresses: this.state.addresses,
avatar: this.state.avatar,
email: this.state.email,
firstName: this.state.firstName,
lastName: this.state.lastName,
nomDeBid: this.state.nomDeBid,
password: this.state.password,
phones: this.state.phones,
};
}
_doRegistration() {
if (!this.isFormComplete()) {
console.error('Incomplete form... how did the button become enabled?');
alert('Please complete all of the required fields. They have bold labels.');
return;
}
isFormComplete() {
return !this.state.invalidEmail && !this.state.invalidNomDeBid &&
!!this.state.firstName && !!this.state.lastName && !!this.state.email &&
!!this.state.nomDeBid && !!this.state.phones.length && !!this.state.password;
}
this.props.doRegistration(this.getUserRegistration());
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Sign In or Register</Text>
<View style={styles.localLogin}>
<LocalLogin />
</View>
<View style={styles.services}>
<FacebookLogin />
</View>
<View style={styles.register}>
<Button onPress={this._doRegistration} />
</View>
</View>
);
}
_validateEmail() {
this.props.checkEmail(this.state.email, (valid) => this.setState('invalidEmail', valid));
}
_validateNomDeBid() {
this.props.checkNomDeBid(this.state.nomDeBid, (valid) =>
this.setState('invalidNomDeBid', valid),
);
}
getUserRegistration() {
return {
addresses: this.state.addresses,
avatar: this.state.avatar,
email: this.state.email,
firstName: this.state.firstName,
lastName: this.state.lastName,
nomDeBid: this.state.nomDeBid,
password: this.state.password,
phones: this.state.phones,
};
}
isFormComplete() {
return (
!this.state.invalidEmail &&
!this.state.invalidNomDeBid &&
!!this.state.firstName &&
!!this.state.lastName &&
!!this.state.email &&
!!this.state.nomDeBid &&
!!this.state.phones.length &&
!!this.state.password
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Sign In or Register</Text>
<View style={styles.localLogin}>
<LocalLogin />
</View>
<View style={styles.services}>
<FacebookLogin />
</View>
<View style={styles.register}>
<Button onPress={this._doRegistration} />
</View>
</View>
);
}
}

View File

@@ -1,16 +1,12 @@
import { StyleSheet } from 'react-native';
export const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
title: {
},
localLogin: {
},
services: {
},
register: {
},
});
export default (styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
title: {},
localLogin: {},
services: {},
register: {},
}));

View File

@@ -8,31 +8,30 @@ import LocalLogin from '../components/Login/LocalLogin.container.js';
import styles from './SignInOrRegister.styles.js';
export default class SignInOrRegister extends Component {
constructor() {
super(props);
constructor() {
super(props);
this._doRegistration = this._doRegistration.bind(this);
}
this._doRegistration = this._doRegistration.bind(this);
}
_doRegistration() {
this.props.navigation.navigate('Register');
}
_doRegistration() {
this.props.navigation.navigate('Register');
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Sign In or Register</Text>
<View style={styles.localLogin}>
<LocalLogin />
</View>
<View style={styles.services}>
<FacebookLogin />
</View>
<View style={styles.register}>
<Button title="Signup with Email" onPress={this._doRegistration} />
</View>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Sign In or Register</Text>
<View style={styles.localLogin}>
<LocalLogin />
</View>
<View style={styles.services}>
<FacebookLogin />
</View>
<View style={styles.register}>
<Button title="Signup with Email" onPress={this._doRegistration} />
</View>
</View>
);
}
}

View File

@@ -1,15 +1,15 @@
import { StyleSheet } from 'react-native';
export const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
});
export default (styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
}));

View File

@@ -1,33 +1,26 @@
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
export default class Ticketing extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>
Ticketing
</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>Ticketing</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});