diff --git a/.eslintrc.js b/.eslintrc.js
index 40c6dcd..33941fa 100644
--- a/.eslintrc.js
+++ b/.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,
+ },
+ },
+ ],
};
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..862bdb6
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,8 @@
+{
+ "arrowParens": "always",
+ "jsxBracketSameLine": false,
+ "singleQuote": true,
+ "tabWidth": 4,
+ "printWidth": 100,
+ "trailingComma": "all"
+}
diff --git a/__tests__/App-test.js b/__tests__/App-test.js
index 1784766..090aefa 100644
--- a/__tests__/App-test.js
+++ b/__tests__/App-test.js
@@ -10,5 +10,5 @@ import App from '../App';
import renderer from 'react-test-renderer';
it('renders correctly', () => {
- renderer.create();
+ renderer.create();
});
diff --git a/app/App.js b/app/App.js
index c0b07db..6c19f99 100644
--- a/app/App.js
+++ b/app/App.js
@@ -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';
diff --git a/app/actions/activeEvent.js b/app/actions/activeEvent.js
new file mode 100644
index 0000000..604d859
--- /dev/null
+++ b/app/actions/activeEvent.js
@@ -0,0 +1,6 @@
+import { SET_ACTIVE_EVENT } from '../constants/actionTypes.js';
+
+export const setActiveEvent = (eventId) => ({
+ type: SET_ACTIVE_EVENT,
+ payload: eventId,
+});
diff --git a/app/actions/auction.js b/app/actions/auction.js
index c9f806d..2377bf4 100644
--- a/app/actions/auction.js
+++ b/app/actions/auction.js
@@ -1,52 +1,54 @@
-import { blockUI, unblockUI } from './index.js';
-
+import { placeBid as placeBidApi } from '../api/bid.js';
import {
- BID_FAILURE,
- BID_SUCCESS,
- PLACE_BID,
- SET_AUCTION_FILTER,
- SET_AUCTION_VIEW_MODE,
+ BID_FAILURE,
+ BID_SUCCESS,
+ PLACE_BID,
+ 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,
+ type: SET_AUCTION_FILTER,
+ payload,
});
export const changeViewMode = (payload) => ({
- type: SET_AUCTION_VIEW_MODE,
- payload,
+ type: SET_AUCTION_VIEW_MODE,
+ 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)));
};
diff --git a/app/actions/auctionStatus.js b/app/actions/auctionStatus.js
index e939d04..c3df807 100644
--- a/app/actions/auctionStatus.js
+++ b/app/actions/auctionStatus.js
@@ -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 payload = List(auctions).map((i) => Auction.fromJS(i));
- dispatch({ type: AUCTIONS_UPDATED, payload });
- dispatch(unblockUI);
+const autionStatusLoadSuccess = (auctions) => (dispatch) => {
+ const payload = List(auctions).map((i) => Auction.fromJS(i));
+ 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));
};
-
diff --git a/app/actions/events.js b/app/actions/events.js
index b52ef30..9e03bd6 100644
--- a/app/actions/events.js
+++ b/app/actions/events.js
@@ -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 payload = List(items).map((i) => Event.fromJS(i));
+ dispatch(eventsLoaded(payload));
};
const eventsFetchFailure = (error) => (dispatch) => {
- console.error('[actions::events::eventsFetchFailure]', error);
- dispatch(eventsLoadError(error));
- dispatch(unblockUI);
+ console.error('[actions::events::eventsFetchFailure]', error);
+ dispatch(eventsLoadError(error));
};
export const fetchEvents = () => (dispatch, getState) => {
- const authToken = getAuthToken(getState());
+ const authToken = getAuthToken(getState());
- fetchEventsApi(authToken)
- .then(payload => dispatch(eventsFetchSuccess(payload)))
- .catch(err => dispatch(eventsFetchFailure(err)));
+ dispatch(beginFetchEvents());
+ fetchEventsApi(authToken)
+ .then((payload) => dispatch(eventsFetchSuccess(payload)))
+ .catch((err) => dispatch(eventsFetchFailure(err)));
};
diff --git a/app/actions/index.js b/app/actions/index.js
index 2b7aac3..39add96 100644
--- a/app/actions/index.js
+++ b/app/actions/index.js
@@ -1,12 +1,9 @@
-import {
- BLOCK_UI,
- UNBLOCK_UI,
-} from '../constants/actionTypes.js';
+import { BLOCK_UI, UNBLOCK_UI } from '../constants/actionTypes.js';
export const blockUI = () => ({
- type: BLOCK_UI,
+ type: BLOCK_UI,
});
export const unblockUI = () => ({
- type: UNBLOCK_UI,
+ type: UNBLOCK_UI,
});
diff --git a/app/actions/items.js b/app/actions/items.js
index becac35..3fd962a 100644
--- a/app/actions/items.js
+++ b/app/actions/items.js
@@ -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 payload = List(items).map((i) => Item.fromJS(i));
+ dispatch(itemsLoaded(payload));
};
const itemsFetchFailure = (error) => (dispatch) => {
- console.error('[actions::items::itemsFetchFailure]', error);
- dispatch(itemsLoadFailure(error));
- dispatch(unblockUI);
+ console.error('[actions::items::itemsFetchFailure]', error);
+ dispatch(itemsLoadFailure(error));
};
export const fetchItems = () => (dispatch, getState) => {
- const eventId = getActiveEventId(getState());
- const authToken = getAuthToken(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)));
};
diff --git a/app/actions/profile.js b/app/actions/profile.js
index 9e6b0da..412a6bc 100644
--- a/app/actions/profile.js
+++ b/app/actions/profile.js
@@ -1,124 +1,117 @@
import { blockUI, unblockUI } from './index.js';
import {
- getEmailAvailability,
- getNomAvailaibility,
- loginUser,
- registerNewUser,
+ getEmailAvailability,
+ getNomAvailaibility,
+ loginUser,
+ registerNewUser,
} from '../api/profile.js';
import {
- DO_LOGOUT,
- LOGIN_FAILURE,
- LOGIN_SUCCESS,
- PROFILE_EMAIL_AVAILABLE,
- PROFILE_NOM_AVAILABLE,
- UNSET_AUTH,
- UNSET_PROFILE,
- UPDATE_PROFILE,
+ DO_LOGOUT,
+ LOGIN_FAILURE,
+ LOGIN_SUCCESS,
+ PROFILE_EMAIL_AVAILABLE,
+ PROFILE_NOM_AVAILABLE,
+ REGISTRATION_FAILURE,
+ REGISTRATION_SUCCESS,
+ UNSET_AUTH,
+ UNSET_PROFILE,
+ UPDATE_PROFILE,
} from '../constants/actionTypes.js';
const isValidEmail = (payload) => ({
- type: PROFILE_EMAIL_AVAILABLE,
- payload,
+ type: PROFILE_EMAIL_AVAILABLE,
+ payload,
});
const isValidNom = (payload) => ({
- type: PROFILE_NOM_AVAILABLE,
- payload,
+ type: PROFILE_NOM_AVAILABLE,
+ payload,
});
const loginFailure = (payload) => ({
- type: LOGIN_FAILURE,
- payload,
+ type: LOGIN_FAILURE,
+ payload,
});
const loginSuccess = (payload) => ({
- type: LOGIN_SUCCESS,
- payload,
+ type: LOGIN_SUCCESS,
+ payload,
});
const logoutUser = () => ({
- type: DO_LOGOUT,
+ type: DO_LOGOUT,
});
const registrationFailure = (payload) => ({
- type: REGISTRATION_FAILURE,
- payload,
+ type: REGISTRATION_FAILURE,
+ payload,
});
const registrationSuccess = (payload) => ({
- type: REGISTRATION_SUCCESS,
- payload,
+ type: REGISTRATION_SUCCESS,
+ payload,
});
const unsetAuth = () => ({
- type: UNSET_AUTH,
+ type: UNSET_AUTH,
});
const unsetProfile = () => ({
- type: UNSET_PROFILE,
+ type: UNSET_PROFILE,
});
const updateProfile = (profile) => ({
- type: UPDATE_PROFILE,
- payload: profile,
+ type: UPDATE_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))
- })
- .catch(err => dispatch(loginFailure(err)));
+ dispatch(blockUI());
+ loginUser(username, password)
+ .then((result) => {
+ dispatch(loginSuccess(result));
+ })
+ .catch((err) => dispatch(loginFailure(err)));
};
export const logout = () => (dispatch) => {
- dispatch(unsetProfile());
- dispatch(unsetAuth());
- dispatch(logoutUser());
+ dispatch(unsetProfile());
+ dispatch(unsetAuth());
+ dispatch(logoutUser());
};
// USER REGISTRATION
const handleRegistrationSuccess = (user) => (dispatch) => {
- dispatch(unblockUI());
- dispatch(registrationSuccess());
- dispatch(loginSuccess(user));
+ dispatch(unblockUI());
+ dispatch(registrationSuccess());
+ dispatch(loginSuccess(user));
};
const handleRegistrationFailure = (error) => (dispatch) => {
- dispatch(unblockUI());
- dispatch(registrationFailure(error));
+ dispatch(unblockUI());
+ dispatch(registrationFailure(error));
};
export const registerUser = (user) => (dispatch) => {
- dispatch(blockUI());
- registerNewUser(user)
- .then(user => dispatch(handleRegistrationSuccess(user)))
- .catch(err => dispatch(handleRegistrationFailure(err)));
+ dispatch(blockUI());
+ registerNewUser(user)
+ .then((user) => dispatch(handleRegistrationSuccess(user)))
+ .catch((err) => dispatch(handleRegistrationFailure(err)));
};
// FACEBOOK
export const facebookLoginSuccess = (result) => (dispatch) => {
- console.log('facebookLoginSuccess', result);
- dispatch(facebookLoginSuccess(result));
+ console.log('facebookLoginSuccess', result);
+ 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) => {};
diff --git a/app/api/auctionStatus.js b/app/api/auctionStatus.js
new file mode 100644
index 0000000..fe6eb54
--- /dev/null
+++ b/app/api/auctionStatus.js
@@ -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);
+};
diff --git a/app/api/bid.js b/app/api/bid.js
new file mode 100644
index 0000000..3efee96
--- /dev/null
+++ b/app/api/bid.js
@@ -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,
+ });
+};
diff --git a/app/api/events.js b/app/api/events.js
index e08ab70..8f367da 100644
--- a/app/api/events.js
+++ b/app/api/events.js
@@ -1,6 +1,6 @@
import { API_ENDPOINTS, requestGet } from './index.js';
export const fetchEvents = (auth) => {
- const opts = { Authorization: auth ? `Bearer ${auth}` : null };
- return requestGet(API_ENDPOINTS.GET_EVENTS, null, opts);
+ const opts = { Authorization: auth ? `Bearer ${auth}` : null };
+ return requestGet(API_ENDPOINTS.GET_EVENTS, null, opts);
};
diff --git a/app/api/helpers.js b/app/api/helpers.js
index 2ddea3c..dadd206 100644
--- a/app/api/helpers.js
+++ b/app/api/helpers.js
@@ -1,21 +1,23 @@
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;
+ let url = path;
- if (host) {
- url = `${host}${url}`;
- }
+ if (host) {
+ url = `${host}${url}`;
+ }
- if (params) {
- url = `${url}?${params}`;
- }
+ if (params) {
+ url = `${url}?${params}`;
+ }
- return url;
+ return url;
};
/**
@@ -26,59 +28,57 @@ export const constructUrl = (path, params, host = API_URL) => {
* this serializes data in a way that helps support legacy endpoints
*/
export const formatPostData = (body) => {
- const postData = new FormData();
- Object.keys(body).forEach(key => postData.append(key, body[key]));
- return postData;
+ const postData = new FormData();
+ Object.keys(body).forEach((key) => postData.append(key, body[key]));
+ return postData;
};
const parseQueryParamsString = (queryParams) => {
- if (typeof queryParams !== 'string') {
- return null;
- }
+ if (typeof queryParams !== 'string') {
+ return null;
+ }
- return queryParams;
+ return queryParams;
};
const parseQueryParamsObject = (queryParams) => {
- if (queryParams === null || typeof queryParams !== 'object' || Array.isArray(queryParams)) {
- return null;
- }
+ if (queryParams === null || typeof queryParams !== 'object' || Array.isArray(queryParams)) {
+ return null;
+ }
- return Object
- .keys(queryParams)
- .map((key) => {
- const value = queryParams[key];
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
- })
- .join('&');
+ return Object.keys(queryParams)
+ .map((key) => {
+ const value = queryParams[key];
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
+ })
+ .join('&');
};
const parseQueryParamsArray = (queryParams) => {
- if (!Array.isArray(queryParams)) {
- return null;
- }
+ if (!Array.isArray(queryParams)) {
+ return null;
+ }
- return queryParams
- .map((param) => {
- const [key, value] = param.split('=');
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
- })
- .join('&');
+ return queryParams
+ .map((param) => {
+ const [key, value] = param.split('=');
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
+ })
+ .join('&');
};
-export const parseQueryParams = queryParams => (
- parseQueryParamsString(queryParams) ||
- parseQueryParamsObject(queryParams) ||
- parseQueryParamsArray(queryParams) ||
- ''
-);
+export const parseQueryParams = (queryParams) =>
+ parseQueryParamsString(queryParams) ||
+ parseQueryParamsObject(queryParams) ||
+ parseQueryParamsArray(queryParams) ||
+ '';
export const request = (url, options) => {
- try {
- return fetch(url, options).catch((err) => console.error(err));
- } catch (error) {
- return Promise.reject(error);
- }
+ try {
+ return fetch(url, options).catch((err) => console.error(err));
+ } catch (error) {
+ return Promise.reject(error);
+ }
};
export const unwrapJson = (response) => response.json();
diff --git a/app/api/index.js b/app/api/index.js
index 37f1020..89c035c 100644
--- a/app/api/index.js
+++ b/app/api/index.js
@@ -1,95 +1,95 @@
import {
- constructUrl,
- formatPostData,
- parseQueryParams,
- request,
- unwrapJson,
- validateResponse,
+ constructUrl,
+ formatPostData,
+ parseQueryParams,
+ request,
+ unwrapJson,
+ validateResponse,
} from './helpers.js';
import { API_URL } from '../constants/constants.js';
const DefaultRequestOptions = {};
-const endpoints = {
- // Events and Items
- GET_EVENTS: '/events',
-// GET_ITEMS: '/items?eventId=:event_id',
- GET_ITEMS: '/items',
+export const API_ENDPOINTS = {
+ // Events and Items
+ GET_EVENTS: '/events',
+ // GET_ITEMS: '/items?eventId=:event_id',
+ GET_ITEMS: '/items',
- // Auction Interactions
-// GET_STATUS: '/auction/:event_id',
- GET_STATUS: '/auction',
- PLACE_BID: '/bids/:item_id',
- PURCHASE_ITEM: '/sales',
+ // Auction Interactions
+ // GET_STATUS: '/auction/:event_id',
+ GET_STATUS: '/auction',
+ PLACE_BID: '/bids',
+ PURCHASE_ITEM: '/sales',
- // User/Profile
- USER_SIGNUP: '/signup',
- USER_PROFILE: '/users/:user_id',
+ // User/Profile
+ USER_SIGNUP: '/signup',
+ USER_PROFILE: '/users/:user_id',
- VALIDATE_SIGNUP_EMAIL: '/signup/validate/email',
- VALIDATE_SIGNUP_NOM: '/signup/validate/nom',
+ VALIDATE_SIGNUP_EMAIL: '/signup/validate/email',
+ VALIDATE_SIGNUP_NOM: '/signup/validate/nom',
- // Services
- APPLE_SIGNUP: '/auth/apple/login',
- APPLE_LINK: '/auth/apple/link',
- FACEBOOK_SIGNUP: '/auth/facebook/login',
- FACEBOOK_LINK: '/auth/facebook/link',
- GOOGLE_SIGNUP: '/auth/google/login',
- GOOGLE_LINK: '/auth/google/link',
+ // Services
+ APPLE_SIGNUP: '/auth/apple/login',
+ APPLE_LINK: '/auth/apple/link',
+ FACEBOOK_SIGNUP: '/auth/facebook/login',
+ FACEBOOK_LINK: '/auth/facebook/link',
+ GOOGLE_SIGNUP: '/auth/google/login',
+ GOOGLE_LINK: '/auth/google/link',
};
const cacheBuster = () => {
- const timestamp = String(Date.now());
- return `?buster=${timestamp}`;
+ const timestamp = String(Date.now());
+ return `?buster=${timestamp}`;
};
export const getEndpointUrl = (endpoint) => {
- if (!endpoints[endpoint]) {
- throw new Error('Invalid API endpoint specified');
- }
+ if (!endpoints[endpoint]) {
+ throw new Error('Invalid API endpoint specified');
+ }
- return `${API_URL}${endpoints[endpoint]}`; //`${cacheBuster()}`;
+ return `${API_URL}${endpoints[endpoint]}`; //`${cacheBuster()}`;
};
export const requestGet = (path, queryParams = [], requestOptions = {}) => {
- const params = parseQueryParams(queryParams);
+ const params = parseQueryParams(queryParams);
- if (params === null) {
- throw new Error('Invalid queryParams');
- }
+ if (params === null) {
+ throw new Error('Invalid queryParams');
+ }
- return request(constructUrl(path, params), {
- ...DefaultRequestOptions,
- ...requestOptions
+ return request(constructUrl(path, params), {
+ ...DefaultRequestOptions,
+ ...requestOptions,
})
- .then(validateResponse)
- .then(unwrapJson);
+ .then(validateResponse)
+ .then(unwrapJson);
};
export const requestPost = (options) => {
- const {
- path,
- body = {},
- queryParams = [],
- requestOptions = {},
- isFormattedPostData = false
- } = options;
+ const {
+ path,
+ body = {},
+ queryParams = [],
+ requestOptions = {},
+ isFormattedPostData = false,
+ } = options;
- const params = parseQueryParams(queryParams || []);
+ const params = parseQueryParams(queryParams || []);
- if (params === null) {
- throw new Error('invalid queryParams');
- }
+ if (params === null) {
+ throw new Error('invalid queryParams');
+ }
- // Additional formatting happens in `formatPostData()`
- // like handling what jQuery calls `traditional` form data
- return request(constructUrl(path, params), {
- ...DefaultRequestOptions,
- ...requestOptions,
- method: 'POST',
- body: isFormattedPostData ? body : formatPostData(body)
+ // Additional formatting happens in `formatPostData()`
+ // like handling what jQuery calls `traditional` form data
+ return request(constructUrl(path, params), {
+ ...DefaultRequestOptions,
+ ...requestOptions,
+ method: 'POST',
+ body: isFormattedPostData ? body : formatPostData(body),
})
- .then(validateResponse)
- .then(unwrapJson);
+ .then(validateResponse)
+ .then(unwrapJson);
};
diff --git a/app/api/items.js b/app/api/items.js
index f1ece26..dd04a09 100644
--- a/app/api/items.js
+++ b/app/api/items.js
@@ -1,7 +1,7 @@
import { API_ENDPOINTS, requestGet } from './index.js';
export const fetchItems = (eventId, auth) => {
- const path = String(API_ENDPOINTS.GET_ITEMS).replace(/:event_id$/, eventId);
- const opts = { Authorization: auth ? `Bearer ${auth}` : null };
- return requestGet(path, null, opts);
+ const path = String(API_ENDPOINTS.GET_ITEMS).replace(/:event_id$/, eventId);
+ const opts = { Authorization: auth ? `Bearer ${auth}` : null };
+ return requestGet(path, null, opts);
};
diff --git a/app/api/profile.js b/app/api/profile.js
index a674339..639e907 100644
--- a/app/api/profile.js
+++ b/app/api/profile.js
@@ -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({
- path: API_ENDPOINTS.LOGIN,
- body: { username, password },
-});
+export const loginUser = (username, password) =>
+ requestPost({
+ path: API_ENDPOINTS.LOGIN,
+ body: { username, password },
+ });
-export const registerNewUser = (user) => requestPost({
- path: API_ENDPOINTS.USER_SIGNUP,
- body: { user },
-});
+export const registerNewUser = (user) =>
+ requestPost({
+ path: API_ENDPOINTS.USER_SIGNUP,
+ body: { user },
+ });
diff --git a/app/components/AppHeader/AppHeader.container.js b/app/components/AppHeader/AppHeader.container.js
index 536ea7a..b765897 100644
--- a/app/components/AppHeader/AppHeader.container.js
+++ b/app/components/AppHeader/AppHeader.container.js
@@ -5,7 +5,10 @@ import { fetchEvents } from '../../actions/events.js';
import AppHeader from './AppHeader.js';
const matchDispatchToProps = (dispatch) => ({
- fetchEvents: () => dispatch(fetchEvents()),
+ fetchEvents: () => dispatch(fetchEvents()),
});
-export default connect(null, matchDispatchToProps)(AppHeader);
+export default connect(
+ null,
+ matchDispatchToProps,
+)(AppHeader);
diff --git a/app/components/AppHeader/AppHeader.js b/app/components/AppHeader/AppHeader.js
index 17233c8..c6218f3 100644
--- a/app/components/AppHeader/AppHeader.js
+++ b/app/components/AppHeader/AppHeader.js
@@ -10,27 +10,26 @@ import HeaderContentRight from './HeaderContentRight.container.js';
import styles from './AppHeader.styles.js';
export default class AppHeader extends Component {
+ static get propTypes() {
+ return {
+ fetchEvents: PropTypes.func.isRequired,
+ };
+ }
- static get propTypes() {
- return {
- fetchEvents: PropTypes.func.isRequired,
- };
- }
+ componentDidMount() {
+ this.props.fetchEvents();
+ }
- componentDidMount() {
- this.props.fetchEvents();
- }
+ render() {
+ const { navigation } = this.props;
- render () {
- const { navigation } = this.props;
-
- return (
- }
- centerComponent={}
- rightComponent={}
- />
- );
- }
+ return (
+ }
+ centerComponent={}
+ rightComponent={}
+ />
+ );
+ }
}
diff --git a/app/components/AppHeader/HeaderContentLeft.container.js b/app/components/AppHeader/HeaderContentLeft.container.js
index a9b0d62..e56f8a2 100644
--- a/app/components/AppHeader/HeaderContentLeft.container.js
+++ b/app/components/AppHeader/HeaderContentLeft.container.js
@@ -5,12 +5,15 @@ import { hasMultipleEvents } from '../../selectors/events.js';
import HeaderContentLeft from './HeaderContentLeft.js';
const matchStateToProps = (state, ownProps) => {
- const { routeName } = ownProps.navigation.state;
+ const { routeName } = ownProps.navigation.state;
- return {
- activeRoute: routeName,
- hasMultipleEvents: hasMultipleEvents(state),
- };
+ return {
+ activeRoute: routeName,
+ hasMultipleEvents: hasMultipleEvents(state),
+ };
};
-export default connect(matchStateToProps, null)(HeaderContentLeft);
+export default connect(
+ matchStateToProps,
+ null,
+)(HeaderContentLeft);
diff --git a/app/components/AppHeader/HeaderContentLeft.js b/app/components/AppHeader/HeaderContentLeft.js
index d22354f..4915467 100644
--- a/app/components/AppHeader/HeaderContentLeft.js
+++ b/app/components/AppHeader/HeaderContentLeft.js
@@ -1,53 +1,43 @@
import React from 'react';
import PropTypes from 'prop-types';
-import {
- Text,
- TouchableOpacity,
- View,
-} from 'react-native';
+import { Text, TouchableOpacity, View } from 'react-native';
import BackIcon from './IconButtons/BackIcon.js';
import EventsIcon from './IconButtons/EventsIcon.js';
-export default function HeaderContentLeft({
- activeRoute,
- hasMultipleEvents,
- navigation,
-}) {
+export default function HeaderContentLeft({ activeRoute, hasMultipleEvents, navigation }) {
+ const _goBack = () => {
+ if (hasActiveEvent) {
+ navigation.goBack();
+ return false;
+ }
- const _goBack = () => {
- if (hasActiveEvent) {
- navigation.goBack();
- return false;
+ console.log('nowhere to go...');
+ };
+
+ const _showEvents = () => {
+ navigation.navigate('Events');
+ return false;
+ };
+
+ if (activeRoute === 'Events') {
+ return ;
}
- console.log('nowhere to go...');
- };
+ if (activeRoute === 'Profile') {
+ return ;
+ }
- const _showEvents = () => {
- navigation.navigate('Events');
- return false;
- };
-
-
- if (activeRoute === 'Events') {
- return ;
- }
-
- if (activeRoute === 'Profile') {
- return ;
- }
-
- return
+ return ;
}
HeaderContentLeft.propTypes = {
- activeRoute: PropTypes.string.isRequired,
- hasActiveEvent: PropTypes.bool,
- navigation: PropTypes.func.isRequired,
+ activeRoute: PropTypes.string.isRequired,
+ hasActiveEvent: PropTypes.bool,
+ navigation: PropTypes.func.isRequired,
};
HeaderContentLeft.defaultProps = {
- hasActiveEvent: false,
+ hasActiveEvent: false,
};
diff --git a/app/components/AppHeader/HeaderContentRight.container.js b/app/components/AppHeader/HeaderContentRight.container.js
index b4ad083..52f77c4 100644
--- a/app/components/AppHeader/HeaderContentRight.container.js
+++ b/app/components/AppHeader/HeaderContentRight.container.js
@@ -5,8 +5,11 @@ import { getProfileAvatarUrl } from '../../selectors/profile.js';
import HeaderContentRight from './HeaderContentRight.js';
const matchStateToProps = (state, ownProps) => ({
- avatarUrl: getProfileAvatarUrl(state),
- hideUserProfileButton: ownProps.navigation.state.routeName === 'Profile',
+ avatarUrl: getProfileAvatarUrl(state),
+ hideUserProfileButton: ownProps.navigation.state.routeName === 'Profile',
});
-export default connect(matchStateToProps, null)(HeaderContentRight);
+export default connect(
+ matchStateToProps,
+ null,
+)(HeaderContentRight);
diff --git a/app/components/AppHeader/HeaderContentRight.js b/app/components/AppHeader/HeaderContentRight.js
index 9d693df..07b90df 100644
--- a/app/components/AppHeader/HeaderContentRight.js
+++ b/app/components/AppHeader/HeaderContentRight.js
@@ -4,14 +4,13 @@ import PropTypes from 'prop-types';
import UserProfileButton from './UserProfileButton/UserProfileButton.container.js';
export default function HeaderContentRight({ hideUserProfileButton, navigation }) {
+ if (hideUserProfileButton) {
+ return null;
+ }
- if (hideUserProfileButton) {
- return null;
- }
-
- return ;
+ return ;
}
HeaderContentRight.propTypes = {
- hideUserProfileButton: PropTypes.bool.isRequired,
+ hideUserProfileButton: PropTypes.bool.isRequired,
};
diff --git a/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.container.js b/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.container.js
index 77bfcd8..69ea31e 100644
--- a/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.container.js
+++ b/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.container.js
@@ -5,14 +5,17 @@ import { getActiveEvent, getDefaultEvent } from '../../../../selectors/events.js
import EventTitle from './EventTitle.js';
const matchStateToProps = (state) => {
- const event = hasActiveEvent(state) ? getActiveEvent(state) : getDefaultEvent(state);
+ const event = hasActiveEvent(state) ? getActiveEvent(state) : getDefaultEvent(state);
- return {
- date: event.get('date'),
- end: event.get('end'),
- name: event.get('name'),
- start: event.get('start'),
- };
+ return {
+ date: event.get('date'),
+ end: event.get('end'),
+ name: event.get('name'),
+ start: event.get('start'),
+ };
};
-export default connect(matchStateToProps, null)(EventTitle);
+export default connect(
+ matchStateToProps,
+ null,
+)(EventTitle);
diff --git a/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.js b/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.js
index 7a3a87f..6a0958a 100644
--- a/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.js
+++ b/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.js
@@ -1,43 +1,33 @@
import React from 'react';
import PropTypes from 'prop-types';
-import {
- Text,
- TouchableOpacity,
- View,
-} from 'react-native';
+import { Text, TouchableOpacity, View } from 'react-native';
import styles from './EventTitle.styles.js';
-export default function EventTitle({
- action,
- date,
- end,
- name,
- start,
-}) {
- const _generateEventTitle = () => (
-
- {name}
- {`${date} | ${start} - ${end}`}
-
- );
+export default function EventTitle({ action, date, end, name, start }) {
+ const _generateEventTitle = () => (
+
+ {name}
+ {`${date} | ${start} - ${end}`}
+
+ );
- if (action) {
- return {_generateEventTitle()};
- }
+ if (action) {
+ return {_generateEventTitle()};
+ }
- return _generateEventTitle();
+ return _generateEventTitle();
}
EventTitle.propTypes = {
- action: PropTypes.func,
- date: PropTypes.string.isRequired,
- end: PropTypes.string.isRequired,
- name: PropTypes.string.isRequired,
- start: PropTypes.string.isRequired,
+ action: PropTypes.func,
+ date: PropTypes.string.isRequired,
+ end: PropTypes.string.isRequired,
+ name: PropTypes.string.isRequired,
+ start: PropTypes.string.isRequired,
};
EventTitle.defaultProps = {
- action: null,
+ action: null,
};
diff --git a/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.styles.js b/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.styles.js
index 1140069..16fe7ff 100644
--- a/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.styles.js
+++ b/app/components/AppHeader/HeaderTitle/EventTitle/EventTitle.styles.js
@@ -1,14 +1,14 @@
import { StyleSheet } from 'react-native';
-export const styles = StyleSheet.create({
- eventInfo: {
- flexDirection: 'row',
- },
- eventName: {
- flex: 1,
- fontWeight: 'bold',
- },
- eventDate: {
- flex: 1,
- },
-});
+export default (styles = StyleSheet.create({
+ eventInfo: {
+ flexDirection: 'row',
+ },
+ eventName: {
+ flex: 1,
+ fontWeight: 'bold',
+ },
+ eventDate: {
+ flex: 1,
+ },
+}));
diff --git a/app/components/AppHeader/HeaderTitle/HeaderTitle.container.js b/app/components/AppHeader/HeaderTitle/HeaderTitle.container.js
index 1c3584a..8b1f2fb 100644
--- a/app/components/AppHeader/HeaderTitle/HeaderTitle.container.js
+++ b/app/components/AppHeader/HeaderTitle/HeaderTitle.container.js
@@ -6,13 +6,16 @@ import { hasMultipleEvents } from '../../../selectors/events.js';
import HeaderTitle from './HeaderTitle.js';
const matchStateToProps = (state, ownProps) => {
- const { routeName } = ownProps.navigation.state;
+ const { routeName } = ownProps.navigation.state;
- return {
- activeRoute: routeName,
- hasActiveEvent: hasActiveEvent(state),
- hasMultipleEvents: hasMultipleEvents(state),
- };
+ return {
+ activeRoute: routeName,
+ hasActiveEvent: hasActiveEvent(state),
+ hasMultipleEvents: hasMultipleEvents(state),
+ };
};
-export default connect(matchStateToProps, null)(HeaderTitle);
+export default connect(
+ matchStateToProps,
+ null,
+)(HeaderTitle);
diff --git a/app/components/AppHeader/HeaderTitle/HeaderTitle.js b/app/components/AppHeader/HeaderTitle/HeaderTitle.js
index 4a583e0..6429c4e 100644
--- a/app/components/AppHeader/HeaderTitle/HeaderTitle.js
+++ b/app/components/AppHeader/HeaderTitle/HeaderTitle.js
@@ -1,60 +1,54 @@
import React from 'react';
import PropTypes from 'prop-types';
-import {
- Text,
- TouchableOpacity,
- View,
-} from 'react-native';
+import { Text, TouchableOpacity, View } from 'react-native';
import EventTitle from './EventTitle/EventTitle.container.js';
import styles from './HeaderTitle.styles.js';
export default function HeaderTitle({
- activeRoute,
- hasActiveEvent,
- hasMultipleEvents,
- navigation,
+ activeRoute,
+ hasActiveEvent,
+ hasMultipleEvents,
+ navigation,
}) {
+ const _goBack = () => {
+ if (hasActiveEvent) {
+ navigation.goBack();
+ return false;
+ }
- const _goBack = () => {
- if (hasActiveEvent) {
- navigation.goBack();
- return false;
+ console.log('nowhere to go...');
+ };
+
+ const _showEvents = () => {
+ navigation.navigate('Events');
+ return false;
+ };
+
+ if (activeRoute === 'Events') {
+ return (
+
+ Profile
+
+ );
}
- console.log('nowhere to go...');
- };
+ if (activeRoute === 'Profile') {
+ return Profile;
+ }
- const _showEvents = () => {
- navigation.navigate('Events');
- return false;
- };
-
-
- if (activeRoute === 'Events') {
- return (
-
- Profile
-
- );
- }
-
- if (activeRoute === 'Profile') {
- return Profile;
- }
-
- return
+ return ;
}
HeaderTitle.propTypes = {
- activeRoute: PropTypes.string.isRequired,
- hasActiveEvent: PropTypes.bool,
- hasMultipleEvents: PropTypes.bool.isRequired,
- navigation: PropTypes.func.isRequired,
+ activeRoute: PropTypes.string.isRequired,
+ hasActiveEvent: PropTypes.bool,
+ hasMultipleEvents: PropTypes.bool.isRequired,
+ navigation: PropTypes.func.isRequired,
};
HeaderTitle.defaultProps = {
- hasActiveEvent: false,
+ hasActiveEvent: false,
};
diff --git a/app/components/AppHeader/HeaderTitle/HeaderTitle.styles.js b/app/components/AppHeader/HeaderTitle/HeaderTitle.styles.js
index e0207bc..e4c5889 100644
--- a/app/components/AppHeader/HeaderTitle/HeaderTitle.styles.js
+++ b/app/components/AppHeader/HeaderTitle/HeaderTitle.styles.js
@@ -1,15 +1,14 @@
import { StyleSheet } from 'react-native';
-export const styles = StyleSheet.create({
- filterBar: {
- backgroundColor: '#0F0',
- flexDirection: 'row',
- },
- filter: {
- flex: 2,
- },
- view: {
- flex: 2,
- },
-});
-
+export default (styles = StyleSheet.create({
+ filterBar: {
+ backgroundColor: '#0F0',
+ flexDirection: 'row',
+ },
+ filter: {
+ flex: 2,
+ },
+ view: {
+ flex: 2,
+ },
+}));
diff --git a/app/components/AppHeader/IconButtons/BackIcon.js b/app/components/AppHeader/IconButtons/BackIcon.js
index dfa08e8..c2e314d 100644
--- a/app/components/AppHeader/IconButtons/BackIcon.js
+++ b/app/components/AppHeader/IconButtons/BackIcon.js
@@ -5,13 +5,13 @@ import { TouchableOpacity } from 'react-native';
import { Icon } from 'react-native-elements';
export default function BackIcon({ action }) {
- return (
-
- ;
-
- );
+ return (
+
+ ;
+
+ );
}
BackIcon.propTypes = {
- action: PropTypes.func.isRequired,
+ action: PropTypes.func.isRequired,
};
diff --git a/app/components/AppHeader/IconButtons/EventsIcon.js b/app/components/AppHeader/IconButtons/EventsIcon.js
index d100ba6..2f37b28 100644
--- a/app/components/AppHeader/IconButtons/EventsIcon.js
+++ b/app/components/AppHeader/IconButtons/EventsIcon.js
@@ -5,20 +5,19 @@ import { TouchableOpacity } from 'react-native';
import { Icon } from 'react-native-elements';
export default function EventsIcon({ action }) {
+ const renderEventsIcon = () => ;
- const renderEventsIcon = () => ;
+ if (action) {
+ return {renderEventsIcon()};
+ }
- if (action) {
- return {renderEventsIcon()};
- }
-
- return renderEventsIcon();
+ return renderEventsIcon();
}
EventsIcon.propTypes = {
- action: PropTypes.func,
+ action: PropTypes.func,
};
EventsIcon.defaultProps = {
- action: null,
+ action: null,
};
diff --git a/app/components/AppHeader/UserProfileButton/UserProfileButton.container.js b/app/components/AppHeader/UserProfileButton/UserProfileButton.container.js
index b0cb7a2..0832bbb 100644
--- a/app/components/AppHeader/UserProfileButton/UserProfileButton.container.js
+++ b/app/components/AppHeader/UserProfileButton/UserProfileButton.container.js
@@ -5,7 +5,10 @@ import { getProfileAvatarUrl } from '../../../selectors/profile.js';
import UserProfileButton from './UserProfileButton.js';
const matchStateToProps = (state) => ({
- avatarUrl: getProfileAvatarUrl(state),
+ avatarUrl: getProfileAvatarUrl(state),
});
-export default connect(matchStateToProps, null)(UserProfileButton);
+export default connect(
+ matchStateToProps,
+ null,
+)(UserProfileButton);
diff --git a/app/components/AppHeader/UserProfileButton/UserProfileButton.js b/app/components/AppHeader/UserProfileButton/UserProfileButton.js
index 61307ed..1897118 100644
--- a/app/components/AppHeader/UserProfileButton/UserProfileButton.js
+++ b/app/components/AppHeader/UserProfileButton/UserProfileButton.js
@@ -7,29 +7,28 @@ import { Icon } from 'react-native-elements';
import styles from './UserProfileButton.styles.js';
export default function UserProfileButton({ avatarUrl, navigation }) {
+ const _goToProfile = () => {
+ navigation.navigate('Profile');
+ return false;
+ };
- const _goToProfile = () => {
- navigation.navigate('Profile');
- return false;
- };
-
- return (
-
- {avatarUrl !== null ? (
-
-
-
- ) : (
-
- )}
-
- );
+ return (
+
+ {avatarUrl !== null ? (
+
+
+
+ ) : (
+
+ )}
+
+ );
}
UserProfileButton.propTypes = {
- avatarUrl: PropTypes.string,
+ avatarUrl: PropTypes.string,
};
UserProfileButton.propTypes = {
- avatarUrl: null,
+ avatarUrl: null,
};
diff --git a/app/components/Auction/AuctionListItem.js b/app/components/Auction/AuctionListItem.js
index b3466c0..341b85d 100644
--- a/app/components/Auction/AuctionListItem.js
+++ b/app/components/Auction/AuctionListItem.js
@@ -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';
@@ -18,173 +12,173 @@ import { ITEM_TYPES } from '../../constants/constants.js';
import { formatPrice, getAuctionTime } from '../../library/helpers.js';
export default class AuctionListItem extends Component {
- static get propTypes() {
- return {
- description: PropTypes.string,
- donor: PropTypes.string,
- end: PropTypes.string.isRequired,
- id: PropTypes.string.isRequired,
- images: PropTypes.arrayOf(
- PropTypes.shape({
- url: PropTypes.string,
- }),
- ),
- start: PropTypes.string.isRequired,
- startingPrice: PropTypes.number.isRequired,
- subtitle: PropTypes.string,
- title: PropTypes.string.isRequired,
- type: PropTypes.string.isRequired,
+ static get propTypes() {
+ return {
+ description: PropTypes.string,
+ donor: PropTypes.string,
+ end: PropTypes.string.isRequired,
+ id: PropTypes.string.isRequired,
+ images: PropTypes.arrayOf(
+ PropTypes.shape({
+ url: PropTypes.string,
+ }),
+ ),
+ start: PropTypes.string.isRequired,
+ startingPrice: PropTypes.number.isRequired,
+ subtitle: PropTypes.string,
+ title: PropTypes.string.isRequired,
+ type: PropTypes.string.isRequired,
+ };
+ }
+
+ static get defaultProps() {
+ return {
+ description: null,
+ donor: null,
+ images: null,
+ subtitle: null,
+ };
+ }
+
+ constructor(props) {
+ super(props);
+ }
+
+ _getBidTime = () => {
+ const { end, start } = this.props;
+ return getAuctionTime({ end, start });
};
- }
- static get defaultProps() {
- return {
- description: null,
- donor: null,
- images: null,
- subtitle: null,
+ _viewItemDetail = () => {
+ const { _id: id } = this.props.details;
+ this.props.navigation.navigate('Item', { id });
};
- }
- constructor(props) {
- super(props);
- }
+ render() {
+ const {
+ description,
+ donor,
+ end,
+ id,
+ images,
+ start,
+ startingPrice,
+ subtitle,
+ title,
+ type,
+ } = this.props;
- _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 {
- description,
- donor,
- end,
- id,
- images,
- start,
- startingPrice,
- subtitle,
- title,
- type,
- } = this.props;
-
- return(
-
-
- {images !== null && images.length > 0 && (
-
- )}
-
- {type === ITEM_TYPES.AUCTION && }
-
- {title}
-
-
- {subtitle}
-
- {donor && (
-
- {donor}
-
- )}
- {type === ITEM_TYPES.AUCTION ? (
-
- ) : (
-
- {formatPrice(startingPrice)}
-
- )}
-
- {this._getBidTime()}
-
-
- {description}
-
-
-
-
- );
- }
+ return (
+
+
+ {images !== null && images.length > 0 && (
+
+ )}
+
+ {type === ITEM_TYPES.AUCTION && }
+
+ {title}
+
+
+ {subtitle}
+
+ {donor && (
+
+ {donor}
+
+ )}
+ {type === ITEM_TYPES.AUCTION ? (
+
+ ) : (
+
+ {formatPrice(startingPrice)}
+
+ )}
+
+ {this._getBidTime()}
+
+
+ {description}
+
+
+
+
+ );
+ }
}
const styles = StyleSheet.create({
- description: {
- color: '#777',
- fontSize: 14,
- marginTop: 5,
- paddingLeft: 10,
- paddingRight: 10,
- },
- donor: {
- color: '#777',
- fontSize: 14,
- marginTop: 5,
- paddingLeft: 10,
- },
- image: {
- flex: 1,
- height: undefined,
- width: undefined,
- },
- price: {
- color: '#777',
- fontSize: 16,
- fontWeight: 'bold',
- paddingLeft: 10,
- paddingTop: 5,
- },
- rowContainer: {
- backgroundColor: '#FFF',
- borderRadius: 4,
- flex: 1,
- flexDirection: 'column',
- marginRight: 10,
- marginLeft: 10,
- marginTop: 10,
- padding: 10,
- shadowColor: '#CCC',
- shadowOffset: {
- width: 1,
- height: 1
+ description: {
+ color: '#777',
+ fontSize: 14,
+ marginTop: 5,
+ paddingLeft: 10,
+ paddingRight: 10,
+ },
+ donor: {
+ color: '#777',
+ fontSize: 14,
+ marginTop: 5,
+ paddingLeft: 10,
+ },
+ image: {
+ flex: 1,
+ height: undefined,
+ width: undefined,
+ },
+ price: {
+ color: '#777',
+ fontSize: 16,
+ fontWeight: 'bold',
+ paddingLeft: 10,
+ paddingTop: 5,
+ },
+ rowContainer: {
+ backgroundColor: '#FFF',
+ borderRadius: 4,
+ flex: 1,
+ flexDirection: 'column',
+ marginRight: 10,
+ marginLeft: 10,
+ marginTop: 10,
+ padding: 10,
+ shadowColor: '#CCC',
+ shadowOffset: {
+ width: 1,
+ height: 1,
+ },
+ shadowOpacity: 1.0,
+ shadowRadius: 1,
+ },
+ rowText: {
+ flex: 4,
+ flexDirection: 'column',
+ },
+ subtitle: {
+ color: '#777',
+ fontSize: 14,
+ marginTop: 5,
+ paddingLeft: 10,
+ },
+ timeline: {
+ color: '#777',
+ fontSize: 14,
+ marginTop: 5,
+ paddingLeft: 10,
+ paddingRight: 10,
+ },
+ title: {
+ color: '#777',
+ fontSize: 16,
+ fontWeight: 'bold',
+ paddingLeft: 10,
+ paddingTop: 5,
},
- shadowOpacity: 1.0,
- shadowRadius: 1,
- },
- rowText: {
- flex: 4,
- flexDirection: 'column',
- },
- subtitle: {
- color: '#777',
- fontSize: 14,
- marginTop: 5,
- paddingLeft: 10,
- },
- timeline: {
- color: '#777',
- fontSize: 14,
- marginTop: 5,
- paddingLeft: 10,
- paddingRight: 10,
- },
- title: {
- color: '#777',
- fontSize: 16,
- fontWeight: 'bold',
- paddingLeft: 10,
- paddingTop: 5,
- },
});
diff --git a/app/components/Auction/AuctionPriceAndBidCount.js b/app/components/Auction/AuctionPriceAndBidCount.js
index 94c8aa9..2d25cdd 100644
--- a/app/components/Auction/AuctionPriceAndBidCount.js
+++ b/app/components/Auction/AuctionPriceAndBidCount.js
@@ -3,29 +3,26 @@ 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 (
-
- {`${formatPrice(currentPrice)} (${bidCount} bids)`}
-
- );
+ return (
+
+ {`${formatPrice(currentPrice)} (${bidCount} bids)`}
+
+ );
};
AuctionPriceAndBidCount.propTypes = {
- itemId: PropTypes.string.isRequired,
- bidCount: PropTypes.number.isRequired,
- currentPrice: PropTypes.number.isRequired,
+ itemId: PropTypes.string.isRequired,
+ bidCount: PropTypes.number.isRequired,
+ currentPrice: PropTypes.number.isRequired,
};
const styles = StyleSheet.create({
- currentPriceAndBidCount: {
- color: '#000',
- },
+ currentPriceAndBidCount: {
+ color: '#000',
+ },
});
export default AuctionPriceAndBidCount;
diff --git a/app/components/Auction/BidStatus.js b/app/components/Auction/BidStatus.js
index 64c012d..eceed62 100644
--- a/app/components/Auction/BidStatus.js
+++ b/app/components/Auction/BidStatus.js
@@ -1,44 +1,41 @@
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) {
- return null;
- }
+ if (!isBidding) {
+ return null;
+ }
- const statusBarStyle = isWinning
- ? [ styles.bidStatus, styes.isWinning ]
- : [ styles.bidStatus, styles.isOutbid ];
+ const statusBarStyle = isWinning
+ ? [styles.bidStatus, styes.isWinning]
+ : [styles.bidStatus, styles.isOutbid];
- return (
-
- {isWinning && `Oh no! You have been outbid!`}
- {!isWinning && isBidding && `You have the winning bid! (for now...)`}
-
- );
+ return (
+
+ {isWinning && 'Oh no! You have been outbid!'}
+ {!isWinning && isBidding && 'You have the winning bid! (for now...)'}
+
+ );
};
BidStatus.propTypes = {
- isBidding: PropTypes.bool.isRequired,
- isWinning: PropTypes.bool.isRequired,
- itemId: PropTypes.string.isRequired,
+ isBidding: PropTypes.bool.isRequired,
+ isWinning: PropTypes.bool.isRequired,
+ itemId: PropTypes.string.isRequired,
};
const styles = StyleSheet.create({
- bidStatus: {
- color: '#fff',
- },
- isWinning: {
- backgroundColor: '#F00',
- },
- isOutbid: {
- backgroundColor: '#0F0',
- },
+ bidStatus: {
+ color: '#fff',
+ },
+ isWinning: {
+ backgroundColor: '#F00',
+ },
+ isOutbid: {
+ backgroundColor: '#0F0',
+ },
});
export default BidStatus;
diff --git a/app/components/Auction/FilterBar.js b/app/components/Auction/FilterBar.js
index 2da7503..95b926e 100644
--- a/app/components/Auction/FilterBar.js
+++ b/app/components/Auction/FilterBar.js
@@ -1,42 +1,38 @@
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 }) => (
- Filter
- View
+ Filter
+ View
);
FilterBar.propTypes = {
- changeFilterer: PropTypes.func.isRequired,
- changeViewMode: PropTypes.func.isRequired,
- filterMode: PropTypes.string,
- viewMode: PropTypes.string,
+ changeFilterer: PropTypes.func.isRequired,
+ changeViewMode: PropTypes.func.isRequired,
+ filterMode: PropTypes.string,
+ viewMode: PropTypes.string,
};
FilterBar.defaultProps = {
- filterMode: null,
- viewMode: null,
+ filterMode: null,
+ viewMode: null,
};
const styles = StyleSheet.create({
- filterBar: {
- backgroundColor: '#0F0',
- flexDirection: 'row',
- },
- filter: {
- flex: 2,
- },
- view: {
- flex: 2,
- },
+ filterBar: {
+ backgroundColor: '#0F0',
+ flexDirection: 'row',
+ },
+ filter: {
+ flex: 2,
+ },
+ view: {
+ flex: 2,
+ },
});
export default FilterBar;
diff --git a/app/components/Events/EventListItem.js b/app/components/Events/EventListItem.js
index d1286b1..ed99893 100644
--- a/app/components/Events/EventListItem.js
+++ b/app/components/Events/EventListItem.js
@@ -1,84 +1,79 @@
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,
- 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,
- tagline: PropTypes.string,
- title: PropTypes.string.isRequired,
+ static get propTypes() {
+ return {
+ end: PropTypes.string.isRequired,
+ id: PropTypes.string.isRequired,
+ images: PropTypes.arrayOf(
+ PropTypes.shape({
+ url: PropTypes.string,
+ }),
+ ),
+ setActiveEvent: PropTypes.func.isRequired,
+ showFrom: PropTypes.string.isRequired,
+ showUntil: PropTypes.string.isRequired,
+ start: PropTypes.string.isRequired,
+ tagline: PropTypes.string,
+ name: PropTypes.string.isRequired,
+ };
+ }
+
+ static get defaultProps() {
+ return {
+ images: null,
+ isTicketed: false,
+ postCount: 0,
+ tagline: null,
+ };
+ }
+
+ constructor(props) {
+ super(props);
+ }
+
+ _viewEventDetail = () => {
+ this.props.setActiveEvent(this.props.id);
+ this.props.navigation.navigate('Event');
};
- }
- static get defaultProps() {
- return {
- images: null,
- isTicketed: false,
- postCount: 0,
- tagline: null,
- };
- }
+ render() {
+ const { date, description, end, name, start } = this.props;
- constructor(props) {
- super(props);
- }
-
- _viewEventDetail = () => {
- const { id } = this.props.details;
- this.props.setActiveEvent(id);
- this.props.navigation.navigate('Event');
- }
-
- render() {
- const {
- } = this.props;
-
- return(
-
-
-
-
- );
- }
+ return (
+
+
+ {name}
+ {date}
+
+ {start} - {end}
+
+ {description}
+
+
+ );
+ }
}
const styles = StyleSheet.create({
- rowContainer: {
- backgroundColor: '#FFF',
- borderRadius: 4,
- flex: 1,
- flexDirection: 'column',
- marginRight: 10,
- marginLeft: 10,
- marginTop: 10,
- padding: 10,
- shadowColor: '#CCC',
- shadowOffset: {
- width: 1,
- height: 1
+ rowContainer: {
+ backgroundColor: '#FFF',
+ borderRadius: 4,
+ flex: 1,
+ flexDirection: 'column',
+ marginRight: 10,
+ marginLeft: 10,
+ marginTop: 10,
+ padding: 10,
+ shadowColor: '#CCC',
+ shadowOffset: {
+ width: 1,
+ height: 1,
+ },
+ shadowOpacity: 1.0,
+ shadowRadius: 1,
},
- shadowOpacity: 1.0,
- shadowRadius: 1,
- },
});
diff --git a/app/components/Login/FacebookLogin.container.js b/app/components/Login/FacebookLogin.container.js
index bd46217..eb3d862 100644
--- a/app/components/Login/FacebookLogin.container.js
+++ b/app/components/Login/FacebookLogin.container.js
@@ -1,19 +1,22 @@
import { connect } from 'react-redux';
import {
- facebookLoginSuccess,
- logout,
- registrationServiceError,
- userCanceledRegistration,
+ facebookLoginSuccess,
+ logout,
+ registrationServiceError,
+ userCanceledRegistration,
} from '../../actions/profile.js';
import FacebookLogin from './FacebookLogin.js';
const mapDispatchToProps = (dispatch) => ({
- doCancelAction: () => dispatch(userCanceledRegistration()),
- doErrorAction: (error) => dispatch(registrationServiceError(error)),
- doLogoutAction: () => dispatch(logout()),
- doSuccessAction: (result) => dispatch(facebookLoginSuccess(result)),
+ doCancelAction: () => dispatch(userCanceledRegistration()),
+ doErrorAction: (error) => dispatch(registrationServiceError(error)),
+ doLogoutAction: () => dispatch(logout()),
+ doSuccessAction: (result) => dispatch(facebookLoginSuccess(result)),
});
-export default connect(null, mapDispatchToProps)(FacebookLogin);
+export default connect(
+ null,
+ mapDispatchToProps,
+)(FacebookLogin);
diff --git a/app/components/Login/FacebookLogin.js b/app/components/Login/FacebookLogin.js
index 4d749c3..c3e8a75 100644
--- a/app/components/Login/FacebookLogin.js
+++ b/app/components/Login/FacebookLogin.js
@@ -6,36 +6,33 @@ import { LoginButton } from 'react-native-fbsdk';
import { PERMISSIONS } from '../../constants/constants.js';
export default function FacebookLogin({
- doCancelAction,
- doErrorAction,
- doLogoutAction,
- doSuccessAction,
+ doCancelAction,
+ doErrorAction,
+ doLogoutAction,
+ doSuccessAction,
}) {
-
- return (
-
- {
- if (error) {
- doErrorAction(error);
- } else if (result.isCancelled) {
- doCancelAction();
- } else {
- doSuccessAction(result);
- }
- }
- }
- onLogoutFinished={doLogoutAction}
- />
-
- );
+ return (
+
+ {
+ if (error) {
+ doErrorAction(error);
+ } else if (result.isCancelled) {
+ doCancelAction();
+ } else {
+ doSuccessAction(result);
+ }
+ }}
+ onLogoutFinished={doLogoutAction}
+ />
+
+ );
}
FacebookLogin.propTypes = {
- doCancelAction: PropTypes.func.isRequired,
- doErrorAction: PropTypes.func.isRequired,
- doLogoutAction: PropTypes.func.isRequired,
- doSuccessAction: PropTypes.func.isRequired,
+ doCancelAction: PropTypes.func.isRequired,
+ doErrorAction: PropTypes.func.isRequired,
+ doLogoutAction: PropTypes.func.isRequired,
+ doSuccessAction: PropTypes.func.isRequired,
};
diff --git a/app/components/Login/LocalLogin.container.js b/app/components/Login/LocalLogin.container.js
index cdeb6a7..aa1f891 100644
--- a/app/components/Login/LocalLogin.container.js
+++ b/app/components/Login/LocalLogin.container.js
@@ -5,7 +5,10 @@ import { login } from '../../actions/profile.js';
import LocalLogin from './LocalLogin.js';
const mapDispatchToProps = (dispatch) => ({
- doLoginAction: (username, password) => dispatch(login(username, password)),
+ doLoginAction: (username, password) => dispatch(login(username, password)),
});
-export default connect(null, mapDispatchToProps)(LocalLogin);
+export default connect(
+ null,
+ mapDispatchToProps,
+)(LocalLogin);
diff --git a/app/components/Login/LocalLogin.js b/app/components/Login/LocalLogin.js
index 0f0d621..7fc815b 100644
--- a/app/components/Login/LocalLogin.js
+++ b/app/components/Login/LocalLogin.js
@@ -4,52 +4,47 @@ import PropTypes from 'prop-types';
import { Button, TextInput, View } from 'react-native';
export default function LocalLogin({ doLoginAction }) {
+ const [enabled, setEnableSubmit] = useState(false);
+ const [password, setPassword] = useState(null);
+ const [username, setUsername] = useState(null);
- const [ enabled, setEnableSubmit ] = useState(false);
- const [ password, setPassword ] = useState(null);
- const [ username, setUsername ] = useState(null);
+ const _handleLoginSubmit = () => {
+ doLoginAction(username, password);
+ };
- const _handleLoginSubmit = () => {
- doLoginAction(username, password);
- };
+ const _updateState = (field, value) => {
+ if (field === 'username') {
+ setUsername(value);
+ }
- const _updateState = (field, value) => {
- if (field === 'username') {
- setUsername(value);
- }
+ if (field === 'password') {
+ setPassword(value);
+ }
- if (field === 'password') {
- setPassword(value);
- }
+ if (!!username && !!password) {
+ setEnableSubmit(true);
+ }
+ };
- if (!!username && !!password) {
- setEnableSubmit(true);
- }
- };
-
- return (
-
- _updateState('username', text)}
- value={username}
- />
- _updateState('password', text)}
- value={password}
- />
-
-
- );
+ return (
+
+ _updateState('username', text)}
+ value={username}
+ />
+ _updateState('password', text)}
+ value={password}
+ />
+
+
+ );
}
LocalLogin.propTypes = {
- doLoginAction: PropTypes.func.isRequired,
+ doLoginAction: PropTypes.func.isRequired,
};
diff --git a/app/constants/constants.js b/app/constants/constants.js
index 77ba6cf..61f63ae 100644
--- a/app/constants/constants.js
+++ b/app/constants/constants.js
@@ -1,53 +1,53 @@
export const ITEM_FILTERS = {
- ALL: 'ALL',
+ ALL: 'ALL',
};
export const ITEM_TYPES = {
- AUCTION: 'auction',
- DONATION: 'donation',
- EVENT: 'event',
- MEMBERSHIP: 'membership',
- POPUP: 'popup',
- RAFFLE: 'raffle',
- TICKET: 'ticket',
+ AUCTION: 'auction',
+ DONATION: 'donation',
+ EVENT: 'event',
+ MEMBERSHIP: 'membership',
+ POPUP: 'popup',
+ RAFFLE: 'raffle',
+ TICKET: 'ticket',
};
export const SORT_MODES = {
- BIDDERS_ASC: 'BIDDERS_ASC',
- BIDDERS_DSC: 'BIDDERS_DSC',
- ENDING_ASC: 'ENDING_ASC',
- ENDING_DSC: 'ENDING_DSC',
- PRICE_ASC: 'PRICE_ASC',
- PRICE_DSC: 'PRICE_DSC',
- TITLE_ASC: 'TITLE_ASC',
- TITLE_DSC: 'TITLE_DSC',
+ BIDDERS_ASC: 'BIDDERS_ASC',
+ BIDDERS_DSC: 'BIDDERS_DSC',
+ ENDING_ASC: 'ENDING_ASC',
+ ENDING_DSC: 'ENDING_DSC',
+ PRICE_ASC: 'PRICE_ASC',
+ PRICE_DSC: 'PRICE_DSC',
+ TITLE_ASC: 'TITLE_ASC',
+ TITLE_DSC: 'TITLE_DSC',
};
export const AUCTION_VIEW_MODES = {
- ALL: 'ALL',
- BIDDING: 'BIDDING',
- NO_BIDS: 'NO_BIDS',
- WINNING: 'WINNING',
+ ALL: 'ALL',
+ BIDDING: 'BIDDING',
+ NO_BIDS: 'NO_BIDS',
+ WINNING: 'WINNING',
};
export const API_URL = 'http://localhost:3001';
export const API_ENDPOINTS = {
- GET_EVENTS: 'GET_EVENTS',
- GET_ITEMS: 'GET_ITEMS',
- GET_STATUS: 'GET_STATUS',
- PLACE_BID: 'PLACE_BID',
- PURCHASE_ITEM: 'PURCHASE_ITEM',
- USER_SIGNUP: 'USER_SIGNUP',
- USER_PROFILE: 'USER_PROFILE',
- APPLE_SIGNUP: 'APPLE_SIGNUP',
- APPLE_LINK: 'APPLE_LINK',
- FACEBOOK_SIGNUP: 'FACEBOOK_SIGNUP',
- FACEBOOK_LINK: 'FACEBOOK_LINK',
- GOOGLE_SIGNUP: 'GOOGLE_SIGNUP',
- GOOGLE_LINK: 'GOOGLE_LINK',
+ GET_EVENTS: 'GET_EVENTS',
+ GET_ITEMS: 'GET_ITEMS',
+ GET_STATUS: 'GET_STATUS',
+ PLACE_BID: 'PLACE_BID',
+ PURCHASE_ITEM: 'PURCHASE_ITEM',
+ USER_SIGNUP: 'USER_SIGNUP',
+ USER_PROFILE: 'USER_PROFILE',
+ APPLE_SIGNUP: 'APPLE_SIGNUP',
+ APPLE_LINK: 'APPLE_LINK',
+ FACEBOOK_SIGNUP: 'FACEBOOK_SIGNUP',
+ FACEBOOK_LINK: 'FACEBOOK_LINK',
+ GOOGLE_SIGNUP: 'GOOGLE_SIGNUP',
+ GOOGLE_LINK: 'GOOGLE_LINK',
};
export const PERMISSIONS = {
- FACEBOOK: [ 'email', 'public_profile' ],
+ FACEBOOK: ['email', 'public_profile'],
};
diff --git a/app/containers/Auction/AuctionListItem.js b/app/containers/Auction/AuctionListItem.js
index 65db926..d46bd2a 100644
--- a/app/containers/Auction/AuctionListItem.js
+++ b/app/containers/Auction/AuctionListItem.js
@@ -5,25 +5,27 @@ import { placeBid } from '../../actions/auction.js';
import AuctionListItem from '../../components/Auction/AuctionListItem.js';
const mapStateToProps = (state, ownProps) => {
- const { item } = ownProps;
+ const { item } = ownProps;
- return {
- description: item.get('description'),
- donor: item.get('donor'),
- end: item.get('end'),
- id: item.get('id'),
- images: item.get('images').toArray(),
- start: item.get('start'),
- startingPrice: item.get('startingPrice'),
- subtitle: item.get('subtitle'),
- title: item.get('title'),
- type: item.get('type'),
- };
+ return {
+ description: item.get('description'),
+ donor: item.get('donor'),
+ end: item.get('end'),
+ id: item.get('id'),
+ images: item.get('images').toArray(),
+ start: item.get('start'),
+ startingPrice: item.get('startingPrice'),
+ subtitle: item.get('subtitle'),
+ title: item.get('title'),
+ type: item.get('type'),
+ };
};
const mapDispatchToProps = (dispatch) => ({
- placeBid: (data) => dispatch(placeBid(data)),
+ placeBid: (data) => dispatch(placeBid(data)),
});
-export default connect(mapStateToProps, null)(AuctionListItem);
-
+export default connect(
+ mapStateToProps,
+ null,
+)(AuctionListItem);
diff --git a/app/containers/Auction/AuctionPriceAndBidCount.js b/app/containers/Auction/AuctionPriceAndBidCount.js
index 36e085b..aa3fdb8 100644
--- a/app/containers/Auction/AuctionPriceAndBidCount.js
+++ b/app/containers/Auction/AuctionPriceAndBidCount.js
@@ -5,12 +5,15 @@ import { getItemBidCount, getItemPrice } from '../../selectors/auctions.js';
import AuctionPriceAndBidCount from '../../components/Auction/AuctionPriceAndBidCount.js';
function mapStateToProps(state, ownProps) {
- const { itemId } = ownProps;
+ const { itemId } = ownProps;
- return {
- bidCount: getItemBidCount(state, itemId),
- currentPrice: getItemPrice(state, itemId),
- };
+ return {
+ bidCount: getItemBidCount(state, itemId),
+ currentPrice: getItemPrice(state, itemId),
+ };
}
-export default connect(mapStateToProps, null)(AuctionPriceAndBidCount);
+export default connect(
+ mapStateToProps,
+ null,
+)(AuctionPriceAndBidCount);
diff --git a/app/containers/Auction/BidStatus.js b/app/containers/Auction/BidStatus.js
index 8a1fba8..c636410 100644
--- a/app/containers/Auction/BidStatus.js
+++ b/app/containers/Auction/BidStatus.js
@@ -5,12 +5,15 @@ import { isBiddingItem, isWinningItem } from '../../selectors/auctions.js';
import AuctionPriceAndBidCount from '../../components/Auction/BidStatus.js';
function mapStateToProps(state, ownProps) {
- const { itemId } = ownProps;
+ const { itemId } = ownProps;
- return {
- isBidding: isBiddingItem(state, itemId),
- isWinning: isWinningItem(state, itemId),
- };
+ return {
+ isBidding: isBiddingItem(state, itemId),
+ isWinning: isWinningItem(state, itemId),
+ };
}
-export default connect(mapStateToProps, null)(AuctionPriceAndBidCount);
+export default connect(
+ mapStateToProps,
+ null,
+)(AuctionPriceAndBidCount);
diff --git a/app/containers/Events.js b/app/containers/Events.js
index f5124d4..6eb0ea5 100644
--- a/app/containers/Events.js
+++ b/app/containers/Events.js
@@ -6,14 +6,17 @@ import { getEventsAsList } from '../selectors/events.js';
import Events from '../screens/Events.js';
const matchStateToProps = (state) => {
- const events = getEventsAsList(state);
- console.log('events:', events);
+ const events = getEventsAsList(state);
+ console.log('events:', events);
- return { events };
+ return { events };
};
const mapDispatchToProps = (dispatch) => ({
- fetchEvents: () => dispatch(fetchEvents(dispatch)),
+ fetchEvents: () => dispatch(fetchEvents(dispatch)),
});
-export default connect(matchStateToProps, mapDispatchToProps)(Events);
+export default connect(
+ matchStateToProps,
+ mapDispatchToProps,
+)(Events);
diff --git a/app/containers/Events/EventListItem.js b/app/containers/Events/EventListItem.js
index 80cf26c..c783c8c 100644
--- a/app/containers/Events/EventListItem.js
+++ b/app/containers/Events/EventListItem.js
@@ -4,26 +4,28 @@ import { setActiveEvent } from '../../actions/events.js';
import EventListItem from '../../components/Events/EventListItem.js';
const mapStateToProps = (state, ownProps) => {
- const { event } = ownProps;
+ const { event } = ownProps;
- return {
- description: event.get('description'),
- endTime: event.get('endTime'),
- id: event.get('id'),
- images: event.get('images').toArray(),
- isTicketed: event.get('isTicketed'),
- postCount: event.get('posts').size,
- showFrom: event.get('showFrom'),
- showUntil: event.get('showUntil'),
- startTime: event.get('startTime'),
- tagline: event.get('tagline'),
- title: event.get('title'),
- };
+ return {
+ description: event.get('description'),
+ endTime: event.get('endTime'),
+ id: event.get('id'),
+ images: event.get('images').toArray(),
+ isTicketed: event.get('isTicketed'),
+ postCount: event.get('posts').size,
+ showFrom: event.get('showFrom'),
+ showUntil: event.get('showUntil'),
+ startTime: event.get('startTime'),
+ tagline: event.get('tagline'),
+ title: event.get('title'),
+ };
};
const mapDispatchToProps = (dispatch) => ({
- setActiveEvent: (eventId) => dispatch(setActiveEvent(eventId)),
+ setActiveEvent: (eventId) => dispatch(setActiveEvent(eventId)),
});
-export default connect(mapStateToProps, null)(AuctionListItem);
-
+export default connect(
+ mapStateToProps,
+ null,
+)(AuctionListItem);
diff --git a/app/domain/Auction.js b/app/domain/Auction.js
index 36b930c..d93c730 100644
--- a/app/domain/Auction.js
+++ b/app/domain/Auction.js
@@ -1,16 +1,16 @@
import { Record } from 'immutable';
export default class Auction extends Record({
- id: null,
- bidCount: 0,
- isBidding: false,
- isWinning: false,
- itemPrice: 0,
+ id: null,
+ bidCount: 0,
+ isBidding: false,
+ isWinning: false,
+ itemPrice: 0,
}) {}
Auction.fromJS = (data = {}) => {
- return new Auction({
- id: data._id,
- ...data,
- });
+ return new Auction({
+ id: data._id,
+ ...data,
+ });
};
diff --git a/app/domain/Event.js b/app/domain/Event.js
index b2bfa1c..9abb8c7 100644
--- a/app/domain/Event.js
+++ b/app/domain/Event.js
@@ -4,36 +4,36 @@ import Post from './Post.js';
import TicketClass from './TicketClass.js';
export default class Event extends Record({
- id: null,
- isTicketed: false,
- requireLoginToSeeAuction: false,
- description: null,
- endTime: null,
- images: new List(),
- posts: new List(),
- showFrom: null,
- showUntil: null,
- startTime: null,
- tagline: null,
- title: null,
- url: null,
- ticketClasses: new List(),
+ id: null,
+ isTicketed: false,
+ requireLoginToSeeAuction: false,
+ description: null,
+ endTime: null,
+ images: new List(),
+ posts: new List(),
+ showFrom: null,
+ showUntil: null,
+ startTime: null,
+ tagline: null,
+ title: null,
+ url: null,
+ ticketClasses: new List(),
}) {
- get isSoldOut() {
- if (this.isTicketed) {
- return false;
- }
+ get isSoldOut() {
+ if (this.isTicketed) {
+ return false;
+ }
- return this.ticketClasses.find(t => t.available > 0) || false;
- }
+ return this.ticketClasses.find((t) => t.available > 0) || false;
+ }
}
Event.fromJS = (data = {}) => {
- return new Event({
- 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))),
- });
+ return new Event({
+ 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))),
+ });
};
diff --git a/app/domain/Item.js b/app/domain/Item.js
index f04543b..9df91de 100644
--- a/app/domain/Item.js
+++ b/app/domain/Item.js
@@ -1,43 +1,43 @@
import { List, Record } from 'immutable';
export default class Item extends Record({
- bidCount: 0,
- bidIncrement: 10,
- catalogNumber: null,
- currentPrice: 0,
- description: null,
- donor: null,
- end: null,
- estimatedValue: null,
- eventId: null,
- hideAfterEnd: false,
- hideBeforeStart: false,
- id: null,
- images: new List(),
- isShippable: false,
- notifyOnAvailable: false,
- quantityAvailable: 1,
- soldCount: 0,
- start: null,
- startingPrice: null,
- subtitle: null,
- title: null,
- type: null,
- shippingCost: 0,
+ bidCount: 0,
+ bidIncrement: 10,
+ catalogNumber: null,
+ currentPrice: 0,
+ description: null,
+ donor: null,
+ end: null,
+ estimatedValue: null,
+ eventId: null,
+ hideAfterEnd: false,
+ hideBeforeStart: false,
+ id: null,
+ images: new List(),
+ isShippable: false,
+ notifyOnAvailable: false,
+ quantityAvailable: 1,
+ soldCount: 0,
+ start: null,
+ startingPrice: null,
+ subtitle: null,
+ title: null,
+ type: null,
+ shippingCost: 0,
}) {
- get isSoldOut() {
- return this.quantityAvailable > this.soldCount;
- }
+ get isSoldOut() {
+ return this.quantityAvailable > this.soldCount;
+ }
- get totalWithShipping() {
- return this.currentPrice + this.shippingCost;
- }
+ get totalWithShipping() {
+ return this.currentPrice + this.shippingCost;
+ }
}
Item.fromJS = (data = {}) => {
- return new Item({
- id: data._id,
- ...data,
- images: List(data.images),
- });
+ return new Item({
+ id: data._id,
+ ...data,
+ images: List(data.images),
+ });
};
diff --git a/app/domain/Post.js b/app/domain/Post.js
index 2fb0159..1f6e07a 100644
--- a/app/domain/Post.js
+++ b/app/domain/Post.js
@@ -1,20 +1,19 @@
import { Record } from 'immutable';
export default class Post extends Record({
- author: null,
- content: null,
- id: null,
- isPublic: false,
- scheduledPost: false,
- sendNotification: false,
- timestamp: null,
- title: null,
-}) {};
-
+ author: null,
+ content: null,
+ id: null,
+ isPublic: false,
+ scheduledPost: false,
+ sendNotification: false,
+ timestamp: null,
+ title: null,
+}) {}
Post.fromJS = (data = {}) => {
- return new Post({
- id: data._id,
- ...data,
- });
+ return new Post({
+ id: data._id,
+ ...data,
+ });
};
diff --git a/app/domain/Profile.js b/app/domain/Profile.js
index d12a4c9..11b2069 100644
--- a/app/domain/Profile.js
+++ b/app/domain/Profile.js
@@ -1,44 +1,48 @@
import { List, Record } from 'immutable';
export default class Profile extends Record({
- addresses: new List(),
- avatar: null,
- email: null,
- firstName: null,
- generatedNomDeBid: false,
- hasLinkedApple: false,
- hasLinkedFacebook: false,
- hasLinkedGoogle: false,
- hasLocalAccount: false,
- id: null,
- isAllowedToBid: false,
- isOrganizationEmployee: false,
- isVerified: false,
- lastName: null,
- nomDeBid: null,
- organizationIdentifier: null,
- paymentToken: null,
- phones: new List(),
+ addresses: new List(),
+ avatar: null,
+ email: null,
+ firstName: null,
+ generatedNomDeBid: false,
+ hasLinkedApple: false,
+ hasLinkedFacebook: false,
+ hasLinkedGoogle: false,
+ hasLocalAccount: false,
+ id: null,
+ isAllowedToBid: false,
+ isOrganizationEmployee: false,
+ isVerified: false,
+ lastName: null,
+ nomDeBid: null,
+ organizationIdentifier: null,
+ paymentToken: null,
+ phones: new List(),
}) {
- get canBid() {
- return this.isAllowedToBid && this.paymentToken !== null;
- }
+ get canBid() {
+ return this.isAllowedToBid && this.paymentToken !== null;
+ }
- get fullName() {
- return `${this.firstName} ${this.lastName}`;
- }
+ get fullName() {
+ return `${this.firstName} ${this.lastName}`;
+ }
- get isRegisteredAccount() {
- return this.hasLinkedApple ||
- this.hasLinkedFacebook || this.hasLinkedGoogle || this.hasLocalAccount;
- }
+ get isRegisteredAccount() {
+ return (
+ this.hasLinkedApple ||
+ this.hasLinkedFacebook ||
+ this.hasLinkedGoogle ||
+ this.hasLocalAccount
+ );
+ }
}
Profile.fromJS = (data = {}) => {
- return new Profile({
- id: data._id,
- ...data,
- addresses: new List(data.addresses),
- phones: new List(data.phones),
- });
+ return new Profile({
+ id: data._id,
+ ...data,
+ addresses: new List(data.addresses),
+ phones: new List(data.phones),
+ });
};
diff --git a/app/domain/TicketClass.js b/app/domain/TicketClass.js
index b80ab80..4583e6a 100644
--- a/app/domain/TicketClass.js
+++ b/app/domain/TicketClass.js
@@ -1,27 +1,27 @@
import { List, Record } from 'immutable';
export default class TicketClass extends Record({
- available: 0,
- capacity: 0,
- endSale: null,
- id: null,
- itemId: null,
- name: null,
- price: 0,
- startSale: null,
+ available: 0,
+ capacity: 0,
+ endSale: null,
+ id: null,
+ itemId: null,
+ name: null,
+ price: 0,
+ startSale: null,
}) {
- get isAlmostGone() {
- return this.available < (this.capacity * 0.20);
- }
+ get isAlmostGone() {
+ return this.available < this.capacity * 0.2;
+ }
- get isSoldOut() {
- return this.available === 0;
- }
+ get isSoldOut() {
+ return this.available === 0;
+ }
}
TicketClass.fromJS = (data = {}) => {
- return new TicketClass({
- id: data._id,
- ...data,
- });
+ return new TicketClass({
+ id: data._id,
+ ...data,
+ });
};
diff --git a/app/library/helpers.js b/app/library/helpers.js
index 32d9ee2..4b28b90 100644
--- a/app/library/helpers.js
+++ b/app/library/helpers.js
@@ -5,60 +5,60 @@ export const formatPrice = (price, format = '$ 0,0[.]00') => {
};
export const getAuctionTime = ({ end, start }) => {
- const now = new Date();
- const compareToEnd = new Date(end);
- const compareToStart = new Date(start);
+ const now = new Date();
+ const compareToEnd = new Date(end);
+ const compareToStart = new Date(start);
- let delta;
- if (now < start) {
- delta = start - now;
- return 'Bidding starts in ${parseTimeDifferential(delta)}';
- }
+ let delta;
+ if (now < start) {
+ delta = start - now;
+ return 'Bidding starts in ${parseTimeDifferential(delta)}';
+ }
- if (now > start && now < end) {
- delta = end - now;
- return 'Bidding ends in ${parseTimeDifferential(delta)}';
- }
+ if (now > start && now < end) {
+ delta = end - now;
+ return 'Bidding ends in ${parseTimeDifferential(delta)}';
+ }
- return 'Bidding has ended';
+ return 'Bidding has ended';
};
export const parseHumanReadableTimeDifferential = (delta) => {
- const oneMinute = 60 * 1000;
- const oneHour = oneMinute * 60;
- const oneDay = oneHour * 24;
- const oneWeek = oneDay * 7;
- const oneMonth = oneWeek * 4;
+ const oneMinute = 60 * 1000;
+ const oneHour = oneMinute * 60;
+ const oneDay = oneHour * 24;
+ const oneWeek = oneDay * 7;
+ const oneMonth = oneWeek * 4;
- let compare = delta / oneMonth;
- if (compare >= 1) {
- compare = Math.floor(compare);
- return `${compare} month${compare > 1 ? 's' : ''}`;
- }
+ let compare = delta / oneMonth;
+ if (compare >= 1) {
+ compare = Math.floor(compare);
+ return `${compare} month${compare > 1 ? 's' : ''}`;
+ }
- compare = delta / oneWeek;
- if (compare >= 1) {
- compare = Math.floor(compare);
- return `${compare} week${compare > 1 ? 's' : ''}`;
- }
+ compare = delta / oneWeek;
+ if (compare >= 1) {
+ compare = Math.floor(compare);
+ return `${compare} week${compare > 1 ? 's' : ''}`;
+ }
- compare = delta / oneDay;
- if (compare > 1) {
- compare = Math.floor(compare);
- return `${compare} day${compare > 1 ? 's' : ''}`;
- }
+ compare = delta / oneDay;
+ if (compare > 1) {
+ compare = Math.floor(compare);
+ return `${compare} day${compare > 1 ? 's' : ''}`;
+ }
- compare = delta / oneHour;
- if (compare > 1) {
- compare = Math.floor(compare);
- return `${compare} hour${compare > 1 ? 's' : ''}`;
- }
+ compare = delta / oneHour;
+ if (compare > 1) {
+ compare = Math.floor(compare);
+ return `${compare} hour${compare > 1 ? 's' : ''}`;
+ }
- compare = delta / oneMinute;
- if (compare > 1) {
- compare = Math.floor(compare);
- return `${compare} minute${compare > 1 ? 's' : ''}`;
- }
+ compare = delta / oneMinute;
+ if (compare > 1) {
+ compare = Math.floor(compare);
+ return `${compare} minute${compare > 1 ? 's' : ''}`;
+ }
- return 'less than a minute';
+ return 'less than a minute';
};
diff --git a/app/reducers/activeEvent.js b/app/reducers/activeEvent.js
index 9e1358c..d2c26a9 100644
--- a/app/reducers/activeEvent.js
+++ b/app/reducers/activeEvent.js
@@ -1,12 +1,14 @@
-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 SET_ACTIVE_EVENT:
- return action.payload;
- case UNSET_ACTIVE_EVENT:
- return null;
- default:
- return state;
- }
+ 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:
+ return null;
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/activeItem.js b/app/reducers/activeItem.js
index 27d92ed..3a57a17 100644
--- a/app/reducers/activeItem.js
+++ b/app/reducers/activeItem.js
@@ -1,12 +1,12 @@
import { SET_ACTIVE_ITEM, UNSET_ACTIVE_ITEM } from '../constants/actionTypes.js';
export const activeItem = (state = null, action) => {
- switch (action.type) {
- case SET_ACTIVE_ITEM:
- return action.payload;
- case UNSET_ACTIVE_ITEM:
- return null;
- default:
- return state;
- }
+ switch (action.type) {
+ case SET_ACTIVE_ITEM:
+ return action.payload;
+ case UNSET_ACTIVE_ITEM:
+ return null;
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/auctionFilter.js b/app/reducers/auctionFilter.js
index 048a4fb..fd8c768 100644
--- a/app/reducers/auctionFilter.js
+++ b/app/reducers/auctionFilter.js
@@ -2,10 +2,10 @@ import { SET_AUCTION_FILTER } from '../constants/actionTypes.js';
import { ITEM_FILTERS } from '../constants/constants.js';
export const auctionFilter = (state = ITEM_FILTERS.ALL, action) => {
- switch (action.type) {
- case SET_AUCTION_FILTER:
- return action.payload;
- default:
- return state;
- }
+ switch (action.type) {
+ case SET_AUCTION_FILTER:
+ return action.payload;
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/auctionView.js b/app/reducers/auctionView.js
index 87777d8..8ad7ddf 100644
--- a/app/reducers/auctionView.js
+++ b/app/reducers/auctionView.js
@@ -2,10 +2,10 @@ import { SET_AUCTION_VIEW_MODE } from '../constants/actionTypes.js';
import { AUCTION_VIEW_MODES } from '../constants/constants.js';
export const auctionView = (state = AUCTION_VIEW_MODES.ALL, action) => {
- switch (action.type) {
- case SET_AUCTION_VIEW_MODE:
- return action.payload;
- default:
- return state;
- }
+ switch (action.type) {
+ case SET_AUCTION_VIEW_MODE:
+ return action.payload;
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/auctions.js b/app/reducers/auctions.js
index 5045915..a05f1ab 100644
--- a/app/reducers/auctions.js
+++ b/app/reducers/auctions.js
@@ -3,16 +3,16 @@ import { Map } from 'immutable';
import { AUCTIONS_UPDATED, UPDATE_AUCTIONS } from '../constants/actionTypes.js';
export const auctions = (state = new Map(), action) => {
- switch (action.type) {
- case AUCTIONS_UPDATED:
- return state.merge(
- action.payload.toMap().mapEntries((entry) => {
- const [, item] = entry;
- return [`${item.id}`, item];
- }),
- );
- case UPDATE_AUCTIONS:
- default:
- return state;
- }
+ switch (action.type) {
+ case AUCTIONS_UPDATED:
+ return state.merge(
+ action.payload.toMap().mapEntries((entry) => {
+ const [, item] = entry;
+ return [`${item.id}`, item];
+ }),
+ );
+ case UPDATE_AUCTIONS:
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/auth.js b/app/reducers/auth.js
index 9aa8be2..5214597 100644
--- a/app/reducers/auth.js
+++ b/app/reducers/auth.js
@@ -1,14 +1,14 @@
import { LOGIN_SUCCESS, SET_AUTH, UNSET_AUTH } from '../constants/actionTypes.js';
export const auth = (state = null, action) => {
- switch (action.type) {
- case LOGIN_SUCCESS:
- return action.payload.token;
- case SET_AUTH:
- return action.payload;
- case UNSET_AUTH:
- return null;
- default:
- return state;
- }
+ switch (action.type) {
+ case LOGIN_SUCCESS:
+ return action.payload.token;
+ case SET_AUTH:
+ return action.payload;
+ case UNSET_AUTH:
+ return null;
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/blockUI.js b/app/reducers/blockUI.js
index 97ec8fc..ed8f527 100644
--- a/app/reducers/blockUI.js
+++ b/app/reducers/blockUI.js
@@ -1,12 +1,12 @@
import { BLOCK_UI, UNBLOCK_UI } from '../constants/actionTypes.js';
export const blockUI = (state = false, action) => {
- switch (action.type) {
- case BLOCK_UI:
- return true;
- case UNBLOCK_UI:
- return false;
- default:
- return state;
- }
+ switch (action.type) {
+ case BLOCK_UI:
+ return true;
+ case UNBLOCK_UI:
+ return false;
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/events.js b/app/reducers/events.js
index c199510..b221aaa 100644
--- a/app/reducers/events.js
+++ b/app/reducers/events.js
@@ -3,15 +3,15 @@ import { Map } from 'immutable';
import { EVENTS_LOADED, GET_EVENTS } from '../constants/actionTypes.js';
export const events = (state = new Map(), action) => {
- switch (action.type) {
- case EVENTS_LOADED:
- const mapped = action.payload.toMap().mapEntries((entry) => {
- const [, event] = entry;
- return [`${event.id}`, event];
- });
- return state.merge(mapped);
- case GET_EVENTS:
- default:
- return state;
- }
+ switch (action.type) {
+ case EVENTS_LOADED:
+ const mapped = action.payload.toMap().mapEntries((entry) => {
+ const [, event] = entry;
+ return [`${event.id}`, event];
+ });
+ return state.merge(mapped);
+ case GET_EVENTS:
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/index.js b/app/reducers/index.js
index 9090d9d..06a2fce 100644
--- a/app/reducers/index.js
+++ b/app/reducers/index.js
@@ -12,16 +12,16 @@ import { items } from './items.js';
import { profile } from './profile.js';
const rootReducer = combineReducers({
- activeEvent,
- activeItem,
- auctionFilter,
- auctions,
- auctionView,
- auth,
- blockUI,
- events,
- items,
- profile,
+ activeEvent,
+ activeItem,
+ auctionFilter,
+ auctions,
+ auctionView,
+ auth,
+ blockUI,
+ events,
+ items,
+ profile,
});
export default rootReducer;
diff --git a/app/reducers/items.js b/app/reducers/items.js
index d4c6940..6493a6c 100644
--- a/app/reducers/items.js
+++ b/app/reducers/items.js
@@ -1,20 +1,17 @@
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) {
- case ITEMS_LOADED:
- const mapped = action.payload.toMap().mapEntries((entry) => {
- const [, item] = entry;
- return [`${item.id}`, item];
- });
- return state.merge(mapped);
- case GET_ITEMS:
- default:
- return state;
- }
+ switch (action.type) {
+ case ITEMS_LOADED:
+ const mapped = action.payload.toMap().mapEntries((entry) => {
+ const [, item] = entry;
+ return [`${item.id}`, item];
+ });
+ return state.merge(mapped);
+ case GET_ITEMS:
+ default:
+ return state;
+ }
};
diff --git a/app/reducers/profile.js b/app/reducers/profile.js
index 06338fd..d691aae 100644
--- a/app/reducers/profile.js
+++ b/app/reducers/profile.js
@@ -1,23 +1,23 @@
import { Map } from 'immutable';
import {
- LOGIN_SUCCESS,
- SET_PROFILE,
- UNSET_PROFILE,
- UPDATE_PROFILE,
+ LOGIN_SUCCESS,
+ SET_PROFILE,
+ UNSET_PROFILE,
+ UPDATE_PROFILE,
} from '../constants/actionTypes.js';
export const profile = (state = new Map(), action) => {
- switch (action.type) {
- case LOGIN_SUCCESS:
- return action.payload.user;
- case SET_PROFILE:
- return action.payload;
- case UNSET_PROFILE:
- return new Map();
- case UPDATE_PROFILE:
- return action.payload;
- default:
- return state;
- }
+ switch (action.type) {
+ case LOGIN_SUCCESS:
+ return action.payload.user;
+ case SET_PROFILE:
+ return action.payload;
+ case UNSET_PROFILE:
+ return new Map();
+ case UPDATE_PROFILE:
+ return action.payload;
+ default:
+ return state;
+ }
};
diff --git a/app/router.js b/app/router.js
index f24a710..f0398c8 100644
--- a/app/router.js
+++ b/app/router.js
@@ -16,155 +16,177 @@ 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 }) => ,
- },
- },
- 'Auction': {
- screen: Auction,
- navigationOptions: {
- tabBarLabel: 'Silent Auction',
- tabBarIcon: ({ tintColor }) => ,
- },
- },
- 'Bazaar': {
- screen: Marketplace,
- navigationOptions: {
- tabBarLabel: 'Bazaar',
- tabBarIcon: ({ tintColor }) => ,
- },
- },
- 'Profile': {
- screen: Profile,
- navigationOptions: {
- tabBarLabel: 'Profile',
- tabBarIcon: ({ tintColor }) => ,
- },
- },
-});
-
export const SignInOrRegisterStack = createStackNavigator({
- SignInOrRegister: {
- screen: SignInOrRegister,
- navigationOptions: ({ navigation }) => ({
- header: null,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- },
- Register: {
- screen: Register,
- navigationOptions: ({ navigation }) => ({
- header: null,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- },
+ SignInOrRegister: {
+ screen: SignInOrRegister,
+ navigationOptions: ({ navigation }) => ({
+ header: null,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
+ Register: {
+ screen: Register,
+ navigationOptions: ({ navigation }) => ({
+ header: null,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
});
export const AuctionStack = createStackNavigator({
- Auction: {
- screen: Auction,
- navigationOptions: ({ navigation }) => ({
- header: ,
- }),
- },
- Item: {
- screen: Item,
- navigationOptions: ({ navigation }) => ({
- header: null,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- },
- ImageDetail: {
- screen: ImageDetail,
- navigationOptions: ({ navigation }) => ({
- header: null,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- },
+ Auction: {
+ screen: Auction,
+ navigationOptions: ({ navigation }) => ({
+ header: ,
+ }),
+ },
+ Item: {
+ screen: Item,
+ navigationOptions: ({ navigation }) => ({
+ header: null,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
+ ImageDetail: {
+ screen: ImageDetail,
+ navigationOptions: ({ navigation }) => ({
+ header: null,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
});
export const BazaarStack = createStackNavigator({
- Bazaar: {
- screen: Marketplace,
- navigationOptions: ({ navigation }) => ({
- header: ,
- }),
- },
- Item: {
- screen: Item,
- navigationOptions: ({ navigation }) => ({
- header: null,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- },
- ImageDetail: {
- screen: ImageDetail,
- navigationOptions: ({ navigation }) => ({
- header: null,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- },
- Checkout: {
- screen: Checkout,
- navigationOptions: ({ navigation }) => ({
- header: null,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- },
+ Bazaar: {
+ screen: Marketplace,
+ navigationOptions: ({ navigation }) => ({
+ header: ,
+ }),
+ },
+ Item: {
+ screen: Item,
+ navigationOptions: ({ navigation }) => ({
+ header: null,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
+ ImageDetail: {
+ screen: ImageDetail,
+ navigationOptions: ({ navigation }) => ({
+ header: null,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
+ Checkout: {
+ screen: Checkout,
+ navigationOptions: ({ navigation }) => ({
+ header: null,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
});
export const EventsStack = createStackNavigator({
- Events: {
- screen: Events,
- navigationOptions: ({ navigation }) => ({
- header: ,
- tabBarVisible: false,
- gesturesEnabled: false,
- }),
- }
+ Events: {
+ screen: Events,
+ navigationOptions: ({ navigation }) => ({
+ header: ,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
+ Event: {
+ screen: Event,
+ navigationOptions: ({ navigation }) => ({
+ header: ,
+ tabBarVisible: false,
+ gesturesEnabled: false,
+ }),
+ },
+});
+
+export const Tabs = createBottomTabNavigator({
+ Event: {
+ screen: EventsStack,
+ navigationOptions: {
+ tabBarLabel: 'Event',
+ tabBarIcon: ({ tintColor }) => (
+
+ ),
+ },
+ },
+ Auction: {
+ screen: AuctionStack,
+ navigationOptions: {
+ tabBarLabel: 'Silent Auction',
+ tabBarIcon: ({ tintColor }) => (
+
+ ),
+ },
+ },
+ Bazaar: {
+ screen: BazaarStack,
+ navigationOptions: {
+ tabBarLabel: 'Bazaar',
+ tabBarIcon: ({ tintColor }) => (
+
+ ),
+ },
+ },
+ Profile: {
+ screen: Profile,
+ navigationOptions: {
+ tabBarLabel: 'Profile',
+ tabBarIcon: ({ tintColor }) => (
+
+ ),
+ },
+ },
});
export const createRootNavigator = () => {
- return StackNavigator(
- {
- AuctionStack: {
- screen: AuctionStack,
- navigationOptions: {
- gesturesEnabled: false,
- }
- },
- BazaarStack: {
- screen: BazaarStack,
- navigationOptions: {
- gesturesEnabled: false,
- }
- },
- EventsStack: {
- screen: EventsStack,
- navigationOptions: {
- gesturesEnabled: false,
- }
- },
- Tabs: {
- screen: Tabs,
- navigationOptions: {
- gesturesEnabled: false,
- }
- }
- },
- {
- mode: "modal",
- }
- );
+ return StackNavigator(
+ {
+ AuctionStack: {
+ 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',
+ },
+ );
};
diff --git a/app/screens/Auction.container.js b/app/screens/Auction.container.js
index 6a920e6..1c2023e 100644
--- a/app/screens/Auction.container.js
+++ b/app/screens/Auction.container.js
@@ -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);
diff --git a/app/screens/Auction.js b/app/screens/Auction.js
index e7f8f83..9623222 100644
--- a/app/screens/Auction.js
+++ b/app/screens/Auction.js
@@ -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 }) => ;
+ _keyExtractor = (item, index) => `${item.id}_${index}`;
- render() {
- const { items } = this.props;
- const { sort, view } = this.state;
+ _renderAuctionListItem = ({ item }) => ;
- return (
-
-
- {items.size > 0 && (
-
- )}
-
- );
- }
+ render() {
+ const { items } = this.props;
+ const { sort, view } = this.state;
+
+ return (
+
+
+ {items.size > 0 && (
+
+ )}
+
+ );
+ }
}
diff --git a/app/screens/Auction.styles.js b/app/screens/Auction.styles.js
index 936ce86..6720eb7 100644
--- a/app/screens/Auction.styles.js
+++ b/app/screens/Auction.styles.js
@@ -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',
+ },
+}));
diff --git a/app/screens/Checkout.js b/app/screens/Checkout.js
index a100ffa..d0ec3f3 100644
--- a/app/screens/Checkout.js
+++ b/app/screens/Checkout.js
@@ -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 (
-
-
- Checkout
-
-
- );
- }
+ render() {
+ return (
+
+ Checkout
+
+ );
+ }
}
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,
+ },
});
diff --git a/app/screens/Event.container.js b/app/screens/Event.container.js
index 18c7628..ea2098f 100644
--- a/app/screens/Event.container.js
+++ b/app/screens/Event.container.js
@@ -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);
diff --git a/app/screens/Event.js b/app/screens/Event.js
index ac1baf3..3aedc03 100644
--- a/app/screens/Event.js
+++ b/app/screens/Event.js
@@ -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 (
-
-
- Event
-
-
- );
- }
+ return (
+
+ Event
+
+ );
+ }
}
diff --git a/app/screens/Event.styles.js b/app/screens/Event.styles.js
index bb1db67..39118d6 100644
--- a/app/screens/Event.styles.js
+++ b/app/screens/Event.styles.js
@@ -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,
+ },
+}));
diff --git a/app/screens/Events.container.js b/app/screens/Events.container.js
index a31fc54..06301e2 100644
--- a/app/screens/Events.container.js
+++ b/app/screens/Events.container.js
@@ -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);
diff --git a/app/screens/Events.js b/app/screens/Events.js
index d1c46c7..1cf44ad 100644
--- a/app/screens/Events.js
+++ b/app/screens/Events.js
@@ -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 }) => ;
+ componentDidMount() {
+ this.props.fetchEvents();
+ }
- render() {
- const { events } = this.props;
+ setActiveEvent(eventId) {
+ this.props.setActiveEvent(eventId);
+ }
- return (
-
- {events.size > 0 && (
-
- )}
-
+ _keyExtractor = (event, index) => `${event.id}_${index}`;
+
+ _renderEventListItem = ({ event }) => (
+
);
- }
+
+ render() {
+ const { events } = this.props;
+
+ return (
+
+ {events.size > 0 && (
+
+ )}
+
+ );
+ }
}
const styles = StyleSheet.create({
- container: {
- flex: 1,
- justifyContent: 'center',
- alignItems: 'center',
- backgroundColor: '#F5FCFF',
- },
- eventListContentContainer: {
- },
+ container: {
+ flex: 1,
+ justifyContent: 'center',
+ alignItems: 'center',
+ backgroundColor: '#F5FCFF',
+ },
+ eventListContentContainer: {},
});
diff --git a/app/screens/ImageDetail.js b/app/screens/ImageDetail.js
index 0c2c313..26baa60 100644
--- a/app/screens/ImageDetail.js
+++ b/app/screens/ImageDetail.js
@@ -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 (
-
-
- Item
-
-
- );
- }
+ render() {
+ return (
+
+ Item
+
+ );
+ }
}
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,
+ },
});
diff --git a/app/screens/Item.js b/app/screens/Item.js
index 4d8e300..fbeb669 100644
--- a/app/screens/Item.js
+++ b/app/screens/Item.js
@@ -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 (
-
-
- Item
-
-
- );
- }
+ render() {
+ return (
+
+ Item
+
+ );
+ }
}
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,
+ },
});
diff --git a/app/screens/Login.js b/app/screens/Login.js
index 3e91fce..3a838dd 100644
--- a/app/screens/Login.js
+++ b/app/screens/Login.js
@@ -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 (
-
-
- Login
-
-
- );
- }
+ render() {
+ return (
+
+ Login
+
+ );
+ }
}
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,
+ },
});
diff --git a/app/screens/Marketplace.js b/app/screens/Marketplace.js
index 0140a6b..6aada5b 100644
--- a/app/screens/Marketplace.js
+++ b/app/screens/Marketplace.js
@@ -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 }) => ;
+ _renderAuctionListItem = ({ item }) => ;
- render() {
- const { items } = this.props;
- const { sort, view } = this.state;
+ render() {
+ const { items } = this.props;
+ const { sort, view } = this.state;
- return (
-
-
- {items.size > 0 && (
-
- )}
-
- );
- }
+ return (
+
+
+ {items.size > 0 && (
+
+ )}
+
+ );
+ }
}
diff --git a/app/screens/Profile.container.js b/app/screens/Profile.container.js
index 76fdc2b..1170cf8 100644
--- a/app/screens/Profile.container.js
+++ b/app/screens/Profile.container.js
@@ -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);
diff --git a/app/screens/Profile.js b/app/screens/Profile.js
index 6c85d48..cd935c7 100644
--- a/app/screens/Profile.js
+++ b/app/screens/Profile.js
@@ -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 (
-
-
- Profile
-
-
- );
- }
+ render() {
+ return (
+
+ Profile
+
+ );
+ }
}
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,
+ },
});
diff --git a/app/screens/Register.container.js b/app/screens/Register.container.js
index 7c23470..2951634 100644
--- a/app/screens/Register.container.js
+++ b/app/screens/Register.container.js
@@ -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);
diff --git a/app/screens/Register.js b/app/screens/Register.js
index d5cb63a..e123804 100644
--- a/app/screens/Register.js
+++ b/app/screens/Register.js
@@ -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 (
-
- Sign In or Register
-
-
-
-
-
-
-
-
-
-
- );
- }
+ _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 (
+
+ Sign In or Register
+
+
+
+
+
+
+
+
+
+
+ );
+ }
}
diff --git a/app/screens/Register.styles.js b/app/screens/Register.styles.js
index bdf6cc3..a430557 100644
--- a/app/screens/Register.styles.js
+++ b/app/screens/Register.styles.js
@@ -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: {},
+}));
diff --git a/app/screens/SignInOrRegister.js b/app/screens/SignInOrRegister.js
index 7938307..6cc3315 100644
--- a/app/screens/SignInOrRegister.js
+++ b/app/screens/SignInOrRegister.js
@@ -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 (
-
- Sign In or Register
-
-
-
-
-
-
-
-
-
-
- );
- }
+ render() {
+ return (
+
+ Sign In or Register
+
+
+
+
+
+
+
+
+
+
+ );
+ }
}
diff --git a/app/screens/SignInOrRegister.styles.js b/app/screens/SignInOrRegister.styles.js
index 95d78fc..39118d6 100644
--- a/app/screens/SignInOrRegister.styles.js
+++ b/app/screens/SignInOrRegister.styles.js
@@ -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,
+ },
+}));
diff --git a/app/screens/Ticketing.js b/app/screens/Ticketing.js
index bf34078..ce18c59 100644
--- a/app/screens/Ticketing.js
+++ b/app/screens/Ticketing.js
@@ -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 (
-
-
- Ticketing
-
-
- );
- }
+ render() {
+ return (
+
+ Ticketing
+
+ );
+ }
}
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,
+ },
});
-
diff --git a/app/selectors/activeEvent.js b/app/selectors/activeEvent.js
index 817c05e..b7bbf37 100644
--- a/app/selectors/activeEvent.js
+++ b/app/selectors/activeEvent.js
@@ -3,11 +3,11 @@ import { createSelector } from 'reselect';
const getState = (state) => state;
export const getActiveEventId = createSelector(
- [getState],
- (state) => state.get('activeEvent'),
+ [getState],
+ (state) => state.get('activeEvent'),
);
export const hasActiveEvent = createSelector(
- [getActiveEventId],
- (eventId) => !!eventId,
+ [getActiveEventId],
+ (eventId) => !!eventId,
);
diff --git a/app/selectors/auctions.js b/app/selectors/auctions.js
index 6be6d28..743f4b3 100644
--- a/app/selectors/auctions.js
+++ b/app/selectors/auctions.js
@@ -6,28 +6,30 @@ 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);
export const getAuctionStatuses = createSelector(
- [getState],
- (state) => state.get('actions') || new Map(),
+ [getState],
+ (state) => state.get('actions') || new Map(),
);
export const getItemsIdsWithNoBids = createSelector(
- [getAuctionStatuses],
- (auctions) => auctions.filter(auction => auction.bidCount === 0),
+ [getAuctionStatuses],
+ (auctions) => auctions.filter((auction) => auction.bidCount === 0),
);
export const getMyBidItemIds = createSelector(
- [getAuctionStatuses],
- (auctions) => auctions.filter(auction => auction.isBidding),
+ [getAuctionStatuses],
+ (auctions) => auctions.filter((auction) => auction.isBidding),
);
export const getMyWinningItemIds = createSelector(
- [getAuctionStatuses],
- (auctions) => auctions.filter(auction => auction.isWinning),
+ [getAuctionStatuses],
+ (auctions) => auctions.filter((auction) => auction.isWinning),
);
diff --git a/app/selectors/auth.js b/app/selectors/auth.js
index be5015d..4701d84 100644
--- a/app/selectors/auth.js
+++ b/app/selectors/auth.js
@@ -3,6 +3,6 @@ import { createSelector } from 'reselect';
const getState = (state) => state;
export const getAuthToken = createSelector(
- [getState],
- (state) => state.get('auth'),
+ [getState],
+ (state) => state.get('auth'),
);
diff --git a/app/selectors/events.js b/app/selectors/events.js
index 7e10be5..634d6e5 100644
--- a/app/selectors/events.js
+++ b/app/selectors/events.js
@@ -8,26 +8,26 @@ const getState = (state) => state;
export const getEventById = (state, eventId) => state.getIn(['events', eventId], false);
export const getEvents = createSelector(
- [getState],
- (state) => state.get('events') || new Map(),
+ [getState],
+ (state) => state.get('events') || new Map(),
);
export const getActiveEvent = createSelector(
- [getActiveEventId, getEvents],
- (eventId, eventsAsMap) => eventId ? eventsAsMap.get(eventId) : null,
+ [getActiveEventId, getEvents],
+ (eventId, eventsAsMap) => (eventId ? eventsAsMap.get(eventId) : null),
);
export const getDefaultEvent = createSelector(
- [getEvents],
- (eventsAsMap) => eventsAsMap.first(),
+ [getEvents],
+ (eventsAsMap) => eventsAsMap.first(),
);
export const getEventsAsList = createSelector(
- [getEvents],
- (eventsAsMap) => eventsAsMap.toList(),
+ [getEvents],
+ (eventsAsMap) => eventsAsMap.toList(),
);
export const hasMultipleEvents = createSelector(
- [getEvents],
- (eventsAsMap) => eventsAsMap.size > 1,
+ [getEvents],
+ (eventsAsMap) => eventsAsMap.size > 1,
);
diff --git a/app/selectors/items.js b/app/selectors/items.js
index 29bba08..674914f 100644
--- a/app/selectors/items.js
+++ b/app/selectors/items.js
@@ -8,61 +8,61 @@ const getState = (state) => state;
export const getItem = (state, itemId) => state.getIn(['items', itemId], false);
export const getItems = createSelector(
- [getState],
- (state) => state.get('items') || new Map(),
+ [getState],
+ (state) => state.get('items') || new Map(),
);
export const getItemsAsList = createSelector(
- [getItems],
- (itemsAsMap) => itemsAsMap.toList(),
+ [getItems],
+ (itemsAsMap) => itemsAsMap.toList(),
);
export const getAuctionItems = createSelector(
- [getState],
- (state) => state.get('items').filter(i => i.type === 'auction') || new Map(),
+ [getState],
+ (state) => state.get('items').filter((i) => i.type === 'auction') || new Map(),
);
export const getAuctionItemsAsList = createSelector(
- [getAuctionItems],
- (auctionItemsAsMap) => auctionItemsAsMap.toList(),
+ [getAuctionItems],
+ (auctionItemsAsMap) => auctionItemsAsMap.toList(),
);
export const getAuctionItemsUserIsBidding = createSelector(
- [getAuctionItems, getMyBidItemIds],
- (items, myBids) => items.filter(i => myBids.indexOf(i.id)) || new Map(),
+ [getAuctionItems, getMyBidItemIds],
+ (items, myBids) => items.filter((i) => myBids.indexOf(i.id)) || new Map(),
);
export const getAuctionItemsUserIsBiddingAsList = createSelector(
- [getAuctionItemsUserIsBidding],
- (auctionItemsAsMap) => auctionItemsAsMap.toList(),
+ [getAuctionItemsUserIsBidding],
+ (auctionItemsAsMap) => auctionItemsAsMap.toList(),
);
export const getAuctionItemsUserIsWinning = createSelector(
- [getAuctionItemsUserIsBidding, getMyWinningItemIds],
- (items, myWins) => items.filter(i => myWins.indexOf(i.id)) || new Map(),
+ [getAuctionItemsUserIsBidding, getMyWinningItemIds],
+ (items, myWins) => items.filter((i) => myWins.indexOf(i.id)) || new Map(),
);
export const getAuctionItemsUserIsWinningAsList = createSelector(
- [getAuctionItemsUserIsWinning],
- (auctionItemsAsMap) => auctionItemsAsMap.toList(),
+ [getAuctionItemsUserIsWinning],
+ (auctionItemsAsMap) => auctionItemsAsMap.toList(),
);
export const getAuctionItemsWithNoBids = createSelector(
- [getAuctionItems, getItemsIdsWithNoBids],
- (items, noBids) => items.filter(i => noBids.indexOf(i.id)) || new Map(),
+ [getAuctionItems, getItemsIdsWithNoBids],
+ (items, noBids) => items.filter((i) => noBids.indexOf(i.id)) || new Map(),
);
export const getAuctionItemsWithNoBidsAsList = createSelector(
- [getAuctionItemsWithNoBids],
- (auctionItemsAsMap) => auctionItemsAsMap.toList(),
+ [getAuctionItemsWithNoBids],
+ (auctionItemsAsMap) => auctionItemsAsMap.toList(),
);
export const getTicketItems = createSelector(
- [getState],
- (state) => state.get('items').filter(i => i.type === 'ticket') || new Map(),
+ [getState],
+ (state) => state.get('items').filter((i) => i.type === 'ticket') || new Map(),
);
export const getTicketItemsAsList = createSelector(
- [getTicketItems],
- (ticketItemsAsMap) => ticketItemsAsMap.toList(),
+ [getTicketItems],
+ (ticketItemsAsMap) => ticketItemsAsMap.toList(),
);
diff --git a/app/selectors/profile.js b/app/selectors/profile.js
index 4309020..2955690 100644
--- a/app/selectors/profile.js
+++ b/app/selectors/profile.js
@@ -4,21 +4,21 @@ import { createSelector } from 'reselect';
const getState = (state) => state;
export const getProfile = createSelector(
- [getState],
- (state) => state.get('profile'),
+ [getState],
+ (state) => state.get('profile'),
);
export const getNomDeBid = createSelector(
- [getProfile],
- (profile) => profile.get('nomDeBid'),
+ [getProfile],
+ (profile) => profile.get('nomDeBid'),
);
export const getProfileAvatarUrl = createSelector(
- [getProfile],
- (profile) => profile.get('avatar'),
+ [getProfile],
+ (profile) => profile.get('avatar'),
);
export const isAllowedToBid = createSelector(
- [getProfile],
- (profile) => profile.get('isAllowedToBid'),
+ [getProfile],
+ (profile) => profile.get('isAllowedToBid'),
);
diff --git a/app/store/index.js b/app/store/index.js
index f1748ca..b47d3e0 100644
--- a/app/store/index.js
+++ b/app/store/index.js
@@ -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)));
diff --git a/babel.config.js b/babel.config.js
index f842b77..80ce241 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,3 +1,3 @@
module.exports = {
- presets: ['module:metro-react-native-babel-preset'],
+ presets: ['module:metro-react-native-babel-preset'],
};
diff --git a/index.android.js b/index.android.js
index c55c790..4757035 100644
--- a/index.android.js
+++ b/index.android.js
@@ -11,11 +11,11 @@ import { name as appName } from './app.json';
import { store } from './app/store/index.js';
const connectedApp = () => {
- return (
-
-
-
- );
+ return (
+
+
+
+ );
};
AppRegistry.registerComponent(appName, () => connectedApp);
diff --git a/index.ios.js b/index.ios.js
index c55c790..4757035 100644
--- a/index.ios.js
+++ b/index.ios.js
@@ -11,11 +11,11 @@ import { name as appName } from './app.json';
import { store } from './app/store/index.js';
const connectedApp = () => {
- return (
-
-
-
- );
+ return (
+
+
+
+ );
};
AppRegistry.registerComponent(appName, () => connectedApp);
diff --git a/index.js b/index.js
index a658e3c..7e5bc77 100644
--- a/index.js
+++ b/index.js
@@ -11,11 +11,11 @@ import { name as appName } from './app.json';
import { store } from './app/store/index.js';
const connectedApp = () => {
- return (
-
-
-
- );
+ return (
+
+
+
+ );
};
AppRegistry.registerComponent(appName, () => connectedApp);
diff --git a/metro.config.js b/metro.config.js
index 13a9642..783f349 100644
--- a/metro.config.js
+++ b/metro.config.js
@@ -6,12 +6,12 @@
*/
module.exports = {
- transformer: {
- getTransformOptions: async () => ({
- transform: {
- experimentalImportSupport: false,
- inlineRequires: false,
- },
- }),
- },
+ transformer: {
+ getTransformOptions: async () => ({
+ transform: {
+ experimentalImportSupport: false,
+ inlineRequires: false,
+ },
+ }),
+ },
};
diff --git a/package.json b/package.json
index 3356b19..a428b55 100644
--- a/package.json
+++ b/package.json
@@ -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",