Disable 'open dispute' button until fiat exchange midtime

This commit is contained in:
Reckless_Satoshi 2022-07-11 09:26:29 -07:00
parent 40504a9e95
commit 94ecfe3929
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 19 additions and 2 deletions

View File

@ -1060,12 +1060,26 @@ handleRatingRobosatsChange=(e)=>{
)
}
disputeCountdownRenderer = ({ hours, minutes}) => {
return (<span>{hours}h {zeroPad(minutes)}m </span>);
};
showOpenDisputeButton(){
const { t } = this.props;
let now = Date.now();
var expires_at = new Date(this.props.data.expires_at);
// open dispute button enables 12h before expiry
expires_at.setHours(expires_at.getHours() - 12);
return(
<Tooltip
disableHoverListener={now>expires_at}
disableTouchListener={now>expires_at}
enterTouchDelay={0}
title={<Trans i18nKey="open_dispute">To open a dispute you need to wait <Countdown date={expires_at} renderer={this.disputeCountdownRenderer}/></Trans>}>
<Grid item xs={12} align="center">
<Button color="inherit" onClick={this.handleClickOpenConfirmDispute}>{t("Open Dispute")}</Button>
<Button disabled={now<expires_at} color="inherit" onClick={this.handleClickOpenConfirmDispute}>{t("Open Dispute")}</Button>
</Grid>
</Tooltip>
)
}
@ -1318,7 +1332,7 @@ handleRatingRobosatsChange=(e)=>{
<span>{zeroPad(minutes)}m {zeroPad(seconds)}s </span>
);
}
};
};
failureReason=()=>{
const { t } = this.props;

View File

@ -404,6 +404,7 @@
"Your TXID":"Your TXID",
"Lightning":"Lightning",
"Onchain":"Onchain",
"open_dispute":"To open a dispute you need to wait <1><1/>",
"INFO DIALOG - InfoDiagog.js":"App information and clarifications and terms of use",

View File

@ -405,6 +405,8 @@
"Your TXID":"Tu TXID",
"Lightning":"Lightning",
"Onchain":"Onchain",
"open_dispute":"Para abrir una disputa debes esperar <1><1/>",
"INFO DIALOG - InfoDiagog.js": "App information and clarifications and terms of use",
"Close": "Cerrar",