diff --git a/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.container.tsx b/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.container.tsx index 54aff58c7..48d673b94 100644 --- a/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.container.tsx +++ b/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.container.tsx @@ -1,4 +1,5 @@ import { connect } from 'react-redux' +import { getIsOffchainPublicItemOrdersEnabled, getIsOffchainPublicNFTOrdersEnabled } from '../../../modules/features/selectors' import { RootState } from '../../../modules/reducer' import { getCategoryFromSection } from '../../../modules/routing/search' import { @@ -56,7 +57,9 @@ const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => { maxEstateSize: 'maxEstateSize' in values ? values.maxEstateSize || '' : getMaxEstateSize(state), rentalDays: 'rentalDays' in values ? values.rentalDays : getRentalDays(state), emoteHasGeometry: 'emoteHasGeometry' in values ? values.emoteHasGeometry : getEmoteHasGeometry(state), - emoteHasSound: 'emoteHasSound' in values ? values.emoteHasSound : getEmoteHasSound(state) + emoteHasSound: 'emoteHasSound' in values ? values.emoteHasSound : getEmoteHasSound(state), + isOffchainPublicItemOrdersEnabled: getIsOffchainPublicItemOrdersEnabled(state), + isOffchainPublicNFTOrdersEnabled: getIsOffchainPublicNFTOrdersEnabled(state) } } diff --git a/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.tsx b/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.tsx index e7daa484d..12b7c2e5c 100644 --- a/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.tsx +++ b/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.tsx @@ -3,7 +3,7 @@ import { ethers } from 'ethers' import { RentalsListingsFilterByCategory } from '@dcl/schemas' import { t } from 'decentraland-dapps/dist/modules/translation/utils' import { Box, useTabletAndBelowMediaQuery } from 'decentraland-ui' -import { nftAPI } from '../../../modules/vendor/decentraland/nft/api' +import { nftAPI, nftMarketplaceAPI } from '../../../modules/vendor/decentraland/nft/api' import { rentalsAPI } from '../../../modules/vendor/decentraland/rentals/api' import { Section } from '../../../modules/vendor/routing/types' import { getNetwork, getPriceLabel } from '../../../utils/filters' @@ -35,6 +35,8 @@ export const PriceFilter = ({ rentalDays, emoteHasGeometry, emoteHasSound, + isOffchainPublicItemOrdersEnabled, + isOffchainPublicNFTOrdersEnabled, onChange }: Props) => { const isMobileOrTablet = useTabletAndBelowMediaQuery() @@ -117,7 +119,8 @@ export const PriceFilter = ({ if (landStatus === LANDFilters.ONLY_FOR_RENT) { data = await rentalsAPI.getRentalListingsPrices(rentalPriceFetchFilters()) } else { - data = await nftAPI.fetchPrices(priceFetchFilters) + const api = isOffchainPublicItemOrdersEnabled || isOffchainPublicNFTOrdersEnabled ? nftMarketplaceAPI : nftAPI + data = await api.fetchPrices(priceFetchFilters) } return Object.entries(data).reduce( (acc, [key, value]) => { @@ -126,7 +129,7 @@ export const PriceFilter = ({ }, {} as Record ) - }, [priceFetchFilters, landStatus, rentalPriceFetchFilters]) + }, [priceFetchFilters, landStatus, isOffchainPublicItemOrdersEnabled, isOffchainPublicNFTOrdersEnabled, rentalPriceFetchFilters]) return ( diff --git a/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.types.ts b/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.types.ts index cdad54952..78d40cafd 100644 --- a/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.types.ts +++ b/webapp/src/components/AssetFilters/PriceFilter/PriceFilter.types.ts @@ -30,6 +30,8 @@ export type Props = { isRentalPriceFitlerChartEnabled?: boolean emoteHasGeometry?: boolean emoteHasSound?: boolean + isOffchainPublicItemOrdersEnabled: boolean + isOffchainPublicNFTOrdersEnabled: boolean } export type MapStateProps = Pick< @@ -53,6 +55,8 @@ export type MapStateProps = Pick< | 'isRentalPriceFitlerChartEnabled' | 'emoteHasGeometry' | 'emoteHasSound' + | 'isOffchainPublicItemOrdersEnabled' + | 'isOffchainPublicNFTOrdersEnabled' > export type OwnProps = Pick