Merge branch 'master' of honey.fitz.guru:eventment-app
# Conflicts: # app/components/Login/LocalLogin.js # app/screens/Register.js
This commit is contained in:
77
.eslintrc.js
77
.eslintrc.js
@@ -1,4 +1,81 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: '@react-native-community',
|
||||
env: {
|
||||
mocha: true,
|
||||
browser: true,
|
||||
},
|
||||
// parser: 'babel-eslint',
|
||||
// plugins: ['babel', 'immutablejs'],
|
||||
plugins: ['immutablejs'],
|
||||
rules: {
|
||||
'comma-dangle': 'off',
|
||||
'func-call-spacing': 'off',
|
||||
'import/prefer-default-export': 'off',
|
||||
'max-len': ['error', 150, { ignoreComments: true, ignoreTemplateLiterals: true }],
|
||||
'no-confusing-arrow': 'off',
|
||||
'no-mixed-operators': 'off',
|
||||
'no-restricted-properties': [
|
||||
2,
|
||||
{
|
||||
object: 'describe',
|
||||
property: 'only',
|
||||
message:
|
||||
'Please remove any instance of .only from unit tests. If .only is required outside of a unit test, feel free to add an eslint override to ignore this instance of this error.',
|
||||
},
|
||||
{
|
||||
object: 'it',
|
||||
property: 'only',
|
||||
message:
|
||||
'Please remove any instance of .only from unit tests. If .only is required outside of a unit test, feel free to add an eslint override to ignore this instance of this error.',
|
||||
},
|
||||
{
|
||||
object: 'context',
|
||||
property: 'only',
|
||||
message:
|
||||
'Please remove any instance of .only from unit tests. If .only is required outside of a unit test, feel free to add an eslint override to ignore this instance of this error.',
|
||||
},
|
||||
{
|
||||
object: 'tape',
|
||||
property: 'only',
|
||||
message:
|
||||
'Please remove any instance of .only from unit tests. If .only is required outside of a unit test, feel free to add an eslint override to ignore this instance of this error.',
|
||||
},
|
||||
{
|
||||
object: 'test',
|
||||
property: 'only',
|
||||
message:
|
||||
'Please remove any instance of .only from unit tests. If .only is required outside of a unit test, feel free to add an eslint override to ignore this instance of this error.',
|
||||
},
|
||||
{
|
||||
object: 'fixture',
|
||||
property: 'only',
|
||||
message:
|
||||
'Please remove any instance of .only from unit tests. If .only is required outside of a unit test, feel free to add an eslint override to ignore this instance of this error.',
|
||||
},
|
||||
],
|
||||
'no-spaced-func': 'off',
|
||||
'react/jsx-closing-bracket-location': 'off',
|
||||
'react/jsx-first-prop-new-line': 'off',
|
||||
'react/jsx-no-literals': ['error', { noStrings: true }],
|
||||
'react/jsx-no-target-blank': 'off',
|
||||
'react/no-danger': 'off',
|
||||
'space-before-function-paren': 'off',
|
||||
indent: 'off',
|
||||
'indent-legacy': 'off',
|
||||
'immutablejs/no-native-map-set': 'error',
|
||||
'no-invalid-this': 'off',
|
||||
// 'babel/no-invalid-this': 'error',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['lib/fixtures/**/*.js', '**/testHelper.js'],
|
||||
rules: {
|
||||
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
||||
},
|
||||
globals: {
|
||||
expect: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
8
.prettierrc
Normal file
8
.prettierrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"arrowParens": "always",
|
||||
"jsxBracketSameLine": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 4,
|
||||
"printWidth": 100,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
@@ -1,12 +1,3 @@
|
||||
/**
|
||||
* Sample React Native App
|
||||
* https://github.com/facebook/react-native
|
||||
*
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { createAppContainer } from 'react-navigation';
|
||||
|
||||
import { Tabs } from './router.js';
|
||||
|
||||
6
app/actions/activeEvent.js
Normal file
6
app/actions/activeEvent.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SET_ACTIVE_EVENT } from '../constants/actionTypes.js';
|
||||
|
||||
export const setActiveEvent = (eventId) => ({
|
||||
type: SET_ACTIVE_EVENT,
|
||||
payload: eventId,
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import { blockUI, unblockUI } from './index.js';
|
||||
|
||||
import { placeBid as placeBidApi } from '../api/bid.js';
|
||||
import {
|
||||
BID_FAILURE,
|
||||
BID_SUCCESS,
|
||||
@@ -7,17 +6,33 @@ import {
|
||||
SET_AUCTION_FILTER,
|
||||
SET_AUCTION_VIEW_MODE,
|
||||
} from '../constants/actionTypes.js';
|
||||
import { getActiveEventId } from '../selectors/activeEvent.js';
|
||||
import { getAuthToken } from '../selectors/auth.js';
|
||||
|
||||
const placeBidFailure = (bid, dispatch) => {
|
||||
dispatch({ type: BID_FAILURE, bid });
|
||||
dispatch(unblockUI);
|
||||
const placeBidFailure = (payload) => ({
|
||||
type: BID_FAILURE,
|
||||
payload,
|
||||
});
|
||||
|
||||
const placeBidSuccess = (payload) => ({
|
||||
type: BID_SUCCESS,
|
||||
payload,
|
||||
});
|
||||
|
||||
const handleBidFailure = (error) => (dispatch) => {
|
||||
console.error('[postBid]', error);
|
||||
dispatch(placeBidFailure(error));
|
||||
};
|
||||
|
||||
const placeBidSuccess = (bid, dispatch) => {
|
||||
dispatch({ type: BID_SUCCESS, bid });
|
||||
dispatch(unblockUI);
|
||||
const handleBidSuccess = (result) => (dispatch) => {
|
||||
dispatch(placeBidSuccess(result));
|
||||
};
|
||||
|
||||
const startPlacingBid = (itemId) => ({
|
||||
type: PLACE_BID,
|
||||
payload: itemId,
|
||||
});
|
||||
|
||||
export const changeFilterMode = (payload) => ({
|
||||
type: SET_AUCTION_FILTER,
|
||||
payload,
|
||||
@@ -28,25 +43,12 @@ export const changeViewMode = (payload) => ({
|
||||
payload,
|
||||
});
|
||||
|
||||
export const placeBid = (payload) => ({
|
||||
type: PLACE_BID,
|
||||
payload,
|
||||
});
|
||||
export const placeBid = ({ bidAmount, itemId, maxAmount }) => (dispatch, getState) => {
|
||||
const authToken = getAuthToken(getState());
|
||||
const eventId = getActiveEventId(getState());
|
||||
|
||||
export const postBid = () => (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const activeEvent = state.get('activeEvent');
|
||||
|
||||
let apiUrl = getEndpointUrl(API_ENDPOINTS.GET_ITEMS);
|
||||
apiUrl = apiUrl.replace(/:event_id$/, '');
|
||||
if (activeEvent) {
|
||||
apiUrl = `${apiUrl}${activeEvent}`;
|
||||
}
|
||||
|
||||
dispatch(blockUI());
|
||||
|
||||
fetch(apiUrl)
|
||||
.then(response => response.json())
|
||||
.then(payload => itemsLoadSuccess(payload, dispatch))
|
||||
.catch(err => console.error('[actions::getItems]', err));
|
||||
dispatch(startPlacingBid(itemId));
|
||||
placeBidApi({ bidAmount, eventId, itemId, maxAmount }, authToken)
|
||||
.then((payload) => dispatch(handleBidSuccess(payload)))
|
||||
.catch((err) => dispatch(handleBidFailure(err)));
|
||||
};
|
||||
|
||||
@@ -1,39 +1,27 @@
|
||||
import { List } from 'immutable';
|
||||
|
||||
import { getEndpointUrl } from '../api/index.js';
|
||||
|
||||
import {
|
||||
AUCTIONS_UPDATED,
|
||||
ITEMS_LOADED,
|
||||
} from '../constants/actionTypes.js';
|
||||
|
||||
import { blockUI, unblockUI } from './index.js';
|
||||
import { API_ENDPOINTS } from '../constants/constants.js';
|
||||
import { fetchAuctionStatus as fetchActionStatusApi } from '../api/actionStatus.js';
|
||||
import { AUCTIONS_UPDATED } from '../constants/actionTypes.js';
|
||||
import { getActiveEventId } from '../selectors/activeEvent.js';
|
||||
import { getAuthToken } from '../selectors/auth.js';
|
||||
|
||||
import Auction from '../domain/Auction.js';
|
||||
|
||||
const auctionsUpdated = (payload) => ({
|
||||
type: AUCTIONS_UPDATED,
|
||||
payload,
|
||||
});
|
||||
|
||||
const autionStatusLoadSuccess = (auctions, dispatch) => {
|
||||
const autionStatusLoadSuccess = (auctions) => (dispatch) => {
|
||||
const payload = List(auctions).map((i) => Auction.fromJS(i));
|
||||
dispatch({ type: AUCTIONS_UPDATED, payload });
|
||||
dispatch(unblockUI);
|
||||
dispatch(auctionsUpdated(payload));
|
||||
};
|
||||
|
||||
export const fetchAuctionStatus = () => (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const activeEvent = state.get('activeEvent');
|
||||
const authToken = getAuthToken(getState());
|
||||
const eventId = getActiveEventId(getState());
|
||||
|
||||
let apiUrl = getEndpointUrl(API_ENDPOINTS.GET_STATUS);
|
||||
apiUrl = apiUrl.replace(/:event_id$/, '');
|
||||
if (activeEvent) {
|
||||
apiUrl = `${apiUrl}${activeEvent}`;
|
||||
}
|
||||
|
||||
dispatch(blockUI());
|
||||
|
||||
return fetch(apiUrl)
|
||||
.then(response => response.json())
|
||||
.then(payload => autionStatusLoadSuccess(payload, dispatch))
|
||||
.catch(err => console.error('[actions::getStatus]', err));
|
||||
return fetchActionStatusApi(eventId, authToken)
|
||||
.then((payload) => dispatch(autionStatusLoadSuccess(payload)))
|
||||
.catch((err) => console.error('[actions::getStatus]', err));
|
||||
};
|
||||
|
||||
|
||||
@@ -1,36 +1,31 @@
|
||||
import { List } from 'immutable';
|
||||
|
||||
import { blockUI, unblockUI } from './index.js';
|
||||
import { fetchEvents as fetchEventsApi } from '../api/events.js';
|
||||
import {
|
||||
EVENTS_LOAD_FAILED,
|
||||
EVENTS_LOADED,
|
||||
GET_EVENTS,
|
||||
} from '../constants/actionTypes.js';
|
||||
import { EVENTS_LOAD_FAILED, EVENTS_LOADED, GET_EVENTS } from '../constants/actionTypes.js';
|
||||
import Event from '../domain/Event.js';
|
||||
import { getAuthToken } from '../selectors/auth.js';
|
||||
|
||||
const beginFetchEvents = () => ({ type: GET_EVENTS });
|
||||
|
||||
const eventsLoaded = (payload) => ({ type: EVENTS_LOADED, payload });
|
||||
|
||||
const eventsLoadError = (payload) => ({ type: EVENTS_LOAD_FAILED, payload });
|
||||
|
||||
const eventsFetchSuccess = (items) => (dispatch) => {
|
||||
const payload = List(items).map((i) => Event.fromJS(i));
|
||||
|
||||
dispatch(eventsLoaded(payload));
|
||||
dispatch(unblockUI);
|
||||
};
|
||||
|
||||
const eventsFetchFailure = (error) => (dispatch) => {
|
||||
console.error('[actions::events::eventsFetchFailure]', error);
|
||||
dispatch(eventsLoadError(error));
|
||||
dispatch(unblockUI);
|
||||
};
|
||||
|
||||
export const fetchEvents = () => (dispatch, getState) => {
|
||||
const authToken = getAuthToken(getState());
|
||||
|
||||
dispatch(beginFetchEvents());
|
||||
fetchEventsApi(authToken)
|
||||
.then(payload => dispatch(eventsFetchSuccess(payload)))
|
||||
.catch(err => dispatch(eventsFetchFailure(err)));
|
||||
.then((payload) => dispatch(eventsFetchSuccess(payload)))
|
||||
.catch((err) => dispatch(eventsFetchFailure(err)));
|
||||
};
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
BLOCK_UI,
|
||||
UNBLOCK_UI,
|
||||
} from '../constants/actionTypes.js';
|
||||
import { BLOCK_UI, UNBLOCK_UI } from '../constants/actionTypes.js';
|
||||
|
||||
export const blockUI = () => ({
|
||||
type: BLOCK_UI,
|
||||
|
||||
@@ -1,39 +1,34 @@
|
||||
import { List } from 'immutable';
|
||||
|
||||
import { fetchItems as fetchItemsApi } from '../api/items.js';
|
||||
import {
|
||||
GET_ITEMS,
|
||||
ITEMS_LOADED,
|
||||
} from '../constants/actionTypes.js';
|
||||
import { GET_ITEMS, ITEMS_LOAD_FAILED, ITEMS_LOADED } from '../constants/actionTypes.js';
|
||||
import { getActiveEventId } from '../selectors/activeEvent.js';
|
||||
import { getAuthToken } from '../selectors/auth.js';
|
||||
|
||||
import { blockUI, unblockUI } from './index.js';
|
||||
|
||||
import Item from '../domain/Item.js';
|
||||
|
||||
const beginItemLoad = () => ({ type: GET_ITEMS });
|
||||
|
||||
const itemsLoaded = (payload) => ({ type: ITEMS_LOADED, payload });
|
||||
|
||||
const itemsLoadError = (payload) => ({ type: ITEMS_LOAD_FAILED, payload });
|
||||
const itemsLoadFailure = (payload) => ({ type: ITEMS_LOAD_FAILED, payload });
|
||||
|
||||
const itemsFetchSuccess = (items) => (dispatch) => {
|
||||
const payload = List(items).map((i) => Item.fromJS(i));
|
||||
|
||||
dispatch(itemsLoaded(payload));
|
||||
dispatch(unblockUI);
|
||||
};
|
||||
|
||||
const itemsFetchFailure = (error) => (dispatch) => {
|
||||
console.error('[actions::items::itemsFetchFailure]', error);
|
||||
dispatch(itemsLoadFailure(error));
|
||||
dispatch(unblockUI);
|
||||
};
|
||||
|
||||
export const fetchItems = () => (dispatch, getState) => {
|
||||
const eventId = getActiveEventId(getState());
|
||||
const authToken = getAuthToken(getState());
|
||||
const eventId = getActiveEventId(getState());
|
||||
|
||||
fetchItemsApi(activeEvent, authToken)
|
||||
.then(payload => dispatch(itemsFetchSuccess(payload)))
|
||||
.catch(err => dispatch(itemsFetchFailure(err)));
|
||||
dispatch(beginItemLoad());
|
||||
fetchItemsApi(eventId, authToken)
|
||||
.then((payload) => dispatch(itemsFetchSuccess(payload)))
|
||||
.catch((err) => dispatch(itemsFetchFailure(err)));
|
||||
};
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
LOGIN_SUCCESS,
|
||||
PROFILE_EMAIL_AVAILABLE,
|
||||
PROFILE_NOM_AVAILABLE,
|
||||
REGISTRATION_FAILURE,
|
||||
REGISTRATION_SUCCESS,
|
||||
UNSET_AUTH,
|
||||
UNSET_PROFILE,
|
||||
UPDATE_PROFILE,
|
||||
@@ -65,21 +67,17 @@ const updateProfile = (profile) => ({
|
||||
payload: profile,
|
||||
});
|
||||
|
||||
export const checkEmailAvailability = (email) => (dispatch) => {
|
||||
export const checkEmailAvailability = (email) => (dispatch) => {};
|
||||
|
||||
};
|
||||
|
||||
export const checkNomAvailability = (nomDeBid) => (dispatch) => {
|
||||
|
||||
};
|
||||
export const checkNomAvailability = (nomDeBid) => (dispatch) => {};
|
||||
|
||||
export const login = (username, password) => (dispatch) => {
|
||||
dispatch(blockUI());
|
||||
loginUser(username, password)
|
||||
.then(result => {
|
||||
dispatch(loginSuccess(result))
|
||||
.then((result) => {
|
||||
dispatch(loginSuccess(result));
|
||||
})
|
||||
.catch(err => dispatch(loginFailure(err)));
|
||||
.catch((err) => dispatch(loginFailure(err)));
|
||||
};
|
||||
|
||||
export const logout = () => (dispatch) => {
|
||||
@@ -103,8 +101,8 @@ const handleRegistrationFailure = (error) => (dispatch) => {
|
||||
export const registerUser = (user) => (dispatch) => {
|
||||
dispatch(blockUI());
|
||||
registerNewUser(user)
|
||||
.then(user => dispatch(handleRegistrationSuccess(user)))
|
||||
.catch(err => dispatch(handleRegistrationFailure(err)));
|
||||
.then((user) => dispatch(handleRegistrationSuccess(user)))
|
||||
.catch((err) => dispatch(handleRegistrationFailure(err)));
|
||||
};
|
||||
|
||||
// FACEBOOK
|
||||
@@ -113,12 +111,7 @@ export const facebookLoginSuccess = (result) => (dispatch) => {
|
||||
dispatch(facebookLoginSuccess(result));
|
||||
};
|
||||
|
||||
|
||||
// LOGIN SERVICES COMMON ACTIONS
|
||||
export const serviceRegistrationError = (error) => (dispatch) => {
|
||||
export const serviceRegistrationError = (error) => (dispatch) => {};
|
||||
|
||||
};
|
||||
|
||||
export const serviceRegistrationCanceled = () => (dispatch) => {
|
||||
|
||||
};
|
||||
export const serviceRegistrationCanceled = () => (dispatch) => {};
|
||||
|
||||
7
app/api/auctionStatus.js
Normal file
7
app/api/auctionStatus.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { API_ENDPOINTS, requestGet } from './index.js';
|
||||
|
||||
export const fetchAuctionStatus = (eventId, auth) => {
|
||||
const path = `${API_ENDPOINTS.GET_STATUS})/${eventId}`;
|
||||
const opts = { Authorization: auth ? `Bearer ${auth}` : null };
|
||||
return requestGet(path, null, opts);
|
||||
};
|
||||
10
app/api/bid.js
Normal file
10
app/api/bid.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { API_ENDPOINTS, requestPost } from './index.js';
|
||||
|
||||
export const placeBid = ({ bidAmount, bidderId, eventId, itemId, maxAmount }, auth) => {
|
||||
const requestOptions = { Authorization: auth ? `Bearer ${auth}` : null };
|
||||
return requestPost({
|
||||
path: `${API_ENDPOINTS.PLACE_BID}/${itemId}`,
|
||||
body: { bidAmount, bidderId, eventId, maxAmount },
|
||||
requestOptions,
|
||||
});
|
||||
};
|
||||
@@ -1,8 +1,10 @@
|
||||
import { API_URL } from '../constants/constants.js';
|
||||
|
||||
export const constructUrl = (path, params, host = API_URL) => {
|
||||
if (!(/^\//g).test(path)) {
|
||||
throw new Error(`Invalid path! Expecting a valid relative path (path needs to start with /)(${path})`);
|
||||
if (!/^\//g.test(path)) {
|
||||
throw new Error(
|
||||
`Invalid path! Expecting a valid relative path (path needs to start with /)(${path})`,
|
||||
);
|
||||
}
|
||||
|
||||
let url = path;
|
||||
@@ -27,7 +29,7 @@ export const constructUrl = (path, params, host = API_URL) => {
|
||||
*/
|
||||
export const formatPostData = (body) => {
|
||||
const postData = new FormData();
|
||||
Object.keys(body).forEach(key => postData.append(key, body[key]));
|
||||
Object.keys(body).forEach((key) => postData.append(key, body[key]));
|
||||
return postData;
|
||||
};
|
||||
|
||||
@@ -44,8 +46,7 @@ const parseQueryParamsObject = (queryParams) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Object
|
||||
.keys(queryParams)
|
||||
return Object.keys(queryParams)
|
||||
.map((key) => {
|
||||
const value = queryParams[key];
|
||||
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
||||
@@ -66,12 +67,11 @@ const parseQueryParamsArray = (queryParams) => {
|
||||
.join('&');
|
||||
};
|
||||
|
||||
export const parseQueryParams = queryParams => (
|
||||
export const parseQueryParams = (queryParams) =>
|
||||
parseQueryParamsString(queryParams) ||
|
||||
parseQueryParamsObject(queryParams) ||
|
||||
parseQueryParamsArray(queryParams) ||
|
||||
''
|
||||
);
|
||||
'';
|
||||
|
||||
export const request = (url, options) => {
|
||||
try {
|
||||
|
||||
@@ -11,16 +11,16 @@ import { API_URL } from '../constants/constants.js';
|
||||
|
||||
const DefaultRequestOptions = {};
|
||||
|
||||
const endpoints = {
|
||||
export const API_ENDPOINTS = {
|
||||
// Events and Items
|
||||
GET_EVENTS: '/events',
|
||||
// GET_ITEMS: '/items?eventId=:event_id',
|
||||
// GET_ITEMS: '/items?eventId=:event_id',
|
||||
GET_ITEMS: '/items',
|
||||
|
||||
// Auction Interactions
|
||||
// GET_STATUS: '/auction/:event_id',
|
||||
// GET_STATUS: '/auction/:event_id',
|
||||
GET_STATUS: '/auction',
|
||||
PLACE_BID: '/bids/:item_id',
|
||||
PLACE_BID: '/bids',
|
||||
PURCHASE_ITEM: '/sales',
|
||||
|
||||
// User/Profile
|
||||
@@ -61,7 +61,7 @@ export const requestGet = (path, queryParams = [], requestOptions = {}) => {
|
||||
|
||||
return request(constructUrl(path, params), {
|
||||
...DefaultRequestOptions,
|
||||
...requestOptions
|
||||
...requestOptions,
|
||||
})
|
||||
.then(validateResponse)
|
||||
.then(unwrapJson);
|
||||
@@ -73,7 +73,7 @@ export const requestPost = (options) => {
|
||||
body = {},
|
||||
queryParams = [],
|
||||
requestOptions = {},
|
||||
isFormattedPostData = false
|
||||
isFormattedPostData = false,
|
||||
} = options;
|
||||
|
||||
const params = parseQueryParams(queryParams || []);
|
||||
@@ -88,7 +88,7 @@ export const requestPost = (options) => {
|
||||
...DefaultRequestOptions,
|
||||
...requestOptions,
|
||||
method: 'POST',
|
||||
body: isFormattedPostData ? body : formatPostData(body)
|
||||
body: isFormattedPostData ? body : formatPostData(body),
|
||||
})
|
||||
.then(validateResponse)
|
||||
.then(unwrapJson);
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import { API_ENDPOINTS, requestGet } from './index.js';
|
||||
|
||||
export const getEmailAvailability = (email) => requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_EMAIL}/&{encodeURI(email)}`);
|
||||
export const getEmailAvailability = (email) =>
|
||||
requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_EMAIL}/&{encodeURI(email)}`);
|
||||
|
||||
export const getNomAvailaibility = (nomDeBid) => requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_NOM}/${encodeURI(nomDeBid)}`);
|
||||
export const getNomAvailaibility = (nomDeBid) =>
|
||||
requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_NOM}/${encodeURI(nomDeBid)}`);
|
||||
|
||||
export const loginUser = (username, password) => requestPost({
|
||||
export const loginUser = (username, password) =>
|
||||
requestPost({
|
||||
path: API_ENDPOINTS.LOGIN,
|
||||
body: { username, password },
|
||||
});
|
||||
});
|
||||
|
||||
export const registerNewUser = (user) => requestPost({
|
||||
export const registerNewUser = (user) =>
|
||||
requestPost({
|
||||
path: API_ENDPOINTS.USER_SIGNUP,
|
||||
body: { user },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,4 +8,7 @@ const matchDispatchToProps = (dispatch) => ({
|
||||
fetchEvents: () => dispatch(fetchEvents()),
|
||||
});
|
||||
|
||||
export default connect(null, matchDispatchToProps)(AppHeader);
|
||||
export default connect(
|
||||
null,
|
||||
matchDispatchToProps,
|
||||
)(AppHeader);
|
||||
|
||||
@@ -10,7 +10,6 @@ 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,
|
||||
@@ -21,7 +20,7 @@ export default class AppHeader extends Component {
|
||||
this.props.fetchEvents();
|
||||
}
|
||||
|
||||
render () {
|
||||
render() {
|
||||
const { navigation } = this.props;
|
||||
|
||||
return (
|
||||
|
||||
@@ -13,4 +13,7 @@ const matchStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(matchStateToProps, null)(HeaderContentLeft);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
null,
|
||||
)(HeaderContentLeft);
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
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();
|
||||
@@ -30,7 +21,6 @@ export default function HeaderContentLeft({
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
if (activeRoute === 'Events') {
|
||||
return <EventsIcon action={_goBack} />;
|
||||
}
|
||||
@@ -39,7 +29,7 @@ export default function HeaderContentLeft({
|
||||
return <BackIcon action={_goBack} />;
|
||||
}
|
||||
|
||||
return <EventsIcon action={hasMultipleEvents ? _showEvents : null} />
|
||||
return <EventsIcon action={hasMultipleEvents ? _showEvents : null} />;
|
||||
}
|
||||
|
||||
HeaderContentLeft.propTypes = {
|
||||
|
||||
@@ -9,4 +9,7 @@ const matchStateToProps = (state, ownProps) => ({
|
||||
hideUserProfileButton: ownProps.navigation.state.routeName === 'Profile',
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, null)(HeaderContentRight);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
null,
|
||||
)(HeaderContentRight);
|
||||
|
||||
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
|
||||
import UserProfileButton from './UserProfileButton/UserProfileButton.container.js';
|
||||
|
||||
export default function HeaderContentRight({ hideUserProfileButton, navigation }) {
|
||||
|
||||
if (hideUserProfileButton) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -15,4 +15,7 @@ const matchStateToProps = (state) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(matchStateToProps, null)(EventTitle);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
null,
|
||||
)(EventTitle);
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
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,
|
||||
}) {
|
||||
export default function EventTitle({ action, date, end, name, start }) {
|
||||
const _generateEventTitle = () => (
|
||||
<View style={styles.eventInfo}>
|
||||
<Text style={styles.eventName}>{name}</Text>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export const styles = StyleSheet.create({
|
||||
export default (styles = StyleSheet.create({
|
||||
eventInfo: {
|
||||
flexDirection: 'row',
|
||||
},
|
||||
@@ -11,4 +11,4 @@ export const styles = StyleSheet.create({
|
||||
eventDate: {
|
||||
flex: 1,
|
||||
},
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -15,4 +15,7 @@ const matchStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(matchStateToProps, null)(HeaderTitle);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
null,
|
||||
)(HeaderTitle);
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
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';
|
||||
|
||||
@@ -17,7 +13,6 @@ export default function HeaderTitle({
|
||||
hasMultipleEvents,
|
||||
navigation,
|
||||
}) {
|
||||
|
||||
const _goBack = () => {
|
||||
if (hasActiveEvent) {
|
||||
navigation.goBack();
|
||||
@@ -32,7 +27,6 @@ export default function HeaderTitle({
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
if (activeRoute === 'Events') {
|
||||
return (
|
||||
<TouchableOpacity onPress={_goBack}>
|
||||
@@ -45,7 +39,7 @@ export default function HeaderTitle({
|
||||
return <Text style={styles.screenHeader}>Profile</Text>;
|
||||
}
|
||||
|
||||
return <EventTitle action={hasMultipleEvents ? _showEvents : null} />
|
||||
return <EventTitle action={hasMultipleEvents ? _showEvents : null} />;
|
||||
}
|
||||
|
||||
HeaderTitle.propTypes = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export const styles = StyleSheet.create({
|
||||
export default (styles = StyleSheet.create({
|
||||
filterBar: {
|
||||
backgroundColor: '#0F0',
|
||||
flexDirection: 'row',
|
||||
@@ -11,5 +11,4 @@ export const styles = StyleSheet.create({
|
||||
view: {
|
||||
flex: 2,
|
||||
},
|
||||
});
|
||||
|
||||
}));
|
||||
|
||||
@@ -5,7 +5,6 @@ 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} />;
|
||||
|
||||
if (action) {
|
||||
|
||||
@@ -8,4 +8,7 @@ const matchStateToProps = (state) => ({
|
||||
avatarUrl: getProfileAvatarUrl(state),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, null)(UserProfileButton);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
null,
|
||||
)(UserProfileButton);
|
||||
|
||||
@@ -7,7 +7,6 @@ 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;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
Text,
|
||||
Image,
|
||||
View
|
||||
} from 'react-native';
|
||||
import { StyleSheet, TouchableOpacity, Text, Image, View } from 'react-native';
|
||||
|
||||
import GallerySwiper from 'react-native-gallery-swiper';
|
||||
|
||||
@@ -53,12 +47,12 @@ export default class AuctionListItem extends Component {
|
||||
_getBidTime = () => {
|
||||
const { end, start } = this.props;
|
||||
return getAuctionTime({ end, start });
|
||||
}
|
||||
};
|
||||
|
||||
_viewItemDetail = () => {
|
||||
const { _id: id } = this.props.details;
|
||||
this.props.navigation.navigate('Item', { id });
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
@@ -74,7 +68,7 @@ export default class AuctionListItem extends Component {
|
||||
type,
|
||||
} = this.props;
|
||||
|
||||
return(
|
||||
return (
|
||||
<TouchableOpacity onPress={this._viewItemDetail}>
|
||||
<View style={styles.rowContainer}>
|
||||
{images !== null && images.length > 0 && (
|
||||
@@ -84,7 +78,7 @@ export default class AuctionListItem extends Component {
|
||||
initialNumToRender={2}
|
||||
resizeMode="cover"
|
||||
sensitiveScroll={false}
|
||||
style={{height: 280}}
|
||||
style={{ height: 280 }}
|
||||
/>
|
||||
)}
|
||||
<View style={styles.rowText}>
|
||||
@@ -158,7 +152,7 @@ const styles = StyleSheet.create({
|
||||
shadowColor: '#CCC',
|
||||
shadowOffset: {
|
||||
width: 1,
|
||||
height: 1
|
||||
height: 1,
|
||||
},
|
||||
shadowOpacity: 1.0,
|
||||
shadowRadius: 1,
|
||||
|
||||
@@ -3,10 +3,7 @@ import PropTypes from 'prop-types';
|
||||
|
||||
import { formatPrice } from '../../library/helpers.js';
|
||||
|
||||
import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
} from 'react-native';
|
||||
import { StyleSheet, Text } from 'react-native';
|
||||
|
||||
const AuctionPriceAndBidCount = ({ bidCount, currentPrice }) => {
|
||||
return (
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
} from 'react-native';
|
||||
import { StyleSheet, Text } from 'react-native';
|
||||
|
||||
const BidStatus = ({ isBidding, isWinning }) => {
|
||||
if (!isBidding) {
|
||||
@@ -12,13 +9,13 @@ const BidStatus = ({ isBidding, isWinning }) => {
|
||||
}
|
||||
|
||||
const statusBarStyle = isWinning
|
||||
? [ styles.bidStatus, styes.isWinning ]
|
||||
: [ styles.bidStatus, styles.isOutbid ];
|
||||
? [styles.bidStatus, styes.isWinning]
|
||||
: [styles.bidStatus, styles.isOutbid];
|
||||
|
||||
return (
|
||||
<Text style={statusBarStyle} numberOfLines={1}>
|
||||
{isWinning && `Oh no! You have been outbid!`}
|
||||
{!isWinning && isBidding && `You have the winning bid! (for now...)`}
|
||||
{isWinning && 'Oh no! You have been outbid!'}
|
||||
{!isWinning && isBidding && 'You have the winning bid! (for now...)'}
|
||||
</Text>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
|
||||
const FilterBar = ({ changeFilterer, changeViewMode, filterMode, viewMode }) => (
|
||||
<View style={styles.filterBar}>
|
||||
|
||||
@@ -1,33 +1,24 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
Text,
|
||||
Image,
|
||||
View
|
||||
} from 'react-native';
|
||||
import { StyleSheet, TouchableOpacity, Text, Image, View } from 'react-native';
|
||||
|
||||
export default class EventListItem extends Component {
|
||||
static get propTypes() {
|
||||
return {
|
||||
description: PropTypes.string.isRequired,
|
||||
endTime: PropTypes.string.isRequired,
|
||||
end: PropTypes.string.isRequired,
|
||||
id: PropTypes.string.isRequired,
|
||||
images: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
url: PropTypes.string,
|
||||
}),
|
||||
),
|
||||
isTicketed: PropTypes.bool,
|
||||
postCount: PropTypes.number,
|
||||
setActiveEvent: PropTypes.func.isRequired,
|
||||
showFrom: PropTypes.string.isRequired,
|
||||
showUntil: PropTypes.string.isRequired,
|
||||
startTime: PropTypes.string.isRequired,
|
||||
start: PropTypes.string.isRequired,
|
||||
tagline: PropTypes.string,
|
||||
title: PropTypes.string.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,18 +36,22 @@ export default class EventListItem extends Component {
|
||||
}
|
||||
|
||||
_viewEventDetail = () => {
|
||||
const { id } = this.props.details;
|
||||
this.props.setActiveEvent(id);
|
||||
this.props.setActiveEvent(this.props.id);
|
||||
this.props.navigation.navigate('Event');
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
} = this.props;
|
||||
const { date, description, end, name, start } = this.props;
|
||||
|
||||
return(
|
||||
return (
|
||||
<TouchableOpacity onPress={this._viewEventDetail}>
|
||||
<View style={styles.rowContainer}>
|
||||
<Text>{name}</Text>
|
||||
<Text>{date}</Text>
|
||||
<Text>
|
||||
{start} - {end}
|
||||
</Text>
|
||||
<Text>{description}</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
@@ -76,7 +71,7 @@ const styles = StyleSheet.create({
|
||||
shadowColor: '#CCC',
|
||||
shadowOffset: {
|
||||
width: 1,
|
||||
height: 1
|
||||
height: 1,
|
||||
},
|
||||
shadowOpacity: 1.0,
|
||||
shadowRadius: 1,
|
||||
|
||||
@@ -16,4 +16,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
doSuccessAction: (result) => dispatch(facebookLoginSuccess(result)),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps)(FacebookLogin);
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps,
|
||||
)(FacebookLogin);
|
||||
|
||||
@@ -11,13 +11,11 @@ export default function FacebookLogin({
|
||||
doLogoutAction,
|
||||
doSuccessAction,
|
||||
}) {
|
||||
|
||||
return (
|
||||
<View>
|
||||
<LoginButton
|
||||
publishPermissions={PERMISSIONS.FACEBOOK}
|
||||
onLoginFinished={
|
||||
(error, result) => {
|
||||
onLoginFinished={(error, result) => {
|
||||
if (error) {
|
||||
doErrorAction(error);
|
||||
} else if (result.isCancelled) {
|
||||
@@ -25,8 +23,7 @@ export default function FacebookLogin({
|
||||
} else {
|
||||
doSuccessAction(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
onLogoutFinished={doLogoutAction}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -8,4 +8,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
doLoginAction: (username, password) => dispatch(login(username, password)),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps)(LocalLogin);
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps,
|
||||
)(LocalLogin);
|
||||
|
||||
@@ -49,5 +49,5 @@ export const API_ENDPOINTS = {
|
||||
};
|
||||
|
||||
export const PERMISSIONS = {
|
||||
FACEBOOK: [ 'email', 'public_profile' ],
|
||||
FACEBOOK: ['email', 'public_profile'],
|
||||
};
|
||||
|
||||
@@ -25,5 +25,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
placeBid: (data) => dispatch(placeBid(data)),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(AuctionListItem);
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
)(AuctionListItem);
|
||||
|
||||
@@ -13,4 +13,7 @@ function mapStateToProps(state, ownProps) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(AuctionPriceAndBidCount);
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
)(AuctionPriceAndBidCount);
|
||||
|
||||
@@ -13,4 +13,7 @@ function mapStateToProps(state, ownProps) {
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(AuctionPriceAndBidCount);
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
)(AuctionPriceAndBidCount);
|
||||
|
||||
@@ -16,4 +16,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
fetchEvents: () => dispatch(fetchEvents(dispatch)),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Events);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(Events);
|
||||
|
||||
@@ -25,5 +25,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
setActiveEvent: (eventId) => dispatch(setActiveEvent(eventId)),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(AuctionListItem);
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
)(AuctionListItem);
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class Event extends Record({
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.ticketClasses.find(t => t.available > 0) || false;
|
||||
return this.ticketClasses.find((t) => t.available > 0) || false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ Event.fromJS = (data = {}) => {
|
||||
id: data._id,
|
||||
...data,
|
||||
images: new List(data.images),
|
||||
posts: new List(data.posts.map(p => Post.fromJS(p))),
|
||||
ticketClasses: new List(data.ticketClasses.map(t => TicketClass.fromJS(t))),
|
||||
posts: new List(data.posts.map((p) => Post.fromJS(p))),
|
||||
ticketClasses: new List(data.ticketClasses.map((t) => TicketClass.fromJS(t))),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -9,8 +9,7 @@ export default class Post extends Record({
|
||||
sendNotification: false,
|
||||
timestamp: null,
|
||||
title: null,
|
||||
}) {};
|
||||
|
||||
}) {}
|
||||
|
||||
Post.fromJS = (data = {}) => {
|
||||
return new Post({
|
||||
|
||||
@@ -29,8 +29,12 @@ export default class Profile extends Record({
|
||||
}
|
||||
|
||||
get isRegisteredAccount() {
|
||||
return this.hasLinkedApple ||
|
||||
this.hasLinkedFacebook || this.hasLinkedGoogle || this.hasLocalAccount;
|
||||
return (
|
||||
this.hasLinkedApple ||
|
||||
this.hasLinkedFacebook ||
|
||||
this.hasLinkedGoogle ||
|
||||
this.hasLocalAccount
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class TicketClass extends Record({
|
||||
startSale: null,
|
||||
}) {
|
||||
get isAlmostGone() {
|
||||
return this.available < (this.capacity * 0.20);
|
||||
return this.available < this.capacity * 0.2;
|
||||
}
|
||||
|
||||
get isSoldOut() {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { SET_ACTIVE_EVENT, UNSET_ACTIVE_EVENT } from '../constants/actionTypes.js';
|
||||
import { EVENTS_LOADED, SET_ACTIVE_EVENT, UNSET_ACTIVE_EVENT } from '../constants/actionTypes.js';
|
||||
|
||||
export const activeEvent = (state = null, action) => {
|
||||
switch (action.type) {
|
||||
case EVENTS_LOADED:
|
||||
return action.payload.size === 1 ? action.payload.get(0).get('id') : null;
|
||||
case SET_ACTIVE_EVENT:
|
||||
return action.payload;
|
||||
case UNSET_ACTIVE_EVENT:
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { Map } from 'immutable';
|
||||
|
||||
import {
|
||||
GET_ITEMS,
|
||||
ITEMS_LOADED,
|
||||
} from '../constants/actionTypes.js';
|
||||
import { GET_ITEMS, ITEMS_LOADED } from '../constants/actionTypes.js';
|
||||
|
||||
export const items = (state = new Map(), action) => {
|
||||
switch (action.type) {
|
||||
|
||||
100
app/router.js
100
app/router.js
@@ -16,37 +16,6 @@ import Profile from './screens/Profile.container.js';
|
||||
import Register from './screens/Register.js';
|
||||
import SignInOrRegister from './screens/SignInOrRegister.js';
|
||||
|
||||
export const Tabs = createBottomTabNavigator({
|
||||
'Event': {
|
||||
screen: Event,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Event',
|
||||
tabBarIcon: ({ tintColor }) => <Icon name="black-tie" type="font-awesome" size={28} color={tintColor} />,
|
||||
},
|
||||
},
|
||||
'Auction': {
|
||||
screen: Auction,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Silent Auction',
|
||||
tabBarIcon: ({ tintColor }) => <Icon name="gavel" type="font-awesome" size={28} color={tintColor} />,
|
||||
},
|
||||
},
|
||||
'Bazaar': {
|
||||
screen: Marketplace,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Bazaar',
|
||||
tabBarIcon: ({ tintColor }) => <Icon name="store" type="fontisto" size={28} color={tintColor} />,
|
||||
},
|
||||
},
|
||||
'Profile': {
|
||||
screen: Profile,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Profile',
|
||||
tabBarIcon: ({ tintColor }) => <Icon name="ios-person" type="font-awesome" size={28} color={tintColor} />,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const SignInOrRegisterStack = createStackNavigator({
|
||||
SignInOrRegister: {
|
||||
screen: SignInOrRegister,
|
||||
@@ -132,7 +101,54 @@ export const EventsStack = createStackNavigator({
|
||||
tabBarVisible: false,
|
||||
gesturesEnabled: false,
|
||||
}),
|
||||
}
|
||||
},
|
||||
Event: {
|
||||
screen: Event,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
header: <AppHeader navigation={navigation} />,
|
||||
tabBarVisible: false,
|
||||
gesturesEnabled: false,
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
export const Tabs = createBottomTabNavigator({
|
||||
Event: {
|
||||
screen: EventsStack,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Event',
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="black-tie" type="font-awesome" size={28} color={tintColor} />
|
||||
),
|
||||
},
|
||||
},
|
||||
Auction: {
|
||||
screen: AuctionStack,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Silent Auction',
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="gavel" type="font-awesome" size={28} color={tintColor} />
|
||||
),
|
||||
},
|
||||
},
|
||||
Bazaar: {
|
||||
screen: BazaarStack,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Bazaar',
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="store" type="fontisto" size={28} color={tintColor} />
|
||||
),
|
||||
},
|
||||
},
|
||||
Profile: {
|
||||
screen: Profile,
|
||||
navigationOptions: {
|
||||
tabBarLabel: 'Profile',
|
||||
tabBarIcon: ({ tintColor }) => (
|
||||
<Icon name="ios-person" type="font-awesome" size={28} color={tintColor} />
|
||||
),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const createRootNavigator = () => {
|
||||
@@ -142,29 +158,35 @@ export const createRootNavigator = () => {
|
||||
screen: AuctionStack,
|
||||
navigationOptions: {
|
||||
gesturesEnabled: false,
|
||||
}
|
||||
},
|
||||
},
|
||||
BazaarStack: {
|
||||
screen: BazaarStack,
|
||||
navigationOptions: {
|
||||
gesturesEnabled: false,
|
||||
}
|
||||
},
|
||||
},
|
||||
EventsStack: {
|
||||
screen: EventsStack,
|
||||
navigationOptions: {
|
||||
gesturesEnabled: false,
|
||||
}
|
||||
},
|
||||
},
|
||||
SignInOrRegisterStack: {
|
||||
screen: SignInOrRegister,
|
||||
navigationOptions: {
|
||||
gesturesEnabled: false,
|
||||
},
|
||||
},
|
||||
Tabs: {
|
||||
screen: Tabs,
|
||||
navigationOptions: {
|
||||
gesturesEnabled: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
mode: "modal",
|
||||
}
|
||||
mode: 'modal',
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -20,4 +20,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
fetchStatus: () => dispatch(fetchAuctionStatus(dispatch)),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Auction);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(Auction);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -22,16 +18,15 @@ export default class Auction extends Component {
|
||||
changeViewMode: PropTypes.func.isRequired,
|
||||
fetchItems: PropTypes.func.isRequired,
|
||||
fetchStatus: PropTypes.func.isRequired,
|
||||
items: PropTypes.oneOfType([
|
||||
PropTypes.array,
|
||||
PropTypes.instanceOf(List),
|
||||
]),
|
||||
items: PropTypes.oneOfType([PropTypes.array, PropTypes.instanceOf(List)]),
|
||||
};
|
||||
}
|
||||
|
||||
static get defaultProps() {
|
||||
return {
|
||||
changeFilter: () => { console.log('Change Filter Default Prop', arguments); },
|
||||
changeFilter: () => {
|
||||
console.log('Change Filter Default Prop', arguments);
|
||||
},
|
||||
items: [],
|
||||
};
|
||||
}
|
||||
@@ -57,7 +52,11 @@ export default class Auction extends Component {
|
||||
this.props.changeFilter('auction', filter);
|
||||
}
|
||||
|
||||
_keyExtractor = (item, index) => `${item._id}_${index}`;
|
||||
changeViewMode(viewMode) {
|
||||
this.props.changeViewMode(viewMode);
|
||||
}
|
||||
|
||||
_keyExtractor = (item, index) => `${item.id}_${index}`;
|
||||
|
||||
_renderAuctionListItem = ({ item }) => <AuctionListItem item={item} />;
|
||||
|
||||
@@ -69,6 +68,7 @@ export default class Auction extends Component {
|
||||
<View style={styles.container}>
|
||||
<FilterBar
|
||||
changeFilterer={this.changeFilter}
|
||||
changeViewMode={this.changeViewMode}
|
||||
/>
|
||||
{items.size > 0 && (
|
||||
<FlatList
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export const styles = StyleSheet.create({
|
||||
export default (styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
@@ -14,4 +14,4 @@ export const styles = StyleSheet.create({
|
||||
alignItems: 'stretch',
|
||||
justifyContent: 'flex-start',
|
||||
},
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
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>
|
||||
<Text style={styles.title}>Checkout</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -28,5 +22,5 @@ const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -33,4 +33,7 @@ const matchStateToProps = (state) => {
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Event);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(Event);
|
||||
|
||||
@@ -33,11 +33,7 @@ export default class Event extends Component {
|
||||
showUntil: PropTypes.string,
|
||||
startTime: PropTypes.string,
|
||||
tagline: PropTypes.string,
|
||||
ticketClasses: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
|
||||
}),
|
||||
),
|
||||
ticketClasses: PropTypes.arrayOf(PropTypes.shape({})),
|
||||
title: PropTypes.string,
|
||||
url: PropTypes.string,
|
||||
};
|
||||
@@ -77,9 +73,7 @@ export default class Event extends Component {
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>
|
||||
Event
|
||||
</Text>
|
||||
<Text style={styles.title}>Event</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
export default (styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
@@ -11,7 +11,5 @@ const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
});
|
||||
|
||||
export default styles;
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { setActiveEvent } from '../actions/activeEvent.js';
|
||||
import { fetchEvents } from '../actions/events.js';
|
||||
import { getEventsAsList } from '../selectors/events.js';
|
||||
|
||||
@@ -7,13 +8,15 @@ import Events from './Events.js';
|
||||
|
||||
const matchStateToProps = (state) => {
|
||||
const events = getEventsAsList(state);
|
||||
console.log('events:', events);
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,31 +1,45 @@
|
||||
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,
|
||||
events: PropTypes.instanceOf(List),
|
||||
fetchEvents: PropTypes.func.isRequired,
|
||||
setActiveEvent: PropTypes.func.isRequired,
|
||||
};
|
||||
}
|
||||
|
||||
static get defaultProps() {
|
||||
return {
|
||||
events: new List(),
|
||||
};
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this._setActiveEvent = this.setActiveEvent.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchEvents();
|
||||
}
|
||||
|
||||
_keyExtractor = (event, index) => `${event._id}_${index}`;
|
||||
setActiveEvent(eventId) {
|
||||
this.props.setActiveEvent(eventId);
|
||||
}
|
||||
|
||||
_renderEventListItem = ({ event }) => <EventListItem event={event} />;
|
||||
_keyExtractor = (event, index) => `${event.id}_${index}`;
|
||||
|
||||
_renderEventListItem = ({ event }) => (
|
||||
<EventListItem {...event} setActiveEvent={this.setActiveEvent} />
|
||||
);
|
||||
|
||||
render() {
|
||||
const { events } = this.props;
|
||||
@@ -53,6 +67,5 @@ const styles = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
backgroundColor: '#F5FCFF',
|
||||
},
|
||||
eventListContentContainer: {
|
||||
},
|
||||
eventListContentContainer: {},
|
||||
});
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
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>
|
||||
<Text style={styles.title}>Item</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -28,5 +22,5 @@ const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
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>
|
||||
<Text style={styles.title}>Item</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -28,5 +22,5 @@ const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
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>
|
||||
<Text style={styles.title}>Login</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -28,5 +22,5 @@ const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -22,16 +18,15 @@ export default class Marketplace extends Component {
|
||||
changeViewMode: PropTypes.func.isRequired,
|
||||
fetchItems: PropTypes.func.isRequired,
|
||||
fetchStatus: PropTypes.func.isRequired,
|
||||
items: PropTypes.oneOfType([
|
||||
PropTypes.array,
|
||||
PropTypes.instanceOf(List),
|
||||
]),
|
||||
items: PropTypes.oneOfType([PropTypes.array, PropTypes.instanceOf(List)]),
|
||||
};
|
||||
}
|
||||
|
||||
static get defaultProps() {
|
||||
return {
|
||||
changeFilter: () => { console.log('Change Filter Default Prop', arguments); },
|
||||
changeFilter: () => {
|
||||
console.log('Change Filter Default Prop', arguments);
|
||||
},
|
||||
items: [],
|
||||
};
|
||||
}
|
||||
@@ -67,9 +62,7 @@ export default class Marketplace extends Component {
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<FilterBar
|
||||
changeFilterer={this.changeFilter}
|
||||
/>
|
||||
<FilterBar changeFilterer={this.changeFilter} />
|
||||
{items.size > 0 && (
|
||||
<FlatList
|
||||
data={items}
|
||||
|
||||
@@ -29,4 +29,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
updateProfile: () => dispatch(updateProfile(dispatch)),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Profile);
|
||||
export default connect(
|
||||
matchStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(Profile);
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
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>
|
||||
<Text style={styles.title}>Profile</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -28,5 +22,5 @@ const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
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';
|
||||
|
||||
@@ -14,4 +10,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
doRegistration: (user) => dispatch(registerUser(user)),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps)(Register);
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps,
|
||||
)(Register);
|
||||
|
||||
@@ -9,14 +9,13 @@ const STRINGS = {
|
||||
};
|
||||
|
||||
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,
|
||||
// invalidEmail: PropTypes.bool.isRequired,
|
||||
// invalidNomDeBid: PropTypes.bool.isRequired,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,7 +53,9 @@ export default class Register extends Component {
|
||||
}
|
||||
|
||||
_validateNomDeBid() {
|
||||
this.props.checkNomDeBid(this.state.nomDeBid, (valid) => this.setState('invalidNomDeBid', valid));
|
||||
this.props.checkNomDeBid(this.state.nomDeBid, (valid) =>
|
||||
this.setState('invalidNomDeBid', valid),
|
||||
);
|
||||
}
|
||||
|
||||
getUserRegistration() {
|
||||
@@ -71,9 +72,16 @@ export default class Register extends Component {
|
||||
}
|
||||
|
||||
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;
|
||||
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() {
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export const styles = StyleSheet.create({
|
||||
export default (styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
},
|
||||
title: {
|
||||
},
|
||||
localLogin: {
|
||||
},
|
||||
services: {
|
||||
},
|
||||
register: {
|
||||
},
|
||||
});
|
||||
title: {},
|
||||
localLogin: {},
|
||||
services: {},
|
||||
register: {},
|
||||
}));
|
||||
|
||||
@@ -8,7 +8,6 @@ import LocalLogin from '../components/Login/LocalLogin.container.js';
|
||||
import styles from './SignInOrRegister.styles.js';
|
||||
|
||||
export default class SignInOrRegister extends Component {
|
||||
|
||||
constructor() {
|
||||
super(props);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
export const styles = StyleSheet.create({
|
||||
export default (styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
@@ -11,5 +11,5 @@ export const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
});
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
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>
|
||||
<Text style={styles.title}>Ticketing</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -28,6 +22,5 @@ const styles = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -6,9 +6,11 @@ export const getItemBidCount = (state, itemId) => state.getIn(['auctions', itemI
|
||||
|
||||
export const getItemPrice = (state, itemId) => state.getIn(['auctions', itemId, 'currentPrice'], 0);
|
||||
|
||||
export const isBiddingItem = (state, itemId) => state.getIn(['auctions', itemId, 'isBidding'], false);
|
||||
export const isBiddingItem = (state, itemId) =>
|
||||
state.getIn(['auctions', itemId, 'isBidding'], false);
|
||||
|
||||
export const isWinningItem = (state, itemId) => state.getIn(['auctions', itemId, 'isWinning'], false);
|
||||
export const isWinningItem = (state, itemId) =>
|
||||
state.getIn(['auctions', itemId, 'isWinning'], false);
|
||||
|
||||
export const getAuctionStatus = (state, itemId) => state.getIn(['actions', itemId], false);
|
||||
|
||||
@@ -19,15 +21,15 @@ export const getAuctionStatuses = createSelector(
|
||||
|
||||
export const getItemsIdsWithNoBids = createSelector(
|
||||
[getAuctionStatuses],
|
||||
(auctions) => auctions.filter(auction => auction.bidCount === 0),
|
||||
(auctions) => auctions.filter((auction) => auction.bidCount === 0),
|
||||
);
|
||||
|
||||
export const getMyBidItemIds = createSelector(
|
||||
[getAuctionStatuses],
|
||||
(auctions) => auctions.filter(auction => auction.isBidding),
|
||||
(auctions) => auctions.filter((auction) => auction.isBidding),
|
||||
);
|
||||
|
||||
export const getMyWinningItemIds = createSelector(
|
||||
[getAuctionStatuses],
|
||||
(auctions) => auctions.filter(auction => auction.isWinning),
|
||||
(auctions) => auctions.filter((auction) => auction.isWinning),
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@ export const getEvents = createSelector(
|
||||
|
||||
export const getActiveEvent = createSelector(
|
||||
[getActiveEventId, getEvents],
|
||||
(eventId, eventsAsMap) => eventId ? eventsAsMap.get(eventId) : null,
|
||||
(eventId, eventsAsMap) => (eventId ? eventsAsMap.get(eventId) : null),
|
||||
);
|
||||
|
||||
export const getDefaultEvent = createSelector(
|
||||
|
||||
@@ -19,7 +19,7 @@ export const getItemsAsList = createSelector(
|
||||
|
||||
export const getAuctionItems = createSelector(
|
||||
[getState],
|
||||
(state) => state.get('items').filter(i => i.type === 'auction') || new Map(),
|
||||
(state) => state.get('items').filter((i) => i.type === 'auction') || new Map(),
|
||||
);
|
||||
|
||||
export const getAuctionItemsAsList = createSelector(
|
||||
@@ -29,7 +29,7 @@ export const getAuctionItemsAsList = createSelector(
|
||||
|
||||
export const getAuctionItemsUserIsBidding = createSelector(
|
||||
[getAuctionItems, getMyBidItemIds],
|
||||
(items, myBids) => items.filter(i => myBids.indexOf(i.id)) || new Map(),
|
||||
(items, myBids) => items.filter((i) => myBids.indexOf(i.id)) || new Map(),
|
||||
);
|
||||
|
||||
export const getAuctionItemsUserIsBiddingAsList = createSelector(
|
||||
@@ -39,7 +39,7 @@ export const getAuctionItemsUserIsBiddingAsList = createSelector(
|
||||
|
||||
export const getAuctionItemsUserIsWinning = createSelector(
|
||||
[getAuctionItemsUserIsBidding, getMyWinningItemIds],
|
||||
(items, myWins) => items.filter(i => myWins.indexOf(i.id)) || new Map(),
|
||||
(items, myWins) => items.filter((i) => myWins.indexOf(i.id)) || new Map(),
|
||||
);
|
||||
|
||||
export const getAuctionItemsUserIsWinningAsList = createSelector(
|
||||
@@ -49,7 +49,7 @@ export const getAuctionItemsUserIsWinningAsList = createSelector(
|
||||
|
||||
export const getAuctionItemsWithNoBids = createSelector(
|
||||
[getAuctionItems, getItemsIdsWithNoBids],
|
||||
(items, noBids) => items.filter(i => noBids.indexOf(i.id)) || new Map(),
|
||||
(items, noBids) => items.filter((i) => noBids.indexOf(i.id)) || new Map(),
|
||||
);
|
||||
|
||||
export const getAuctionItemsWithNoBidsAsList = createSelector(
|
||||
@@ -59,7 +59,7 @@ export const getAuctionItemsWithNoBidsAsList = createSelector(
|
||||
|
||||
export const getTicketItems = createSelector(
|
||||
[getState],
|
||||
(state) => state.get('items').filter(i => i.type === 'ticket') || new Map(),
|
||||
(state) => state.get('items').filter((i) => i.type === 'ticket') || new Map(),
|
||||
);
|
||||
|
||||
export const getTicketItemsAsList = createSelector(
|
||||
|
||||
@@ -5,10 +5,10 @@ import thunk from 'redux-thunk';
|
||||
|
||||
import rootReducer from '../reducers/index.js';
|
||||
|
||||
const composeEnhancers = composeWithDevTools({ port: 8000, realtime: true, suppressConnectErrors: false });
|
||||
const composeEnhancers = composeWithDevTools({
|
||||
port: 8000,
|
||||
realtime: true,
|
||||
suppressConnectErrors: false,
|
||||
});
|
||||
|
||||
export const store = createStore(
|
||||
rootReducer,
|
||||
Map(),
|
||||
composeEnhancers(applyMiddleware(thunk)),
|
||||
);
|
||||
export const store = createStore(rootReducer, Map(), composeEnhancers(applyMiddleware(thunk)));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/async-storage": "^1.6.1",
|
||||
"eslint-plugin-immutablejs": "^0.1.3",
|
||||
"immutable": "^4.0.0-rc.12",
|
||||
"numeral": "^2.0.6",
|
||||
"prop-types": "^15.7.2",
|
||||
|
||||
Reference in New Issue
Block a user