Skip to content

Commit

Permalink
feat: Add new Manage button to the name detail page (decentraland#531)
Browse files Browse the repository at this point in the history
* feat: Add new Manage button to the name detail page

* feat: Add builderUrl to the utils instead of accessing env var in render time
  • Loading branch information
juanmahidalgo authored Jan 24, 2022
1 parent baa388d commit eeae6b0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion webapp/src/components/AssetPage/Actions/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ import { AssetType } from '../../../modules/asset/types'
import { VendorFactory } from '../../../modules/vendor'
import { Props } from './Actions.types'
import styles from './Actions.module.css'
import { builderUrl } from '../../../lib/environment'

const Actions = (props: Props) => {
const { wallet, nft, order, bids } = props
const { vendor, contractAddress, tokenId } = nft
const { vendor, contractAddress, tokenId, data } = nft

const [showLeavingSiteModal, setShowLeavingSiteModal] = useState(false)

const { bidService, orderService } = VendorFactory.build(nft.vendor)
const isBiddable = bidService !== undefined

const isOwner = isOwnedBy(nft, wallet)
const isENSName = !!data.ens

const canSell = orderService.canSell()
const canBid =
Expand Down Expand Up @@ -105,6 +107,11 @@ const Actions = (props: Props) => {
{t('asset_page.actions.transfer')}
</Button>
) : null}
{isOwner && isENSName && (
<Button as="a" href={`${builderUrl}/names`} fluid>
{t('asset_page.actions.manage')}
</Button>
)}

<Modal
className="LeavingSiteModal"
Expand Down
1 change: 1 addition & 0 deletions webapp/src/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export const environment = process.env.REACT_APP_ENVIRONMENT
export const isDevelopment =
window.location.hostname === 'localhost' || environment === 'development'
export const peerUrl = process.env.REACT_APP_PEER_URL!
export const builderUrl = process.env.REACT_APP_BUILDER_URL
1 change: 1 addition & 0 deletions webapp/src/modules/translation/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"asset_page": {
"actions": {
"cancel_sale": "Remove listing",
"manage": "Manage",
"update": "Update price",
"buy": "Buy",
"mint": "Mint",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/modules/translation/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"asset_page": {
"actions": {
"cancel_sale": "Borrar publicación",
"manage": "Gestionar",
"update": "Actualizar precio",
"buy": "Comprar",
"mint": "Comprar",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/modules/translation/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"asset_page": {
"actions": {
"cancel_sale": "删除列表",
"manage": "管理",
"update": "更新价格",
"buy": "购买",
"mint": "购买",
Expand Down

0 comments on commit eeae6b0

Please sign in to comment.