Skip to content

Commit

Permalink
feat: disable MakersPlace
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosantangelo committed Aug 10, 2020
1 parent cc90cae commit b799aa8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
7 changes: 3 additions & 4 deletions webapp/src/components/PartnersPage/PartnersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Page, Responsive } from 'decentraland-ui'

import { locations } from '../../modules/routing/locations'
import { SortBy } from '../../modules/routing/types'
import { PartnerView } from '../../modules/ui/nft/partner/types'
import { Vendors, Partner } from '../../modules/vendor/types'
import { NavigationTab } from '../Navigation/Navigation.types'
import { Row } from '../Layout/Row'
Expand All @@ -29,8 +28,8 @@ const PartnersPage = (props: Props) => {

// Kick things off
useEffect(() => {
let view: Partner
for (view in partners) {
for (const partner in partners) {
const view = partner as Partner
onFetchNFTsFromRoute({
view,
vendor: view,
Expand All @@ -42,7 +41,7 @@ const PartnersPage = (props: Props) => {
// eslint-disable-next-line
}, [onFetchNFTsFromRoute])

const views = Object.keys(partners) as PartnerView[]
const views = Object.keys(partners) as Partner[]

return (
<>
Expand Down
28 changes: 14 additions & 14 deletions webapp/src/modules/ui/nft/partner/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { LoadingState } from 'decentraland-dapps/dist/modules/loading/reducer'
import { NFTState } from '../../../nft/reducer'
import { FETCH_NFTS_REQUEST } from '../../../nft/actions'
import { NFT } from '../../../nft/types'
import { Partner } from '../../../vendor/types'
import {
getData as getNFTData,
getLoading as getNFTLoading
} from '../../../nft/selectors'
import { RootState } from '../../../reducer'
import { PartnerView } from './types'
import { PartnerUIState } from './reducer'

export const getState = (state: RootState) => state.ui.nft.partner
Expand All @@ -18,33 +18,33 @@ export const getPartners = createSelector<
RootState,
PartnerUIState,
NFTState['data'],
Record<PartnerView, NFT[]>
>(getState, getNFTData, (partner, nftsById) => {
Record<Partner, NFT[]>
>(getState, getNFTData, (partnerState, nftsById) => {
const partners = Object.values(Partner) as Partner[]
const result: Record<string, NFT[]> = {}

let view: PartnerView
for (view in partner) {
result[view] = partner[view].map(id => nftsById[id])
for (const partner of partners) {
result[partner] = partnerState[partner].map(id => nftsById[id])
}

return result as Record<PartnerView, NFT[]>
return result as Record<Partner, NFT[]>
})

export const getPartnersLoading = createSelector<
RootState,
PartnerUIState,
LoadingState,
Record<PartnerView, boolean>
>(getState, getNFTLoading, (partner, nftLoading) => {
Record<Partner, boolean>
>(getNFTLoading, nftLoading => {
const partners = Object.values(Partner) as Partner[]
const result: Record<string, boolean> = {}

for (const view in partner) {
result[view] = nftLoading.some(
for (const partner of partners) {
result[partner] = nftLoading.some(
action =>
action.type === FETCH_NFTS_REQUEST &&
action.payload.options.view === view
action.payload.options.view === partner
)
}

return result as Record<PartnerView, boolean>
return result as Record<Partner, boolean>
})
3 changes: 0 additions & 3 deletions webapp/src/modules/ui/nft/partner/types.ts

This file was deleted.

9 changes: 6 additions & 3 deletions webapp/src/modules/vendor/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import * as superRare from './super_rare'
import * as makersPlace from './makers_place'

export enum Partner {
SUPER_RARE = 'super_rare',
SUPER_RARE = 'super_rare'
}

enum Disabled {
MAKERS_PLACE = 'makers_place'
}

enum Base {
DECENTRALAND = 'decentraland'
}

export type Vendors = Partner | Base
export const Vendors = { ...Partner, ...Base }
export type Vendors = Partner | Base | Disabled
export const Vendors = { ...Partner, ...Base, ...Disabled }

export type ContractName =
| decentraland.ContractName
Expand Down

0 comments on commit b799aa8

Please sign in to comment.