From 2f7af2b39e2ca52ee88035826f5a36293275acfa Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com> Date: Wed, 15 Sep 2021 15:12:47 -0300 Subject: [PATCH] fix: Partners not showing up (#419) * fix: Partners not loading * fix: Partners not showing up * chore: Use uniswap v2 * fix: Tests and enums * fix: All assets not being selected in account --- webapp/.ci/.env.dev | 2 +- webapp/.ci/.env.prd | 2 +- webapp/.ci/.env.stg | 2 +- webapp/.env.example | 2 +- .../AssetBrowse/AssetBrowse.container.ts | 3 +- .../components/AssetBrowse/AssetBrowse.tsx | 48 +++--- .../AssetBrowse/AssetBrowse.types.ts | 2 +- .../BrowsePage/BrowsePage.container.ts | 19 +- .../components/BrowsePage/BrowsePage.types.ts | 2 +- .../Vendor/NFTSections/NFTSections.tsx | 6 +- .../Vendor/NFTSidebar/NFTSidebar.tsx | 6 +- .../Vendor/NFTSidebar/NFTSidebar.types.ts | 4 +- webapp/src/modules/routing/sagas.ts | 7 +- webapp/src/modules/routing/selectors.spec.ts | 162 +++++++++++++++++- webapp/src/modules/routing/selectors.ts | 38 ++-- webapp/src/modules/routing/types.ts | 2 +- webapp/src/modules/vendor/routing/types.ts | 18 +- webapp/src/modules/vendor/utils.ts | 6 +- 18 files changed, 257 insertions(+), 74 deletions(-) diff --git a/webapp/.ci/.env.dev b/webapp/.ci/.env.dev index c890bbaa3e..7fe9354701 100644 --- a/webapp/.ci/.env.dev +++ b/webapp/.ci/.env.dev @@ -20,7 +20,7 @@ REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000 REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15 REACT_APP_MANA_ADDRESS=0x2a8fd99c19271f4f04b1b7b9c4f7cf264b626edb REACT_APP_CONVERTER_ADDRESS=0x2782eb28Dcb1eF4E7632273cd4e347e130Ce4646 -REACT_APP_CONVERTER_EXCHANGE=uniswap +REACT_APP_CONVERTER_EXCHANGE=uniswap_v2 # Misc REACT_APP_INTERCOM_APP_ID=z0h94kay diff --git a/webapp/.ci/.env.prd b/webapp/.ci/.env.prd index 70fef877eb..8b0920d489 100644 --- a/webapp/.ci/.env.prd +++ b/webapp/.ci/.env.prd @@ -20,7 +20,7 @@ REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000 REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15 REACT_APP_MANA_ADDRESS=0x0f5d2fb29fb7d3cfee444a200298f468908cc942 REACT_APP_CONVERTER_ADDRESS=0x2859581da59bd4e16a866dd06b461b76d8e489a4 -REACT_APP_CONVERTER_EXCHANGE=kyber_network +REACT_APP_CONVERTER_EXCHANGE=uniswap_v2 # Misc REACT_APP_INTERCOM_APP_ID=z0h94kay diff --git a/webapp/.ci/.env.stg b/webapp/.ci/.env.stg index 1c21298ebe..cddcfa5532 100644 --- a/webapp/.ci/.env.stg +++ b/webapp/.ci/.env.stg @@ -20,7 +20,7 @@ REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000 REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15 REACT_APP_MANA_ADDRESS=0x0f5d2fb29fb7d3cfee444a200298f468908cc942 REACT_APP_CONVERTER_ADDRESS=0x2859581da59bd4e16a866dd06b461b76d8e489a4 -REACT_APP_CONVERTER_EXCHANGE=kyber_network +REACT_APP_CONVERTER_EXCHANGE=uniswap_v2 # Misc REACT_APP_INTERCOM_APP_ID=z0h94kay diff --git a/webapp/.env.example b/webapp/.env.example index 77313e9bb6..6921fa5b00 100644 --- a/webapp/.env.example +++ b/webapp/.env.example @@ -16,7 +16,7 @@ REACT_APP_MAKERS_PLACE_API_URL=https://makersplace.com/api REACT_APP_KNOWN_ORIGIN_API_URL=https://api.thegraph.com/subgraphs/name/knownorigin/known-origin # Partner's Marketplace Adapter -REACT_APP_CONVERTER_EXCHANGE=kyber_network +REACT_APP_CONVERTER_EXCHANGE=uniswap_v2 REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000 REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15 REACT_APP_MANA_ADDRESS=0x0f5d2fb29fb7d3cfee444a200298f468908cc942 diff --git a/webapp/src/components/AssetBrowse/AssetBrowse.container.ts b/webapp/src/components/AssetBrowse/AssetBrowse.container.ts index c1e32953b1..bd4027a506 100644 --- a/webapp/src/components/AssetBrowse/AssetBrowse.container.ts +++ b/webapp/src/components/AssetBrowse/AssetBrowse.container.ts @@ -23,12 +23,11 @@ import { Props } from './AssetBrowse.types' import AssetBrowse from './AssetBrowse' -import { Section } from '../../modules/vendor/decentraland' const mapState = (state: RootState): MapStateProps => ({ isMap: getIsMap(state), onlyOnSale: getOnlyOnSale(state), - section: getSection(state) as Section, + section: getSection(state), isLoading: isLoadingType(getLoadingNFTs(state), FETCH_NFTS_REQUEST) || isLoadingType(getLoadingItems(state), FETCH_ITEMS_REQUEST), diff --git a/webapp/src/components/AssetBrowse/AssetBrowse.tsx b/webapp/src/components/AssetBrowse/AssetBrowse.tsx index e1bfd6633d..d89c60dfe7 100644 --- a/webapp/src/components/AssetBrowse/AssetBrowse.tsx +++ b/webapp/src/components/AssetBrowse/AssetBrowse.tsx @@ -3,8 +3,10 @@ import { Container, Page, Responsive } from 'decentraland-ui' import { t } from 'decentraland-dapps/dist/modules/translation/utils' import { View } from '../../modules/ui/types' -import { Section } from '../../modules/vendor/decentraland' +import { Section as DecentralandSection } from '../../modules/vendor/decentraland' import { AssetType } from '../../modules/asset/types' +import { VendorName } from '../../modules/vendor' +import { Section } from '../../modules/vendor/routing/types' import { Atlas } from '../Atlas' import { AccountSidebar } from '../AccountSidebar' import { AssetList } from '../AssetList' @@ -19,24 +21,24 @@ import './AssetBrowse.css' const hasPrimarySales = (section?: Section) => { switch (section) { - case Section.WEARABLES: - case Section.WEARABLES_HEAD: - case Section.WEARABLES_EYEBROWS: - case Section.WEARABLES_EYES: - case Section.WEARABLES_FACIAL_HAIR: - case Section.WEARABLES_HAIR: - case Section.WEARABLES_MOUTH: - case Section.WEARABLES_UPPER_BODY: - case Section.WEARABLES_LOWER_BODY: - case Section.WEARABLES_FEET: - case Section.WEARABLES_ACCESORIES: - case Section.WEARABLES_EARRING: - case Section.WEARABLES_EYEWEAR: - case Section.WEARABLES_HAT: - case Section.WEARABLES_HELMET: - case Section.WEARABLES_MASK: - case Section.WEARABLES_TIARA: - case Section.WEARABLES_TOP_HEAD: { + case DecentralandSection.WEARABLES: + case DecentralandSection.WEARABLES_HEAD: + case DecentralandSection.WEARABLES_EYEBROWS: + case DecentralandSection.WEARABLES_EYES: + case DecentralandSection.WEARABLES_FACIAL_HAIR: + case DecentralandSection.WEARABLES_HAIR: + case DecentralandSection.WEARABLES_MOUTH: + case DecentralandSection.WEARABLES_UPPER_BODY: + case DecentralandSection.WEARABLES_LOWER_BODY: + case DecentralandSection.WEARABLES_FEET: + case DecentralandSection.WEARABLES_ACCESORIES: + case DecentralandSection.WEARABLES_EARRING: + case DecentralandSection.WEARABLES_EYEWEAR: + case DecentralandSection.WEARABLES_HAT: + case DecentralandSection.WEARABLES_HELMET: + case DecentralandSection.WEARABLES_MASK: + case DecentralandSection.WEARABLES_TIARA: + case DecentralandSection.WEARABLES_TOP_HEAD: { return true } default: @@ -134,7 +136,9 @@ const AssetBrowse = (props: Props) => { ? 'account_page.primary_market_subtitle' : 'browse_page.primary_market_subtitle' ), - disabled: !hasPrimarySales(section), + disabled: + !hasPrimarySales(section) || + vendor !== VendorName.DECENTRALAND, onClick: hanldeBrowseItems }, { @@ -143,7 +147,9 @@ const AssetBrowse = (props: Props) => { ? 'account_page.secondary_market_title' : 'browse_page.secondary_market_title' ), - active: assetType === AssetType.NFT, + active: + assetType === AssetType.NFT || + vendor !== VendorName.DECENTRALAND, description: t( view === View.ACCOUNT ? 'account_page.secondary_market_subtitle' diff --git a/webapp/src/components/AssetBrowse/AssetBrowse.types.ts b/webapp/src/components/AssetBrowse/AssetBrowse.types.ts index a972322610..61025a2c4d 100644 --- a/webapp/src/components/AssetBrowse/AssetBrowse.types.ts +++ b/webapp/src/components/AssetBrowse/AssetBrowse.types.ts @@ -9,7 +9,7 @@ import { fetchAssetsFromRoute, FetchAssetsFromRouteAction } from '../../modules/routing/actions' -import { Section } from '../../modules/vendor/decentraland' +import { Section } from '../../modules/vendor/routing/types' import { AssetType } from '../../modules/asset/types' export type Props = { diff --git a/webapp/src/components/BrowsePage/BrowsePage.container.ts b/webapp/src/components/BrowsePage/BrowsePage.container.ts index 8cba8bd7f9..ae14964986 100644 --- a/webapp/src/components/BrowsePage/BrowsePage.container.ts +++ b/webapp/src/components/BrowsePage/BrowsePage.container.ts @@ -9,20 +9,13 @@ import { } from '../../modules/routing/selectors' import { MapStateProps } from './BrowsePage.types' import BrowsePage from './BrowsePage' -import { Section } from '../../modules/vendor/decentraland' -const mapState = (state: RootState): MapStateProps => { - let section = getSection(state) as Section - if (section === Section.ALL) { - section = Section.WEARABLES - } - return { - vendor: getVendor(state), - assetType: getAssetType(state), - section, - isFullscreen: getIsFullscreen(state) - } -} +const mapState = (state: RootState): MapStateProps => ({ + vendor: getVendor(state), + assetType: getAssetType(state), + section: getSection(state), + isFullscreen: getIsFullscreen(state) +}) const mapDispatch = () => ({}) diff --git a/webapp/src/components/BrowsePage/BrowsePage.types.ts b/webapp/src/components/BrowsePage/BrowsePage.types.ts index 4cd9a36664..963ce30bc2 100644 --- a/webapp/src/components/BrowsePage/BrowsePage.types.ts +++ b/webapp/src/components/BrowsePage/BrowsePage.types.ts @@ -1,5 +1,5 @@ import { AssetType } from '../../modules/asset/types' -import { Section } from '../../modules/vendor/decentraland/routing/types' +import { Section } from '../../modules/vendor/routing/types' import { VendorName } from '../../modules/vendor/types' export type Props = { diff --git a/webapp/src/components/Vendor/NFTSections/NFTSections.tsx b/webapp/src/components/Vendor/NFTSections/NFTSections.tsx index fdafb2fb50..db06053a14 100644 --- a/webapp/src/components/Vendor/NFTSections/NFTSections.tsx +++ b/webapp/src/components/Vendor/NFTSections/NFTSections.tsx @@ -1,7 +1,7 @@ import React from 'react' import { VendorName } from '../../../modules/vendor/types' -import { Section } from '../../../modules/vendor/routing/types' +import { Sections } from '../../../modules/vendor/routing/types' import { Section as KnownOriginSection } from '../../../modules/vendor/known_origin/routing/types' import { Section as DecentralandSection } from '../../../modules/vendor/decentraland/routing/types' import { NFTSections as KnownOriginNFTSections } from '../known_origin/NFTSections' @@ -18,7 +18,7 @@ const NFTSections = (props: Props) => { switch (vendor) { case VendorName.SUPER_RARE: case VendorName.MAKERS_PLACE: - const all = Section[vendor].ALL + const all = Sections[vendor].ALL return ( { return ( ) diff --git a/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.tsx b/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.tsx index 4412f559b0..fbee349c0d 100644 --- a/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.tsx +++ b/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.tsx @@ -1,6 +1,6 @@ import React, { useCallback } from 'react' -import { Section } from '../../../modules/vendor/routing/types' +import { Sections } from '../../../modules/vendor/routing/types' import { Section as DecentralandSection } from '../../../modules/vendor/decentraland/routing/types' import { VendorName } from '../../../modules/vendor/types' import { NFTSidebar as DecentralandNFTSidebar } from '../decentraland/NFTSidebar' @@ -33,7 +33,9 @@ const NFTSidebar = (props: Props) => { return ( ) diff --git a/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.types.ts b/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.types.ts index 79d2e2b2cc..b4e16f28d1 100644 --- a/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.types.ts +++ b/webapp/src/components/Vendor/NFTSidebar/NFTSidebar.types.ts @@ -1,12 +1,12 @@ import { Dispatch } from 'redux' -import { Section as DecentralandSection } from '../../../modules/vendor/decentraland/routing/types' import { browse, BrowseAction } from '../../../modules/routing/actions' +import { Section } from '../../../modules/vendor/routing/types' export type Props = { vendor?: string section: string - sections?: DecentralandSection[] + sections?: Section[] onBrowse: typeof browse } diff --git a/webapp/src/modules/routing/sagas.ts b/webapp/src/modules/routing/sagas.ts index 0991b8d750..ceb344212b 100644 --- a/webapp/src/modules/routing/sagas.ts +++ b/webapp/src/modules/routing/sagas.ts @@ -47,7 +47,7 @@ import { setIsLoadMore, CLEAR_FILTERS } from './actions' -import { BrowseOptions, Section } from './types' +import { BrowseOptions, Sections } from './types' export function* routingSaga() { yield takeEvery(FETCH_ASSETS_FROM_ROUTE, handleFetchAssetsFromRoute) @@ -83,7 +83,6 @@ function* handleBrowse(action: BrowseAction) { action.payload.options ) const { pathname }: ReturnType = yield select(getLocation) - yield fetchAssetsFromRoute(options) yield put(push(buildBrowseURL(pathname, options))) } @@ -124,9 +123,9 @@ export function* fetchAssetsFromRoute(options: BrowseOptions) { if (isItems) { // TODO: clean up const isWearableHead = - section === Section[VendorName.DECENTRALAND].WEARABLES_HEAD + section === Sections[VendorName.DECENTRALAND].WEARABLES_HEAD const isWearableAccessory = - section === Section[VendorName.DECENTRALAND].WEARABLES_ACCESORIES + section === Sections[VendorName.DECENTRALAND].WEARABLES_ACCESORIES const wearableCategory = !isWearableAccessory ? getSearchWearableCategory(section!) diff --git a/webapp/src/modules/routing/selectors.spec.ts b/webapp/src/modules/routing/selectors.spec.ts index df864e1e35..6030ff1ab0 100644 --- a/webapp/src/modules/routing/selectors.spec.ts +++ b/webapp/src/modules/routing/selectors.spec.ts @@ -1,6 +1,10 @@ import { Rarity } from '@dcl/schemas' +import { AssetType } from '../asset/types' import { WearableGender } from '../nft/wearable/types' -import { hasFiltersEnabled } from './selectors' +import { VendorName } from '../vendor' +import { locations } from './locations' +import { getAssetType, getSection, hasFiltersEnabled } from './selectors' +import { Sections } from './types' describe('when getting if the are filters set', () => { describe('when the network filter is set', () => { @@ -39,3 +43,159 @@ describe('when getting if the are filters set', () => { }) }) }) + +describe('when getting the section', () => { + describe("when there's no section URL param and the location is related to lands", () => { + it("should return the decentraland's LAND section", () => { + expect( + getSection.resultFunc('', locations.lands(), VendorName.DECENTRALAND) + ).toBe(Sections.decentraland.LAND) + }) + }) + + describe("when there's no section URL param, the vendor is Decentraland and the pathname is browse", () => { + it("should return the decentraland's WEARABLES section", () => { + expect( + getSection.resultFunc('', locations.browse(), VendorName.DECENTRALAND) + ).toBe(Sections.decentraland.WEARABLES) + }) + }) + + describe('when the section URL param is ALL, the vendor is Decentraland and the pathname is browse', () => { + it("should return the decentraland's WEARABLES section", () => { + expect( + getSection.resultFunc( + 'section=all', + locations.browse(), + VendorName.DECENTRALAND + ) + ).toBe(Sections.decentraland.WEARABLES) + }) + }) + + describe("when there's no section URL param, the vendor is Decentraland and the pathname is not browse but account", () => { + it("should return the decentraland's ALL section", () => { + expect( + getSection.resultFunc('', locations.account(), VendorName.DECENTRALAND) + ).toBe(Sections.decentraland.ALL) + }) + }) + + describe('when the section URL param is ALL, the vendor is Decentraland and the pathname is not browse but account', () => { + it("should return the decentraland's ALL section", () => { + expect( + getSection.resultFunc( + 'section=all', + locations.account(), + VendorName.DECENTRALAND + ) + ).toBe(Sections.decentraland.ALL) + }) + }) + + describe("when there's no section URL param and the vendor is not Decentraland", () => { + it("should return the vendor's ALL section", () => { + expect( + getSection.resultFunc('', locations.browse(), VendorName.SUPER_RARE) + ).toBe(Sections.super_rare.ALL) + }) + }) + + describe('when the section URL param does not exist in the vendor', () => { + it("should return the vendor's ALL section", () => { + expect( + getSection.resultFunc( + 'section=NOT_EXISTENT', + locations.browse(), + VendorName.SUPER_RARE + ) + ).toBe(Sections.super_rare.ALL) + }) + }) + + describe('when the section URL param exists in the vendor', () => { + it("should return the vendor's section", () => { + expect( + getSection.resultFunc( + 'section=land', + locations.lands(), + VendorName.DECENTRALAND + ) + ).toBe(Sections.decentraland.LAND) + }) + }) +}) + +describe('when getting the asset type', () => { + describe("when there's no assetType URL param and the vendor is not DECENTRALAND", () => { + it('should return NFT as the assetType', () => { + expect( + getAssetType.resultFunc('', locations.browse(), VendorName.KNOWN_ORIGIN) + ).toBe(AssetType.NFT) + }) + }) + + describe("when there's no assetType URL param and the vendor is DECENTRALAND but the location is not in browse", () => { + it('should return NFT as the assetType', () => { + expect( + getAssetType.resultFunc('', locations.lands(), VendorName.KNOWN_ORIGIN) + ).toBe(AssetType.NFT) + }) + }) + + describe("when there's no assetType URL param and the vendor is DECENTRALAND and the location is in browse", () => { + it('should return ITEM as the assetType', () => { + expect( + getAssetType.resultFunc('', locations.browse(), VendorName.DECENTRALAND) + ).toBe(AssetType.ITEM) + }) + }) + + describe("when there's assetType URL param, the assetType is not NFT or ITEM and the vendor is DECENTRALAND but the location is not in browse", () => { + it('should return NFT as the assetType', () => { + expect( + getAssetType.resultFunc( + 'assetType=something', + locations.lands(), + VendorName.DECENTRALAND + ) + ).toBe(AssetType.NFT) + }) + }) + + describe("when there's assetType URL param, the assetType is not NFT or ITEM and the vendor is DECENTRALAND and the location is in browse", () => { + it('should return ITEM as the assetType', () => { + expect( + getAssetType.resultFunc( + 'assetType=something', + locations.browse(), + VendorName.DECENTRALAND + ) + ).toBe(AssetType.ITEM) + }) + }) + + describe("when there's assetType URL param and the assetType is NFT", () => { + it('should return NFT as the assetType', () => { + expect( + getAssetType.resultFunc( + 'assetType=nft', + locations.browse(), + VendorName.DECENTRALAND + ) + ).toBe(AssetType.NFT) + }) + }) + + describe("when there's assetType URL param and the assetType is ITEM", () => { + it('should return ITEM as the assetType', () => { + expect( + getAssetType.resultFunc( + 'assetType=item', + locations.lands(), + VendorName.KNOWN_ORIGIN + ) + ).toBe(AssetType.ITEM) + }) + }) +}) diff --git a/webapp/src/modules/routing/selectors.ts b/webapp/src/modules/routing/selectors.ts index 6837d0f04e..9876769517 100644 --- a/webapp/src/modules/routing/selectors.ts +++ b/webapp/src/modules/routing/selectors.ts @@ -9,6 +9,7 @@ import { View } from '../ui/types' import { WearableGender } from '../nft/wearable/types' import { VendorName } from '../vendor/types' import { isVendor } from '../vendor/utils' +import { Section, Sections } from '../vendor/routing/types' import { contracts } from '../contract/utils' import { RootState } from '../reducer' import { @@ -16,7 +17,7 @@ import { getURLParamArray, getURLParam } from './search' -import { SortBy, Section } from './types' +import { SortBy } from './types' import { locations } from './locations' import { AssetType } from '../asset/types' @@ -44,14 +45,26 @@ export const getSection = createSelector< string, ReturnType, VendorName, - string + Section >(getRouterSearch, getPathName, getVendor, (search, pathname, vendor) => { - const section = getURLParam(search, 'section') + const section = getURLParam(search, 'section') ?? '' if (!section && pathname === locations.lands()) { - return Section.decentraland.LAND + return Sections.decentraland.LAND + } + + if ( + (!section || section === Sections[vendor].ALL) && + pathname === locations.browse() && + vendor === VendorName.DECENTRALAND + ) { + return Sections.decentraland.WEARABLES + } + + if (!section || !(section.toUpperCase() in Sections[vendor])) { + return Sections[vendor].ALL } - return getURLParam(search, 'section') || Section[vendor].ALL + return section as Section }) export const getPage = createSelector( @@ -185,13 +198,18 @@ export const getAssetType = createSelector< RootState, string, string, + VendorName, AssetType ->(getRouterSearch, getPathName, (search, pathname) => { - let results = getURLParam(search, 'assetType') as AssetType - if (!results) { - results = pathname === locations.browse() ? AssetType.ITEM : AssetType.NFT +>(getRouterSearch, getPathName, getVendor, (search, pathname, vendor) => { + let assetTypeParam = getURLParam(search, 'assetType') ?? '' + + if (!assetTypeParam || !(assetTypeParam.toUpperCase() in AssetType)) { + if (vendor === VendorName.DECENTRALAND && pathname === locations.browse()) { + return AssetType.ITEM + } + return AssetType.NFT } - return results + return assetTypeParam as AssetType }) export const hasFiltersEnabled = createSelector< diff --git a/webapp/src/modules/routing/types.ts b/webapp/src/modules/routing/types.ts index 3f50251697..0ae6493534 100644 --- a/webapp/src/modules/routing/types.ts +++ b/webapp/src/modules/routing/types.ts @@ -4,7 +4,7 @@ import { VendorName } from '../vendor/types' import { View } from '../ui/types' import { WearableGender } from '../nft/wearable/types' -export { Section } from '../vendor/routing/types' +export { Sections } from '../vendor/routing/types' export enum SortBy { NAME = 'name', diff --git a/webapp/src/modules/vendor/routing/types.ts b/webapp/src/modules/vendor/routing/types.ts index 3c42ca1405..d11921c626 100644 --- a/webapp/src/modules/vendor/routing/types.ts +++ b/webapp/src/modules/vendor/routing/types.ts @@ -1,12 +1,18 @@ -import * as decentraland from '../decentraland' -import * as superRare from '../super_rare' -import * as makersPlace from '../makers_place' -import * as knownOrigin from '../known_origin' +import * as decentraland from '../decentraland/routing/types' +import * as superRare from '../super_rare/routing/types' +import * as makersPlace from '../makers_place/routing/types' +import * as knownOrigin from '../known_origin/routing/types' -export type Section = typeof Section +export type Sections = typeof Sections + +export type Section = + | decentraland.Section + | superRare.Section + | makersPlace.Section + | knownOrigin.Section // eslint-disable-next-line @typescript-eslint/no-redeclare -- Intentionally naming the variable the same as the type -export const Section = { +export const Sections = { decentraland: { ...decentraland.Section }, super_rare: { ...superRare.Section }, makers_place: { ...makersPlace.Section }, diff --git a/webapp/src/modules/vendor/utils.ts b/webapp/src/modules/vendor/utils.ts index 15bb179621..22c1e08d18 100644 --- a/webapp/src/modules/vendor/utils.ts +++ b/webapp/src/modules/vendor/utils.ts @@ -4,7 +4,7 @@ import { getSearchWearableCategory } from '../routing/search' import { BrowseOptions } from '../routing/types' -import { Section } from './routing/types' +import { Sections } from './routing/types' import { NFTsFetchFilters } from './nft/types' import { VendorName, Disabled } from './types' @@ -16,7 +16,7 @@ export function getFilters( switch (vendor) { case VendorName.DECENTRALAND: { - const currentSection = Section[VendorName.DECENTRALAND] + const currentSection = Sections[VendorName.DECENTRALAND] const isLand = section === currentSection.LAND const isWearableHead = section === currentSection.WEARABLES_HEAD @@ -43,7 +43,7 @@ export function getFilters( } as NFTsFetchFilters } case VendorName.KNOWN_ORIGIN: { - const currentSection = Section[VendorName.KNOWN_ORIGIN] + const currentSection = Sections[VendorName.KNOWN_ORIGIN] return { isEdition: section === currentSection.EDITIONS,