- Linting... Prettier...

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

View File

@@ -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,
);

View File

@@ -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),
);

View File

@@ -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'),
);

View File

@@ -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,
);

View File

@@ -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(),
);

View File

@@ -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'),
);