This commit is contained in:
2019-07-24 00:53:01 -04:00
parent 434a1ded24
commit a9f4324f29
21 changed files with 345 additions and 100 deletions

View File

@@ -1,7 +1,5 @@
import { createSelector } from 'reselect';
//import { getItemsIdsWithNoBids, getMyBidItemIds, getMyWinningItemIds } from './auctions.js';
const getState = (state) => state;
export const getItemBidCount = (state, itemId) => state.getIn(['auctions', itemId, 'bidCount'], 0);
@@ -11,3 +9,25 @@ export const getItemPrice = (state, itemId) => state.getIn(['auctions', itemId,
export const isBiddingItem = (state, itemId) => state.getIn(['auctions', itemId, 'isBidding'], 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(),
);
export const getItemsIdsWithNoBids = createSelector(
[getAuctionStatuses],
(auctions) => auctions.filter(auction => auction.bidCount === 0);
);
export const getMyBidItemIds = createSelector(
[getAuctionStatuses],
(auctions) => auctions.filter(auction => auction.isBidding);
);
export const getMyWinningItemIds = createSelector(
[getAuctionStatuses],
(auctions) => auctions.filter(auction => auction.isWinning);
);