diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-09-29 16:31:55 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-09-29 16:31:55 +0200 |
commit | 3dee4744f9d0643026ebcf100fc839e2a4a1aa32 (patch) | |
tree | f012fd6ee03a07137ce391d29132397a7db3951b /pages | |
parent | 8b660d688235bb27da95a33054478b66b0c88068 (diff) | |
download | wallet-core-3dee4744f9d0643026ebcf100fc839e2a4a1aa32.tar.xz |
contract playground
Diffstat (limited to 'pages')
-rw-r--r-- | pages/confirm-contract.tsx | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/pages/confirm-contract.tsx b/pages/confirm-contract.tsx index 19b049eb5..52e4cb79a 100644 --- a/pages/confirm-contract.tsx +++ b/pages/confirm-contract.tsx @@ -27,15 +27,9 @@ import MithrilComponent = _mithril.MithrilComponent; import {substituteFulfillmentUrl} from "../lib/wallet/helpers"; import m from "mithril"; import {Contract, AmountJson} from "../lib/wallet/types"; +import {renderContract, prettyAmount} from "../lib/wallet/renderHtml"; "use strict"; - -function prettyAmount(amount: AmountJson) { - let v = amount.value + amount.fraction / 1e6; - return `${v.toFixed(2)} ${amount.currency}`; -} - - const Details = { controller() { return {collapsed: m.prop(true)}; @@ -77,17 +71,7 @@ export function main() { var Contract = { view(ctrl: any) { return [ - m("p", - i18n.parts`${m("strong", contract.merchant.name)} - wants to enter a contract over ${m("strong", - prettyAmount(contract.amount))} - with you.`), - m("p", - i18n`You are about to purchase:`), - m('ul', - _.map(contract.products, - (p: any) => m("li", - `${p.description}: ${prettyAmount(p.price)}`))), + renderContract(contract), m("button.accept", {onclick: doPayment, disabled: payDisabled}, i18n`Confirm Payment`), (error ? m("p.errorbox", error) : []), m(Details, contract) |