mirror of
https://github.com/status-im/ens-usernames.git
synced 2025-03-03 11:30:43 +00:00
direct edit when no valid address registered
This commit is contained in:
parent
49e8d771e9
commit
5d70fb2636
@ -91,7 +91,9 @@ const MobileAddressDisplay = ({ domainName, address, statusAccount, expirationTi
|
|||||||
: 'Name is unavailable'}
|
: 'Name is unavailable'}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography type='body2' style={{ textAlign: 'center', margin: 10 }}>
|
<Typography type='body2' style={{ textAlign: 'center', margin: 10 }}>
|
||||||
{edit ? 'The contact code connects the domain with a unique Status account' : 'registered to the addresses below'}
|
{edit
|
||||||
|
? 'The contact code connects the domain with a unique Status account'
|
||||||
|
: validAddress(address) ? 'registered to the addresses below' : 'Click \'Edit\' to add a valid address and contact code'}
|
||||||
</Typography>
|
</Typography>
|
||||||
{edit && <RegisterSubDomain
|
{edit && <RegisterSubDomain
|
||||||
subDomain={domainName}
|
subDomain={domainName}
|
||||||
@ -115,6 +117,7 @@ class RenderAddresses extends PureComponent {
|
|||||||
const isCopied = address => address == copied;
|
const isCopied = address => address == copied;
|
||||||
const renderCopied = address => isCopied(address) && <span style={{ color: theme.positive }}><IconCheck/>Copied!</span>;
|
const renderCopied = address => isCopied(address) && <span style={{ color: theme.positive }}><IconCheck/>Copied!</span>;
|
||||||
const onClose = value => { this.setState({ editAction: value, editMenu: false }) }
|
const onClose = value => { this.setState({ editAction: value, editMenu: false }) }
|
||||||
|
const onClickEdit = () => { validAddress(address) ? this.setState({ editMenu: true }) : this.setState({ editAction: 'edit' }) }
|
||||||
const isOwner = defaultAccount === ownerAddress;
|
const isOwner = defaultAccount === ownerAddress;
|
||||||
const closeReleaseAlert = value => {
|
const closeReleaseAlert = value => {
|
||||||
if (!isNil(value)) {
|
if (!isNil(value)) {
|
||||||
@ -145,7 +148,7 @@ class RenderAddresses extends PureComponent {
|
|||||||
</Hidden>
|
</Hidden>
|
||||||
<Hidden mdUp>
|
<Hidden mdUp>
|
||||||
{submitted ? <TransactionComplete type={editAction} setStatus={setStatus} /> : <MobileAddressDisplay {...this.props} isOwner={isOwner} edit={editAction === 'edit'} onSubmit={() => { this.setState({ submitted: true}) }}/>}
|
{submitted ? <TransactionComplete type={editAction} setStatus={setStatus} /> : <MobileAddressDisplay {...this.props} isOwner={isOwner} edit={editAction === 'edit'} onSubmit={() => { this.setState({ submitted: true}) }}/>}
|
||||||
{isOwner && !editAction && <MobileButton text="Edit" style={{ marginLeft: '35%' }} onClick={() => { this.setState({ editMenu: true }) } }/>}
|
{isOwner && !editAction && <MobileButton text="Edit" style={{ marginLeft: '35%' }} onClick={onClickEdit}/>}
|
||||||
<EditOptions open={editMenu} onClose={onClose} />
|
<EditOptions open={editMenu} onClose={onClose} />
|
||||||
<ReleaseDomainAlert open={editAction === 'release' && !submitted} handleClose={closeReleaseAlert} />
|
<ReleaseDomainAlert open={editAction === 'release' && !submitted} handleClose={closeReleaseAlert} />
|
||||||
</Hidden>
|
</Hidden>
|
||||||
@ -253,7 +256,7 @@ const ConnectedRegister = connect(mapStateToProps, mapDispatchToProps)(Register)
|
|||||||
|
|
||||||
const DisplayAddress = connect(mapStateToProps)((props) => (
|
const DisplayAddress = connect(mapStateToProps)((props) => (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{validAddress(props.address) ?
|
{validAddress(props.address) || props.defaultAccount === props.ownerAddress ?
|
||||||
<RenderAddresses {...props} />
|
<RenderAddresses {...props} />
|
||||||
:
|
:
|
||||||
<Hidden mdUp>
|
<Hidden mdUp>
|
||||||
@ -311,6 +314,7 @@ const InnerForm = ({
|
|||||||
isSubmitting,
|
isSubmitting,
|
||||||
status,
|
status,
|
||||||
setStatus,
|
setStatus,
|
||||||
|
defaultAccount
|
||||||
}) => (
|
}) => (
|
||||||
<div>
|
<div>
|
||||||
<Hidden mdDown>
|
<Hidden mdDown>
|
||||||
@ -321,7 +325,7 @@ const InnerForm = ({
|
|||||||
</Hidden>
|
</Hidden>
|
||||||
{!status
|
{!status
|
||||||
? <LookupForm {...{ handleSubmit, values, handleChange }} />
|
? <LookupForm {...{ handleSubmit, values, handleChange }} />
|
||||||
: validAddress(status.address) ?
|
: validAddress(status.address) || defaultAccount === status.ownerAddress ?
|
||||||
<DisplayAddress
|
<DisplayAddress
|
||||||
domainName={values.domainName}
|
domainName={values.domainName}
|
||||||
address={status.address}
|
address={status.address}
|
||||||
@ -365,4 +369,4 @@ const NameLookup = withFormik({
|
|||||||
}
|
}
|
||||||
})(InnerForm)
|
})(InnerForm)
|
||||||
|
|
||||||
export default NameLookup;
|
export default connect(mapStateToProps)(NameLookup);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user