fix display of contract terms rendering when already paid

This commit is contained in:
Florian Dold 2017-06-02 02:51:17 +02:00
parent a6035dd4c7
commit a425f289a4
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
8 changed files with 24 additions and 11 deletions

View File

@ -42,13 +42,13 @@ msgstr ""
msgid "Exchanges in the wallet:" msgid "Exchanges in the wallet:"
msgstr "" msgstr ""
#: src/webex/pages/confirm-contract.tsx:141 #: src/webex/pages/confirm-contract.tsx:142
#, c-format #, c-format
msgid "You have insufficient funds of the requested currency in your wallet." msgid "You have insufficient funds of the requested currency in your wallet."
msgstr "" msgstr ""
#. tslint:disable-next-line:max-line-length #. tslint:disable-next-line:max-line-length
#: src/webex/pages/confirm-contract.tsx:143 #: src/webex/pages/confirm-contract.tsx:144
#, c-format #, c-format
msgid "" msgid ""
"You do not have any funds from an exchange that is accepted by this " "You do not have any funds from an exchange that is accepted by this "

View File

@ -42,13 +42,13 @@ msgstr ""
msgid "Exchanges in the wallet:" msgid "Exchanges in the wallet:"
msgstr "" msgstr ""
#: src/webex/pages/confirm-contract.tsx:141 #: src/webex/pages/confirm-contract.tsx:142
#, c-format #, c-format
msgid "You have insufficient funds of the requested currency in your wallet." msgid "You have insufficient funds of the requested currency in your wallet."
msgstr "" msgstr ""
#. tslint:disable-next-line:max-line-length #. tslint:disable-next-line:max-line-length
#: src/webex/pages/confirm-contract.tsx:143 #: src/webex/pages/confirm-contract.tsx:144
#, c-format #, c-format
msgid "" msgid ""
"You do not have any funds from an exchange that is accepted by this " "You do not have any funds from an exchange that is accepted by this "

View File

@ -42,13 +42,13 @@ msgstr ""
msgid "Exchanges in the wallet:" msgid "Exchanges in the wallet:"
msgstr "" msgstr ""
#: src/webex/pages/confirm-contract.tsx:141 #: src/webex/pages/confirm-contract.tsx:142
#, c-format #, c-format
msgid "You have insufficient funds of the requested currency in your wallet." msgid "You have insufficient funds of the requested currency in your wallet."
msgstr "" msgstr ""
#. tslint:disable-next-line:max-line-length #. tslint:disable-next-line:max-line-length
#: src/webex/pages/confirm-contract.tsx:143 #: src/webex/pages/confirm-contract.tsx:144
#, c-format #, c-format
msgid "" msgid ""
"You do not have any funds from an exchange that is accepted by this " "You do not have any funds from an exchange that is accepted by this "

View File

@ -42,13 +42,13 @@ msgstr ""
msgid "Exchanges in the wallet:" msgid "Exchanges in the wallet:"
msgstr "" msgstr ""
#: src/webex/pages/confirm-contract.tsx:141 #: src/webex/pages/confirm-contract.tsx:142
#, c-format #, c-format
msgid "You have insufficient funds of the requested currency in your wallet." msgid "You have insufficient funds of the requested currency in your wallet."
msgstr "" msgstr ""
#. tslint:disable-next-line:max-line-length #. tslint:disable-next-line:max-line-length
#: src/webex/pages/confirm-contract.tsx:143 #: src/webex/pages/confirm-contract.tsx:144
#, c-format #, c-format
msgid "" msgid ""
"You do not have any funds from an exchange that is accepted by this " "You do not have any funds from an exchange that is accepted by this "

View File

@ -42,13 +42,13 @@ msgstr ""
msgid "Exchanges in the wallet:" msgid "Exchanges in the wallet:"
msgstr "" msgstr ""
#: src/webex/pages/confirm-contract.tsx:141 #: src/webex/pages/confirm-contract.tsx:142
#, c-format #, c-format
msgid "You have insufficient funds of the requested currency in your wallet." msgid "You have insufficient funds of the requested currency in your wallet."
msgstr "" msgstr ""
#. tslint:disable-next-line:max-line-length #. tslint:disable-next-line:max-line-length
#: src/webex/pages/confirm-contract.tsx:143 #: src/webex/pages/confirm-contract.tsx:144
#, c-format #, c-format
msgid "" msgid ""
"You do not have any funds from an exchange that is accepted by this " "You do not have any funds from an exchange that is accepted by this "

View File

@ -947,7 +947,7 @@ export class Wallet {
// First check if we already payed for it. // First check if we already payed for it.
const transaction = await this.q().get(Stores.transactions, proposal.contractTermsHash); const transaction = await this.q().get(Stores.transactions, proposal.contractTermsHash);
if (transaction) { if (transaction) {
return "insufficient-balance"; return "paid";
} }
// If not already payed, check if we could pay for it. // If not already payed, check if we could pay for it.

View File

@ -56,6 +56,15 @@
font-weight: bold; font-weight: bold;
background: #FF8A8A; background: #FF8A8A;
} }
.okaybox {
border: 1px solid;
display: inline-block;
margin: 1em;
padding: 1em;
font-weight: bold;
background: #00FA9A;
}
</style> </style>
</head> </head>

View File

@ -105,6 +105,7 @@ interface ContractPromptState {
proposal: ProposalRecord|null; proposal: ProposalRecord|null;
error: string|null; error: string|null;
payDisabled: boolean; payDisabled: boolean;
alreadyPaid: boolean;
exchanges: null|ExchangeRecord[]; exchanges: null|ExchangeRecord[];
} }
@ -153,6 +154,8 @@ class ContractPrompt extends React.Component<ContractPromptProps, ContractPrompt
this.setState({error: msgInsufficient}); this.setState({error: msgInsufficient});
} }
this.setState({payDisabled: true}); this.setState({payDisabled: true});
} else if (payStatus === "paid") {
this.setState({alreadyPaid: true, payDisabled: false, error: null});
} else { } else {
this.setState({payDisabled: false, error: null}); this.setState({payDisabled: false, error: null});
} }
@ -193,6 +196,7 @@ class ContractPrompt extends React.Component<ContractPromptProps, ContractPrompt
Confirm payment Confirm payment
</button> </button>
<div> <div>
{(this.state.alreadyPaid ? <p className="okaybox">You already paid for this, clicking "Confirm payment" will not cost money again.</p> : <p />)}
{(this.state.error ? <p className="errorbox">{this.state.error}</p> : <p />)} {(this.state.error ? <p className="errorbox">{this.state.error}</p> : <p />)}
</div> </div>
<Details exchanges={this.state.exchanges} contractTerms={c} collapsed={!this.state.error}/> <Details exchanges={this.state.exchanges} contractTerms={c} collapsed={!this.state.error}/>