From 3dee4744f9d0643026ebcf100fc839e2a4a1aa32 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 29 Sep 2016 16:31:55 +0200 Subject: contract playground --- pages/confirm-contract.tsx | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'pages') 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) -- cgit v1.2.3