From 00d88ba20ad03cf869da749c7fc41e711cfc728e Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Tue, 2 Oct 2018 15:28:48 -0400 Subject: [PATCH] hide release button before release time --- app/components/ens/EditOptions.js | 6 +++--- app/components/ens/nameLookup.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/components/ens/EditOptions.js b/app/components/ens/EditOptions.js index e5cddd6..1d04760 100644 --- a/app/components/ens/EditOptions.js +++ b/app/components/ens/EditOptions.js @@ -38,7 +38,7 @@ class SimpleDialog extends React.Component { }; render() { - const { classes, onClose, selectedValue, ...other } = this.props; + const { classes, onClose, selectedValue, canBeReleased, ...other } = this.props; return ( @@ -49,12 +49,12 @@ class SimpleDialog extends React.Component { - this.handleListItemClick('release')}> + {canBeReleased && this.handleListItemClick('release')}> - + } ); diff --git a/app/components/ens/nameLookup.js b/app/components/ens/nameLookup.js index c2172a5..7b4abff 100644 --- a/app/components/ens/nameLookup.js +++ b/app/components/ens/nameLookup.js @@ -66,6 +66,7 @@ const backButton = { const validTimestamp = timestamp => Number(timestamp) > 99999999; const generatePrettyDate = timestamp => new Date(timestamp * 1000).toDateString(); +const pastReleaseDate = timestamp => new Date > new Date(timestamp * 1000); const WrappedDisplayBox = ({ displayType, pubKey, getStatusContactCode }) => (
@@ -135,6 +136,7 @@ class RenderAddresses extends PureComponent { 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 canBeReleased = validTimestamp(releaseTime) && pastReleaseDate(releaseTime); const closeReleaseAlert = value => { if (!isNil(value)) { this.setState({ submitted: true }) @@ -164,7 +166,7 @@ class RenderAddresses extends PureComponent { {submitted ? : { this.setState({ submitted: true}) }}/>} {isOwner && !editAction && } - +