Skip to content

Commit

Permalink
fix: Remove ENS resolver FF
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio committed Mar 4, 2024
1 parent ed9890a commit 13bfea0
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 79 deletions.
2 changes: 0 additions & 2 deletions src/components/ENSListPage/ENSListPage.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { FETCH_ENS_LIST_REQUEST } from 'modules/ens/actions'
import { getLands, getLoading as getLandsLoading, getError as getLandsError } from 'modules/land/selectors'
import { FETCH_LANDS_REQUEST } from 'modules/land/actions'
import { getAvatar, getName } from 'modules/profile/selectors'
import { getIsEnsAddressEnabled } from 'modules/features/selectors'
import { openModal } from 'decentraland-dapps/dist/modules/modal/actions'
import { MapStateProps, MapDispatchProps, MapDispatch } from './ENSListPage.types'
import ENSListPage from './ENSListPage'
Expand All @@ -26,7 +25,6 @@ const mapState = (state: RootState): MapStateProps => ({
isLoadingType(getLoading(state), FETCH_ENS_LIST_REQUEST) ||
isLoggingIn(state),
isLoggedIn: isLoggedIn(state),
isEnsAddressEnabled: getIsEnsAddressEnabled(state),
avatar: getAvatar(state)
})

Expand Down
3 changes: 1 addition & 2 deletions src/components/ENSListPage/ENSListPage.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type Props = {
hasProfileCreated: boolean
isLoggedIn: boolean
isLoading: boolean
isEnsAddressEnabled: boolean
avatar: Avatar | null
onNavigate: (path: string) => void
onOpenModal: typeof openModal
Expand All @@ -31,7 +30,7 @@ export type State = {

export type MapStateProps = Pick<
Props,
'address' | 'alias' | 'ensList' | 'lands' | 'hasProfileCreated' | 'isLoading' | 'error' | 'isLoggedIn' | 'isEnsAddressEnabled' | 'avatar'
'address' | 'alias' | 'ensList' | 'lands' | 'hasProfileCreated' | 'isLoading' | 'error' | 'isLoggedIn' | 'avatar'
>
export type MapDispatchProps = Pick<Props, 'onNavigate' | 'onOpenModal'>
export type MapDispatch = Dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
} from 'modules/ens/selectors'
import { MapStateProps, MapDispatchProps, MapDispatch, OwnProps } from './LandAssignENSPage.types'
import LandAssignENSPage from './LandAssignENSPage'
import { getIsEnsAddressEnabled } from 'modules/features/selectors'

const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
const { landId, subdomain } = ownProps.match.params
Expand All @@ -37,7 +36,6 @@ const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
isWaitingTxSetResolver: isLoadingType(getLoading(state), SET_ENS_RESOLVER_REQUEST) || isWaitingTxSetResolver(state),
isWaitingTxSetContent: isLoadingType(getLoading(state), SET_ENS_CONTENT_REQUEST) || isWaitingTxSetLandContent(state, landId),
isWaitingTxReclaim: ens ? isReclaimingName(state, ens.subdomain) || isWaitingTxReclaim(state) : false,
isEnsAddressEnabled: getIsEnsAddressEnabled(state),
isLoading:
isLoadingType(getLoading(state), SET_ENS_RESOLVER_REQUEST) ||
isLoadingType(getLoading(state), SET_ENS_CONTENT_REQUEST) ||
Expand Down
3 changes: 1 addition & 2 deletions src/components/LandAssignENSPage/LandAssignENSPage.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export type Props = {
isWaitingTxSetContent: boolean
isWaitingTxSetResolver: boolean
isWaitingTxReclaim: boolean
isEnsAddressEnabled: boolean
onSetENSResolver: typeof setENSResolverRequest
onSetENSContent: typeof setENSContentRequest
onReclaimName: typeof reclaimNameRequest
Expand All @@ -33,7 +32,7 @@ export type Props = {

export type MapStateProps = Pick<
Props,
'ens' | 'isLoading' | 'error' | 'isWaitingTxSetContent' | 'isWaitingTxSetResolver' | 'isWaitingTxReclaim' | 'isEnsAddressEnabled'
'ens' | 'isLoading' | 'error' | 'isWaitingTxSetContent' | 'isWaitingTxSetResolver' | 'isWaitingTxReclaim'
>
export type MapDispatchProps = Pick<Props, 'onSetENSResolver' | 'onSetENSContent' | 'onReclaimName' | 'onBack' | 'onNavigate'>
export type MapDispatch = Dispatch<
Expand Down
10 changes: 2 additions & 8 deletions src/components/LandOperatorPage/LandOperatorPage.container.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { connect } from 'react-redux'
import { setOperatorRequest } from 'modules/land/actions'
import { RootState } from 'modules/common/types'
import { getIsEnsAddressEnabled } from 'modules/features/selectors'
import LandOperatorPage from './LandOperatorPage'
import { MapDispatchProps, MapDispatch, MapStateProps } from './LandOperatorPage.types'

const mapState = (state: RootState): MapStateProps => ({
isEnsAddressEnabled: getIsEnsAddressEnabled(state)
})
import { MapDispatchProps, MapDispatch } from './LandOperatorPage.types'

const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({
onSetOperator: (land, address) => dispatch(setOperatorRequest(land, address))
})

export default connect(mapState, mapDispatch)(LandOperatorPage)
export default connect(undefined, mapDispatch)(LandOperatorPage)
2 changes: 0 additions & 2 deletions src/components/LandOperatorPage/LandOperatorPage.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { Dispatch } from 'redux'
import { setOperatorRequest } from 'modules/land/actions'

export type Props = {
isEnsAddressEnabled: boolean
onSetOperator: typeof setOperatorRequest
}

export type MapStateProps = Pick<Props, 'isEnsAddressEnabled'>
export type MapDispatchProps = Pick<Props, 'onSetOperator'>
export type MapDispatch = Dispatch
10 changes: 2 additions & 8 deletions src/components/LandTransferPage/LandTransferPage.container.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { connect } from 'react-redux'
import { transferLandRequest } from 'modules/land/actions'
import { RootState } from 'modules/common/types'
import { getIsEnsAddressEnabled } from 'modules/features/selectors'
import { MapDispatchProps, MapDispatch, MapStateProps } from './LandTransferPage.types'
import { MapDispatchProps, MapDispatch } from './LandTransferPage.types'
import LandTransferPage from './LandTransferPage'

const mapState = (state: RootState): MapStateProps => ({
isEnsAddressEnabled: getIsEnsAddressEnabled(state)
})

const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({
onTransfer: (land, address) => dispatch(transferLandRequest(land, address))
})

export default connect(mapState, mapDispatch)(LandTransferPage)
export default connect(undefined, mapDispatch)(LandTransferPage)
2 changes: 0 additions & 2 deletions src/components/LandTransferPage/LandTransferPage.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { transferLandRequest, TransferLandRequestAction } from 'modules/land/act
import { Dispatch } from 'redux'

export type Props = {
isEnsAddressEnabled: boolean
onTransfer: typeof transferLandRequest
}

Expand All @@ -11,6 +10,5 @@ export type State = {
isValid: boolean
}

export type MapStateProps = Pick<Props, 'isEnsAddressEnabled'>
export type MapDispatchProps = Pick<Props, 'onTransfer'>
export type MapDispatch = Dispatch<TransferLandRequestAction>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { getCollection, getLoading } from 'modules/collection/selectors'
import { MapStateProps, MapDispatchProps, MapDispatch, OwnProps } from './ManageCollectionRoleModal.types'
import ManageCollectionRoleModal from './ManageCollectionRoleModal'
import { getIsEnsAddressEnabled } from 'modules/features/selectors'

const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
const { collectionId } = ownProps.metadata
Expand All @@ -23,7 +22,6 @@ const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
return {
wallet: getWallet(state)!,
collection: getCollection(state, collectionId)!,
isEnsAddressEnabled: getIsEnsAddressEnabled(state),
isLoading:
isLoadingType(getLoading(state), SET_COLLECTION_MANAGERS_REQUEST) || isLoadingType(getLoading(state), SET_COLLECTION_MINTERS_REQUEST)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type Props = Omit<ModalProps, 'metadata'> & {
wallet: Wallet
collection: Collection
isLoading: boolean
isEnsAddressEnabled: boolean
onSetManagers: typeof setCollectionManagersRequest
onSetMinters: typeof setCollectionMintersRequest
}
Expand All @@ -29,7 +28,7 @@ export type ManageCollectionRoleModalMetadata = {
roles: string[]
}

export type MapStateProps = Pick<Props, 'wallet' | 'collection' | 'isLoading' | 'isEnsAddressEnabled'>
export type MapStateProps = Pick<Props, 'wallet' | 'collection' | 'isLoading'>
export type MapDispatchProps = Pick<Props, 'onSetManagers' | 'onSetMinters'>
export type MapDispatch = Dispatch<SetCollectionManagersRequestAction | SetCollectionMintersRequestAction>
export type OwnProps = Pick<Props, 'metadata'>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { canMintItem, UNSYNCED_STATES } from 'modules/item/utils'
import { getAuthorizedItems, getStatusByItemId } from 'modules/item/selectors'
import { MapStateProps, MapDispatchProps, MapDispatch, OwnProps } from './MintItemsModal.types'
import MintItemsModal from './MintItemsModal'
import { getIsEnsAddressEnabled } from 'modules/features/selectors'

const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
const { itemIds } = ownProps.metadata
Expand Down Expand Up @@ -45,7 +44,6 @@ const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
ethAddress,
collection,
totalCollectionItems,
isEnsAddressEnabled: getIsEnsAddressEnabled(state),
hasUnsyncedItems
}
}
Expand Down
12 changes: 2 additions & 10 deletions src/components/Modals/MintItemsModal/MintItemsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class MintItemsModal extends React.PureComponent<Props, State> {
handleView = (newConfirmState: View) => this.setState({ confirm: newConfirmState })

render() {
const { collection, totalCollectionItems, isLoading, isEnsAddressEnabled, hasUnsyncedItems, onClose } = this.props
const { collection, totalCollectionItems, isLoading, hasUnsyncedItems, onClose } = this.props
const { itemMints, error, confirm } = this.state

const items = this.props.items.concat(this.state.items)
Expand Down Expand Up @@ -195,15 +195,7 @@ export default class MintItemsModal extends React.PureComponent<Props, State> {
{isEmpty ? (
<div className="empty">{t('mint_items_modal.no_items', { name: collection.name })}</div>
) : (
items.map(item => (
<MintableItem
key={item.id}
item={item}
mints={itemMints[item.id]}
onChange={this.handleMintsChange}
isEnsAddressEnabled={isEnsAddressEnabled}
/>
))
items.map(item => <MintableItem key={item.id} item={item} mints={itemMints[item.id]} onChange={this.handleMintsChange} />)
)}
{isFull ? null : (
<ItemDropdown placeholder={t('mint_items_modal.add_item')} onChange={this.handleAddItems} filter={filterAddableItems} />
Expand Down
5 changes: 1 addition & 4 deletions src/components/Modals/MintItemsModal/MintItemsModal.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ export type State = {
confirm: View
}

export type MapStateProps = Pick<
Props,
'ethAddress' | 'collection' | 'items' | 'totalCollectionItems' | 'isLoading' | 'hasUnsyncedItems' | 'isEnsAddressEnabled'
>
export type MapStateProps = Pick<Props, 'ethAddress' | 'collection' | 'items' | 'totalCollectionItems' | 'isLoading' | 'hasUnsyncedItems'>
export type MapDispatchProps = Pick<Props, 'onMint'>
export type MapDispatch = Dispatch<MintCollectionItemsRequestAction>
export type OwnProps = Pick<Props, 'metadata'>
26 changes: 7 additions & 19 deletions src/components/Modals/MintItemsModal/MintableItem/MintableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class MintableItem extends React.PureComponent<Props> {
}

render() {
const { item, mints, isEnsAddressEnabled } = this.props
const { item, mints } = this.props

return (
<div className="MintableItem">
Expand All @@ -103,24 +103,12 @@ export default class MintableItem extends React.PureComponent<Props> {
</Row>
{mints.map(({ address, amount }, index) => (
<Section key={index} className="mint" size="tiny">
{isEnsAddressEnabled ? (
<AddressField
value={address}
className="rounded-address"
fieldClassName="rounded"
onChange={this.getChangeAddressHandler(index)}
/>
) : (
<Field
className="rounded"
type="address"
placeholder={t('global.address')}
value={address || ''}
message={undefined}
error={!this.isValidAddress(address)}
onChange={this.getChangeAddressHandler(index)}
/>
)}
<AddressField
value={address}
className="rounded-address"
fieldClassName="rounded"
onChange={this.getChangeAddressHandler(index)}
/>
<Field
className="rounded"
type="number"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ import { Mint } from 'modules/collection/types'
export type Props = {
item: Item
mints: Partial<Mint>[]
isEnsAddressEnabled: boolean
onChange: (item: Item, mints: Partial<Mint>[]) => void
}
5 changes: 2 additions & 3 deletions src/modules/features/selectors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getIsFeatureEnabled } from 'decentraland-dapps/dist/modules/features/selectors'
import { ApplicationName } from 'decentraland-dapps/dist/modules/features/types'
import { RootState } from 'modules/common/types'
import { getIsCreateSceneOnlySDK7Enabled, getIsMaintenanceEnabled, getIsSDK7TemplatesEnabled, getIsEnsAddressEnabled } from './selectors'
import { getIsCreateSceneOnlySDK7Enabled, getIsMaintenanceEnabled, getIsSDK7TemplatesEnabled } from './selectors'
import { FeatureName } from './types'

jest.mock('decentraland-dapps/dist/modules/features/selectors')
Expand Down Expand Up @@ -55,8 +55,7 @@ describe('when getting if maintainance is enabled', () => {

const ffSelectors = [
{ selector: getIsSDK7TemplatesEnabled, app: ApplicationName.BUILDER, feature: FeatureName.SDK7_TEMPLATES },
{ selector: getIsCreateSceneOnlySDK7Enabled, app: ApplicationName.BUILDER, feature: FeatureName.CREATE_SCENE_ONLY_SDK7 },
{ selector: getIsEnsAddressEnabled, app: ApplicationName.DAPPS, feature: FeatureName.ENS_ADDRESS }
{ selector: getIsCreateSceneOnlySDK7Enabled, app: ApplicationName.BUILDER, feature: FeatureName.CREATE_SCENE_ONLY_SDK7 }
]

ffSelectors.forEach(({ selector, app, feature }) => {
Expand Down
8 changes: 0 additions & 8 deletions src/modules/features/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,3 @@ export const getIsCreateSceneOnlySDK7Enabled = (state: RootState) => {
return false
}
}

export const getIsEnsAddressEnabled = (state: RootState) => {
try {
return getIsFeatureEnabled(state, ApplicationName.DAPPS, FeatureName.ENS_ADDRESS)
} catch (e) {
return false
}
}

0 comments on commit 13bfea0

Please sign in to comment.