Skip to content

Commit e2ccfe2

Browse files
feat: Don't show slots if LW payments is enabled (#3186)
1 parent c7b9af9 commit e2ccfe2

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

src/components/ThirdPartyCollectionDetailPage/ThirdPartyCollectionDetailPage.container.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { openModal } from 'decentraland-dapps/dist/modules/modal/actions'
1313
import { getCollectionThirdParty, isFetchingAvailableSlots } from 'modules/thirdParty/selectors'
1414
import { fetchThirdPartyAvailableSlotsRequest } from 'modules/thirdParty/actions'
1515
import { isThirdPartyCollection } from 'modules/collection/utils'
16-
import { getIsLinkedWearablesV2Enabled } from 'modules/features/selectors'
16+
import { Collection } from 'modules/collection/types'
17+
import { getIsLinkedWearablesPaymentsEnabled, getIsLinkedWearablesV2Enabled } from 'modules/features/selectors'
1718
import { getLastLocation } from 'modules/ui/location/selector'
1819
import { MapStateProps, MapDispatchProps, MapDispatch } from './ThirdPartyCollectionDetailPage.types'
1920
import CollectionDetailPage from './ThirdPartyCollectionDetailPage'
@@ -33,6 +34,7 @@ const mapState = (state: RootState): MapStateProps => {
3334
wallet: getWallet(state)!,
3435
collection,
3536
isThirdPartyV2Enabled: getIsLinkedWearablesV2Enabled(state),
37+
isLinkedWearablesPaymentsEnabled: getIsLinkedWearablesPaymentsEnabled(state),
3638
thirdParty: collection && isThirdPartyCollection(collection) ? getCollectionThirdParty(state, collection) : null,
3739
authorizations: getAuthorizations(state),
3840
isLoading:
@@ -45,7 +47,8 @@ const mapState = (state: RootState): MapStateProps => {
4547
}
4648

4749
const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({
48-
onOpenModal: (name, metadata) => dispatch(openModal(name, metadata)),
50+
onNewItem: (collectionId: string) => dispatch(openModal('CreateItemsModal', { collectionId })),
51+
onEditName: (collection: Collection) => dispatch(openModal('EditCollectionNameModal', { collection })),
4952
onFetchAvailableSlots: (thirdPartyId: string) => dispatch(fetchThirdPartyAvailableSlotsRequest(thirdPartyId))
5053
})
5154

src/components/ThirdPartyCollectionDetailPage/ThirdPartyCollectionDetailPage.tsx

+26-15
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ export default function ThirdPartyCollectionDetailPage({
6464
totalItems,
6565
isLoading,
6666
isThirdPartyV2Enabled,
67-
onOpenModal,
67+
isLinkedWearablesPaymentsEnabled,
6868
onFetchAvailableSlots,
69+
onNewItem,
70+
onEditName,
6971
isLoadingAvailableSlots
7072
}: Props) {
7173
const [selectedItems, setSelectedItems] = useState<Record<string, boolean>>({})
@@ -100,14 +102,16 @@ export default function ThirdPartyCollectionDetailPage({
100102
}, [page, shouldFetchAllPages, items, thirdParty, currentPage])
101103

102104
const handleNewItems = useCallback(() => {
103-
onOpenModal('CreateItemsModal', { collectionId: collection!.id })
104-
}, [collection, onOpenModal])
105+
if (collection?.id) {
106+
onNewItem(collection.id)
107+
}
108+
}, [collection?.id, onNewItem])
105109

106110
const handleEditName = useCallback(() => {
107111
if (collection) {
108-
onOpenModal('EditCollectionNameModal', { collection })
112+
onEditName(collection)
109113
}
110-
}, [collection, onOpenModal])
114+
}, [collection, onEditName])
111115

112116
const handleGoBack = useCallback(() => {
113117
if (isComingFromTheCollectionsPage) {
@@ -255,16 +259,21 @@ export default function ThirdPartyCollectionDetailPage({
255259
</CopyToClipboard>
256260
</Info>
257261
)}
258-
<Info title={t('third_party_collection_detail_page.slots_short')} info={t('third_party_collection_detail_page.slots_long')}>
259-
<div className={styles.slotsIcon} />
260-
{isLoadingAvailableSlots ? (
261-
<Loader active inline size="tiny" />
262-
) : (
263-
<span>
264-
{thirdParty.availableSlots ?? 0} / {thirdParty.maxItems}
265-
</span>
266-
)}
267-
</Info>
262+
{!isLinkedWearablesPaymentsEnabled && (
263+
<Info
264+
title={t('third_party_collection_detail_page.slots_short')}
265+
info={t('third_party_collection_detail_page.slots_long')}
266+
>
267+
<div className={styles.slotsIcon} />
268+
{isLoadingAvailableSlots ? (
269+
<Loader active inline size="tiny" />
270+
) : (
271+
<span>
272+
{thirdParty.availableSlots ?? 0} / {thirdParty.maxItems}
273+
</span>
274+
)}
275+
</Info>
276+
)}
268277
<Button inverted onClick={handleNewItems}>
269278
<Icon name="plus" />
270279
{t('third_party_collection_detail_page.new_items')}
@@ -393,6 +402,8 @@ export default function ThirdPartyCollectionDetailPage({
393402
collection,
394403
selectedItems,
395404
isLoadingAvailableSlots,
405+
isLinkedWearablesPaymentsEnabled,
406+
isThirdPartyV2Enabled,
396407
totalItems,
397408
page,
398409
handleSelectItemChange,

src/components/ThirdPartyCollectionDetailPage/ThirdPartyCollectionDetailPage.types.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Dispatch } from 'redux'
22
import { Wallet } from 'decentraland-dapps/dist/modules/wallet/types'
33
import { Authorization } from 'decentraland-dapps/dist/modules/authorization/types'
44
import { FetchCollectionsParams } from 'lib/api/builder'
5-
import { openModal, OpenModalAction } from 'decentraland-dapps/dist/modules/modal/actions'
5+
import { OpenModalAction } from 'decentraland-dapps/dist/modules/modal/actions'
66
import { Item } from 'modules/item/types'
77
import { Collection } from 'modules/collection/types'
88
import { ThirdParty } from 'modules/thirdParty/types'
@@ -29,7 +29,9 @@ export type Props = {
2929
isLoading: boolean
3030
isLoadingAvailableSlots: boolean
3131
isThirdPartyV2Enabled: boolean
32-
onOpenModal: typeof openModal
32+
isLinkedWearablesPaymentsEnabled: boolean
33+
onNewItem: (collectionId: string) => unknown
34+
onEditName: (collection: Collection) => unknown
3335
onFetchAvailableSlots: typeof fetchThirdPartyAvailableSlotsRequest
3436
}
3537

@@ -49,6 +51,7 @@ export type MapStateProps = Pick<
4951
| 'thirdParty'
5052
| 'isLoading'
5153
| 'isLoadingAvailableSlots'
54+
| 'isLinkedWearablesPaymentsEnabled'
5255
| 'authorizations'
5356
| 'currentPage'
5457
| 'totalItems'
@@ -57,7 +60,7 @@ export type MapStateProps = Pick<
5760
| 'paginatedData'
5861
| 'lastLocation'
5962
>
60-
export type MapDispatchProps = Pick<Props, 'onOpenModal' | 'onFetchAvailableSlots'>
63+
export type MapDispatchProps = Pick<Props, 'onNewItem' | 'onEditName' | 'onFetchAvailableSlots'>
6164
export type MapDispatch = Dispatch<
6265
OpenModalAction | FetchItemCurationsRequestAction | FetchThirdPartyAvailableSlotsRequestAction | FetchCollectionItemsRequestAction
6366
>

0 commit comments

Comments
 (0)