Skip to content

Commit

Permalink
fix: Partners not showing up (decentraland#419)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
LautaroPetaccio authored Sep 15, 2021
1 parent 95b38f6 commit 2f7af2b
Show file tree
Hide file tree
Showing 18 changed files with 257 additions and 74 deletions.
2 changes: 1 addition & 1 deletion webapp/.ci/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webapp/.ci/.env.prd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webapp/.ci/.env.stg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webapp/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions webapp/src/components/AssetBrowse/AssetBrowse.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
48 changes: 27 additions & 21 deletions webapp/src/components/AssetBrowse/AssetBrowse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:
Expand Down Expand Up @@ -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
},
{
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/AssetBrowse/AssetBrowse.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
19 changes: 6 additions & 13 deletions webapp/src/components/BrowsePage/BrowsePage.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => ({})

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/BrowsePage/BrowsePage.types.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/Vendor/NFTSections/NFTSections.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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 (
<Menu className="NFTSections">
<MenuItem
Expand All @@ -41,7 +41,7 @@ const NFTSections = (props: Props) => {
return (
<DecentralandNFTSections
section={section as DecentralandSection}
sections={[Section.decentraland.ALL]}
sections={[Sections.decentraland.ALL]}
onSectionClick={onSectionClick}
/>
)
Expand Down
6 changes: 4 additions & 2 deletions webapp/src/components/Vendor/NFTSidebar/NFTSidebar.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -33,7 +33,9 @@ const NFTSidebar = (props: Props) => {
return (
<DecentralandNFTSidebar
section={section as DecentralandSection}
sections={sections ?? [Section.decentraland.ALL]}
sections={
(sections as DecentralandSection[]) ?? [Sections.decentraland.ALL]
}
onMenuItemClick={handleOnBrowse}
/>
)
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/Vendor/NFTSidebar/NFTSidebar.types.ts
Original file line number Diff line number Diff line change
@@ -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
}

Expand Down
7 changes: 3 additions & 4 deletions webapp/src/modules/routing/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -83,7 +83,6 @@ function* handleBrowse(action: BrowseAction) {
action.payload.options
)
const { pathname }: ReturnType<typeof getLocation> = yield select(getLocation)

yield fetchAssetsFromRoute(options)
yield put(push(buildBrowseURL(pathname, options)))
}
Expand Down Expand Up @@ -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!)
Expand Down
Loading

0 comments on commit 2f7af2b

Please sign in to comment.