Skip to content

Commit

Permalink
fix: Remove ENS resolver FF (#3054)
Browse files Browse the repository at this point in the history
* fix: Remove ENS resolver FF

* fix: Remove use of FF
  • Loading branch information
LautaroPetaccio authored Mar 4, 2024
1 parent 804d0c8 commit 4e477fe
Show file tree
Hide file tree
Showing 28 changed files with 54 additions and 346 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
161 changes: 5 additions & 156 deletions src/components/ENSListPage/ENSListPage.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
import React from 'react'
import { Link } from 'react-router-dom'
import { config } from 'config'
import {
Popup,
Button,
Table,
Row,
Column,
Header,
Section,
Container,
Pagination,
Dropdown,
Empty,
Icon as DCLIcon
} from 'decentraland-ui'
import { Popup, Button, Dropdown, Icon as DCLIcon } from 'decentraland-ui'
import { TableContainer, TableContent } from 'decentraland-ui/dist/components/v2'
import { T, t } from 'decentraland-dapps/dist/modules/translation/utils'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { DataTableType } from 'decentraland-ui/dist/components/v2/Table/TableContent/TableContent.types'
import { shorten } from 'lib/address'
import { locations } from 'routing/locations'
Expand Down Expand Up @@ -220,144 +207,6 @@ export default class ENSListPage extends React.PureComponent<Props, State> {
)
}

renderEnsList() {
const { ensList, hasProfileCreated } = this.props
const { page } = this.state

const total = ensList.length
const totalPages = Math.ceil(total / PAGE_SIZE)
const paginatedItems = this.paginate()
return (
<>
<div className="filters">
<Container>
<Row>
<Column>
<Row>
<Header sub className="items-count">
{t('ens_list_page.items', { count: ensList.length.toLocaleString() })}
</Header>
</Row>
</Column>
<Column align="right">
<Row>{ensList.length > 1 ? this.renderSortDropdown() : null}</Row>
</Column>
</Row>
</Container>
</div>
<Container>
<Section className="table-section">
{ensList.length > 0 ? (
<Table basic="very">
<Table.Header>
<Table.Row>
<Table.HeaderCell width="2">{t('ens_list_page.table.name')}</Table.HeaderCell>
<Table.HeaderCell width="2">{t('ens_list_page.table.assigned_to')}</Table.HeaderCell>
<Table.HeaderCell width="2">{t('ens_list_page.table.link')}</Table.HeaderCell>
<Table.HeaderCell width="2"></Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{paginatedItems.map((ens: ENS, index) => {
return (
<Table.Row className="TableRow" key={index}>
<Table.Cell>
<Row>
<Column className="subdomain-wrapper">
<div>{ens.name}</div>
{this.isAlias(ens) ? (
<Popup
content={t('ens_list_page.alias_popup')}
position="top center"
trigger={
<div>
<Icon name="profile" />
</div>
}
on="hover"
/>
) : null}
</Column>
</Row>
</Table.Cell>
<Table.Cell>
<Row>
<Column>{this.getAssignedToMessage(ens)}</Column>
</Row>
</Table.Cell>
<Table.Cell>
<Row>
<Column className="link">
{ens.landId ? (
<a target="_blank" href={`https://${ens.subdomain}.${config.get('ENS_GATEWAY')}`} rel="noopener noreferrer">
{ens.subdomain} <Icon name="right-round-arrow" />
</a>
) : null}
</Column>
</Row>
</Table.Cell>
<Table.Cell>
<Row>
{!this.isAlias(ens) ? (
<Column align="right">
<Popup
content={t('ens_list_page.not_profile_created')}
position="top center"
on="hover"
disabled={hasProfileCreated}
trigger={this.renderUseAsAliasButton(ens, hasProfileCreated)}
/>
</Column>
) : null}
{!ens.landId ? (
<Column align="right">
<Button className="ui basic button" onClick={() => this.handleAssignENS(ens)}>
{t('ens_list_page.button.assign')}
</Button>
</Column>
) : null}
{ens.landId ? (
<Column align="right">
<Button className="ui basic button" onClick={() => this.handleAssignENS(ens)}>
{t('ens_list_page.button.edit')}
</Button>
</Column>
) : null}
</Row>
</Table.Cell>
</Table.Row>
)
})}
</Table.Body>
</Table>
) : (
<Empty className="empty-names" height={200}>
<div>
<T
id="ens_list_page.empty_names"
values={{
br: <br />,
link: <a href={`${MARKETPLACE_WEB_URL}/names/claim`}>{t('global.click_here')}</a>
}}
/>
</div>
</Empty>
)}
{totalPages > 1 && (
<Pagination
firstItem={null}
lastItem={null}
totalPages={totalPages}
activePage={page}
onPageChange={(_event, props) => this.setState({ page: +props.activePage! })}
/>
)}
</Section>
</Container>
</>
)
}

formatToTable(ensList: ENS[]): DataTableType[] {
return ensList.map(ens => ({
name: (
Expand Down Expand Up @@ -441,7 +290,7 @@ export default class ENSListPage extends React.PureComponent<Props, State> {
)
}

renderNewEnsList() {
renderEnsList() {
const { ensList } = this.props
const { page } = this.state

Expand Down Expand Up @@ -509,7 +358,7 @@ export default class ENSListPage extends React.PureComponent<Props, State> {
}

render() {
const { isLoading, isEnsAddressEnabled, error } = this.props
const { isLoading, error } = this.props
return (
<LoggedInDetailPage
className="ENSListPage view"
Expand All @@ -518,7 +367,7 @@ export default class ENSListPage extends React.PureComponent<Props, State> {
isLoading={isLoading}
isPageFullscreen={true}
>
{isEnsAddressEnabled ? this.renderNewEnsList() : this.renderEnsList()}
{this.renderEnsList()}
</LoggedInDetailPage>
)
}
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 @@ -36,8 +36,7 @@ export default class LandAssignENSForm extends React.PureComponent<Props> {
}

render() {
const { ens, land, isLoading, isWaitingTxSetContent, isWaitingTxSetResolver, isWaitingTxReclaim, error, isEnsAddressEnabled } =
this.props
const { ens, land, isLoading, isWaitingTxSetContent, isWaitingTxSetResolver, isWaitingTxReclaim, error } = this.props

const needsReclaiming = ens.ensOwnerAddress !== ens.nftOwnerAddress
const hasResolver = !isResolverEmpty(ens) && ens.resolver.toLowerCase() === ENS_RESOLVER_ADDRESS.toLowerCase()
Expand All @@ -52,9 +51,7 @@ export default class LandAssignENSForm extends React.PureComponent<Props> {

const setResolverButtonClassName = hasResolver && !isWaitingTxSetResolver && !hasResolverError ? 'grey-button' : ''
const setContentButtonClassName = hasContent && !isWaitingTxSetContent && !hasContentError ? 'grey-button' : ''
const reclaimContentButtonClassName = !needsReclaiming && !isWaitingTxReclaim && !hasReclaimError ? 'grey-button' : ''

const isReclaimButtonDisabled = hasReclaimError || !needsReclaiming
const isSetResolverButtonDisabled = hasResolverError || hasData || needsReclaiming || isWaitingTxSetResolver || isWaitingTxReclaim
const isSetContentButtonDisabled =
hasContentError ||
Expand All @@ -74,36 +71,6 @@ export default class LandAssignENSForm extends React.PureComponent<Props> {
{t('land_assign_ens_page.set_name_message', { strong: (children: React.ReactElement) => <strong>{children}</strong> })}
</p>
</Row>
{!isEnsAddressEnabled ? (
<Row>
<div className={isReclaimButtonDisabled ? 'box box-disabled' : 'box'}>
<h3>{t('land_assign_ens_page.reclaim')}</h3>
<div className="message-box">
<p>{t('land_assign_ens_page.reclaim_explanation')}</p>
<NetworkButton
type="submit"
disabled={isReclaimButtonDisabled}
onClick={this.handleReclaim}
className={reclaimContentButtonClassName}
loading={isWaitingTxReclaim}
primary
network={Network.ETHEREUM}
>
{hasReclaimError ? (
t('global.retry_tx')
) : !needsReclaiming ? (
<>
{t('global.approved_tx')}
{!isWaitingTxReclaim ? <Icon name="check" /> : null}
</>
) : (
t('global.submit')
)}
</NetworkButton>
</div>
</div>
</Row>
) : null}
<Row>
<div className={isSetResolverButtonDisabled ? 'box box-disabled' : 'box'}>
<h3>{t('land_assign_ens_page.set_resolver')}</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export type Props = {
isWaitingTxSetResolver: boolean
isWaitingTxReclaim: boolean
error: ENSError | null
isEnsAddressEnabled: boolean
onSetENSResolver: (ens: ENS) => void
onSetENSContent: (ens: ENS, land: Land) => void
onReclaimName: (ens: ENS) => void
Expand Down
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
2 changes: 0 additions & 2 deletions src/components/LandAssignENSPage/LandAssignENSPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default class LandAssignENSPage extends React.PureComponent<Props> {
isWaitingTxSetContent,
isWaitingTxReclaim,
isWaitingTxSetResolver,
isEnsAddressEnabled,
onSetENSResolver,
onSetENSContent,
onReclaimName,
Expand All @@ -42,7 +41,6 @@ export default class LandAssignENSPage extends React.PureComponent<Props> {
}
>
<LandAssignENSForm
isEnsAddressEnabled={isEnsAddressEnabled}
land={land}
ens={ens}
error={error}
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
Loading

0 comments on commit 4e477fe

Please sign in to comment.