From 7fb527b0009a29605c32e663ab9e6a812a8cc5a8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 5 Oct 2016 17:04:57 +0200 Subject: refactor confirm-contract rendering --- lib/wallet/renderHtml.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lib/wallet') diff --git a/lib/wallet/renderHtml.ts b/lib/wallet/renderHtml.ts index 6d9823d71..022bce113 100644 --- a/lib/wallet/renderHtml.ts +++ b/lib/wallet/renderHtml.ts @@ -24,26 +24,26 @@ import {AmountJson, Contract} from "./types"; +let h = preact.h; + export function prettyAmount(amount: AmountJson) { let v = amount.value + amount.fraction / 1e6; return `${v.toFixed(2)} ${amount.currency}`; } -export function renderContract(contract: Contract): any { +export function renderContract(contract: Contract): JSX.Element { let merchantName = m("strong", contract.merchant.name); let amount = m("strong", prettyAmount(contract.amount)); - return m("div", {}, [ - m("p", - i18n.parts`${merchantName} + return h("div", {}, + h("p", {}, + i18n.parts`${merchantName} wants to enter a contract over ${amount} with you.`), - m("p", - i18n`You are about to purchase:`), - m('ul', - - contract.products.map( - (p: any) => m("li", - `${p.description}: ${prettyAmount(p.price)}`))) - ]); + h("p", {}, + i18n`You are about to purchase:`), + h('ul', {}, + ...contract.products.map( + (p: any) => h("li", {}, + `${p.description}: ${prettyAmount(p.price)}`)))); } \ No newline at end of file -- cgit v1.2.3