- Cleanup
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { fetchEvent } from '../actions/events.js';
|
||||
import { getEventById } from '../selectors/events.js';
|
||||
import { fetchEvents } from '../actions/events.js';
|
||||
import EventRecord from '../domain/Event.js';
|
||||
import { getActiveEvent, getDefaultEvent } from '../selectors/events.js';
|
||||
|
||||
import Event from './Event.js';
|
||||
|
||||
const matchStateToProps = (state) => {
|
||||
const eventId = state.get('activeEvent');
|
||||
const event = getEventById(state, eventId);
|
||||
const event = getActiveEvent(state) || getDefaultEvent(state) || new EventRecord();
|
||||
|
||||
return {
|
||||
description: event.get('description'),
|
||||
endTime: event.get('endTime'),
|
||||
id: event.get('id'),
|
||||
images: event.get('images'),
|
||||
images: event.get('images').toArray(),
|
||||
isTicketed: event.get('isTicketed'),
|
||||
posts: event.get('posts'),
|
||||
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'),
|
||||
ticketClasses: event.get('ticketClasses').toArray(),
|
||||
title: event.get('title'),
|
||||
url: event.get('url'),
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
fetchEvent: () => dispatch(fetchEvent(dispatch)),
|
||||
fetchEvents: () => dispatch(fetchEvents()),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Event);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Text, View } from 'react-native';
|
||||
|
||||
import styles from './Event.styles.js';
|
||||
@@ -6,10 +7,10 @@ import styles from './Event.styles.js';
|
||||
export default class Event extends Component {
|
||||
static get propTypes() {
|
||||
return {
|
||||
description: PropTypes.string.isRequired,
|
||||
endTime: PropTypes.string.isRequired,
|
||||
fetchEvent: PropTypes.func.isRequired,
|
||||
id: PropTypes.string.isRequired,
|
||||
description: PropTypes.string,
|
||||
endTime: PropTypes.string,
|
||||
fetchEvents: PropTypes.func,
|
||||
id: PropTypes.string,
|
||||
images: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
url: PropTypes.string,
|
||||
@@ -18,27 +19,27 @@ export default class Event extends Component {
|
||||
isTicketed: PropTypes.bool,
|
||||
posts: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
author: PropTypes.string.isRequired,
|
||||
content: PropTypes.string.isRequired,
|
||||
id: PropTypes.string.isRequired,
|
||||
author: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
id: PropTypes.string,
|
||||
isPublic: PropTypes.bool,
|
||||
scheduledPost: PropTypes.bool,
|
||||
sendNotification: PropTypes.bool,
|
||||
timestamp: PropTypes.string.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
timestamp: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
}),
|
||||
),
|
||||
requireLoginToSeeAuction: PropTypes.bool.isRequired,
|
||||
showFrom: PropTypes.string.isRequired,
|
||||
showUntil: PropTypes.string.isRequired,
|
||||
startTime: PropTypes.string.isRequired,
|
||||
requireLoginToSeeAuction: PropTypes.bool,
|
||||
showFrom: PropTypes.string,
|
||||
showUntil: PropTypes.string,
|
||||
startTime: PropTypes.string,
|
||||
tagline: PropTypes.string,
|
||||
ticketClasses: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
|
||||
}),
|
||||
)
|
||||
title: PropTypes.string.isRequired,
|
||||
),
|
||||
title: PropTypes.string,
|
||||
url: PropTypes.string,
|
||||
};
|
||||
}
|
||||
@@ -59,6 +60,10 @@ export default class Event extends Component {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchEvents();
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
description,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export default const styles = StyleSheet.create({
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
@@ -13,3 +13,5 @@ export default const styles = StyleSheet.create({
|
||||
margin: 10,
|
||||
}
|
||||
});
|
||||
|
||||
export default styles;
|
||||
|
||||
@@ -1,30 +1,38 @@
|
||||
import { List } from 'immutable';
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
FlatList,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
import { SORT_MODES, VIEW_MODES } from '../constants/constants.js';
|
||||
import { SORT_MODES, AUCTION_VIEW_MODES } from '../constants/constants.js';
|
||||
|
||||
import GridItem from '../components/Item/Grid.js';
|
||||
import ListItem from '../components/Item/List.js';
|
||||
import FilterBar from '../components/Auction/FilterBar.js';
|
||||
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,
|
||||
items: PropTypes.array.isRequired,
|
||||
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); },
|
||||
header: null,
|
||||
items: [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -36,57 +44,42 @@ export default class Marketplace extends Component {
|
||||
|
||||
this.state = {
|
||||
sort: SORT_MODES.TITLE_ASC,
|
||||
view: VIEW_MODES.LIST,
|
||||
view: AUCTION_VIEW_MODES.ALL,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchStatus();
|
||||
this.props.fetchItems();
|
||||
}
|
||||
|
||||
changeFilter(filter) {
|
||||
this.props.changeFilter('market', filter);
|
||||
this.props.changeFilter('auction', filter);
|
||||
}
|
||||
|
||||
changeViewMode(mode) {
|
||||
this.setState({ view: mode });
|
||||
}
|
||||
_keyExtractor = (item, index) => `${item._id}_${index}`;
|
||||
|
||||
_keyExtractor = (item, index) => item.id;
|
||||
|
||||
_renderItem = (view) => ({ item }) => {
|
||||
if (view === VIEW_MODES.GRID) {
|
||||
return <GridItem {...item} />;
|
||||
}
|
||||
|
||||
return <ListItem {...item} />;
|
||||
}
|
||||
_renderAuctionListItem = ({ item }) => <AuctionListItem item={item} />;
|
||||
|
||||
render() {
|
||||
const { items, view } = this.state;
|
||||
const { items } = this.props;
|
||||
const { sort, view } = this.state;
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<FilterBar
|
||||
changeFilterer={this.changeFilter}
|
||||
changeViewMode={this.changeViewMode}
|
||||
/>
|
||||
<FlatList
|
||||
data={items}
|
||||
keyExtractor={this._keyExtractor}
|
||||
renderItem={this.renderItem(view)}
|
||||
/>
|
||||
{items.size > 0 && (
|
||||
<FlatList
|
||||
data={items}
|
||||
keyExtractor={this._keyExtractor}
|
||||
renderItem={this._renderAuctionListItem}
|
||||
contentContainerStyle={styles.itemListContentContainer}
|
||||
style={styles.itemList}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: '#F5FCFF',
|
||||
},
|
||||
title: {
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
});
|
||||
|
||||
16
app/screens/Register.styles.js
Normal file
16
app/screens/Register.styles.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
},
|
||||
title: {
|
||||
},
|
||||
localLogin: {
|
||||
},
|
||||
services: {
|
||||
},
|
||||
register: {
|
||||
},
|
||||
});
|
||||
@@ -1,7 +1,9 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import { Button } from 'react-native-elements';
|
||||
|
||||
import FacebookLogin from '../components/FacebookLogin/FacebookLogin.container.js';
|
||||
import FacebookLogin from '../components/Login/FacebookLogin.container.js';
|
||||
import LocalLogin from '../components/Login/LocalLogin.container.js';
|
||||
|
||||
import styles from './SignInOrRegister.styles.js';
|
||||
|
||||
@@ -28,7 +30,7 @@ export default class SignInOrRegister extends Component {
|
||||
<FacebookLogin />
|
||||
</View>
|
||||
<View style={styles.register}>
|
||||
<Button onPress={this._doRegistration} />
|
||||
<Button title="Signup with Email" onPress={this._doRegistration} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export default const styles = StyleSheet.create({
|
||||
export const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
|
||||
Reference in New Issue
Block a user