hide release button before release time
This commit is contained in:
parent
2db0c7171d
commit
00d88ba20a
|
@ -38,7 +38,7 @@ class SimpleDialog extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { classes, onClose, selectedValue, ...other } = this.props;
|
const { classes, onClose, selectedValue, canBeReleased, ...other } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog classes={{paper: classes.paper,}} onClose={this.handleClose} fullWidth paperFullWidth style={{alignItems: 'flex-end'}} aria-labelledby="simple-dialog-title" {...other}>
|
<Dialog classes={{paper: classes.paper,}} onClose={this.handleClose} fullWidth paperFullWidth style={{alignItems: 'flex-end'}} aria-labelledby="simple-dialog-title" {...other}>
|
||||||
|
@ -49,12 +49,12 @@ class SimpleDialog extends React.Component {
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="Edit Contact Code" />
|
<ListItemText primary="Edit Contact Code" />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem button onClick={() => this.handleListItemClick('release')}>
|
{canBeReleased && <ListItem button onClick={() => this.handleListItemClick('release')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<DeleteOutline />
|
<DeleteOutline />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="Release Name" />
|
<ListItemText primary="Release Name" />
|
||||||
</ListItem>
|
</ListItem>}
|
||||||
</List>
|
</List>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
|
|
@ -66,6 +66,7 @@ const backButton = {
|
||||||
|
|
||||||
const validTimestamp = timestamp => Number(timestamp) > 99999999;
|
const validTimestamp = timestamp => Number(timestamp) > 99999999;
|
||||||
const generatePrettyDate = timestamp => new Date(timestamp * 1000).toDateString();
|
const generatePrettyDate = timestamp => new Date(timestamp * 1000).toDateString();
|
||||||
|
const pastReleaseDate = timestamp => new Date > new Date(timestamp * 1000);
|
||||||
|
|
||||||
const WrappedDisplayBox = ({ displayType, pubKey, getStatusContactCode }) => (
|
const WrappedDisplayBox = ({ displayType, pubKey, getStatusContactCode }) => (
|
||||||
<div onClick={getStatusContactCode}>
|
<div onClick={getStatusContactCode}>
|
||||||
|
@ -135,6 +136,7 @@ class RenderAddresses extends PureComponent {
|
||||||
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 onClickEdit = () => { validAddress(address) ? this.setState({ editMenu: true }) : this.setState({ editAction: 'edit' }) }
|
||||||
const isOwner = defaultAccount === ownerAddress;
|
const isOwner = defaultAccount === ownerAddress;
|
||||||
|
const canBeReleased = validTimestamp(releaseTime) && pastReleaseDate(releaseTime);
|
||||||
const closeReleaseAlert = value => {
|
const closeReleaseAlert = value => {
|
||||||
if (!isNil(value)) {
|
if (!isNil(value)) {
|
||||||
this.setState({ submitted: true })
|
this.setState({ submitted: true })
|
||||||
|
@ -164,7 +166,7 @@ class RenderAddresses extends PureComponent {
|
||||||
<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={{ margin: 'auto', display: 'block' }} onClick={onClickEdit}/>}
|
{isOwner && !editAction && <MobileButton text="Edit" style={{ margin: 'auto', display: 'block' }} onClick={onClickEdit}/>}
|
||||||
<EditOptions open={editMenu} onClose={onClose} />
|
<EditOptions open={editMenu} onClose={onClose} canBeReleased={canBeReleased} />
|
||||||
<ReleaseDomainAlert open={editAction === 'release' && !submitted} handleClose={closeReleaseAlert} />
|
<ReleaseDomainAlert open={editAction === 'release' && !submitted} handleClose={closeReleaseAlert} />
|
||||||
</Hidden>
|
</Hidden>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|
Loading…
Reference in New Issue