diff options
Diffstat (limited to 'pages/confirm-contract.tsx')
-rw-r--r-- | pages/confirm-contract.tsx | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/pages/confirm-contract.tsx b/pages/confirm-contract.tsx index ff6ffba64..0c7419c6c 100644 --- a/pages/confirm-contract.tsx +++ b/pages/confirm-contract.tsx @@ -14,12 +14,21 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ -/// <reference path="../lib/decl/handlebars/handlebars.d.ts" /> -"use strict"; +/** + * Page shown to the user to confirm entering + * a contract. + * + * @author Florian Dold + */ + +/// <reference path="../lib/decl/handlebars/handlebars.d.ts" /> +import MithrilComponent = _mithril.MithrilComponent; import {substituteFulfillmentUrl} from "../lib/wallet/helpers"; +import m from "mithril"; +import {Contract} from "../lib/wallet/types"; +"use strict"; -declare var m: any; function prettyAmount(amount) { let v = amount.value + amount.fraction / 1e6; @@ -27,6 +36,35 @@ function prettyAmount(amount) { } +const Details = { + controller() { + return {collapsed: m.prop(true)}; + }, + view(ctrl, contract: Contract) { + if (ctrl.collapsed()) { + return m("div", [ + m("button.linky", { + onclick: () => { + ctrl.collapsed(false); + } + }, "show more details") + ]); + } else { + return m("div", [ + m("button.linky", { + onclick: () => { + ctrl.collapsed(true); + } + }, "show less details"), + m("div", [ + "Accepted exchanges:", + m("ul", contract.exchanges.map(e => m("li", `${e.url}: ${e.master_pub}`))) + ]) + ]); + } + } +}; + export function main() { let url = URI(document.location.href); let query: any = URI.parseQuery(url.query()); @@ -51,6 +89,7 @@ export function main() { `${p.description}: ${prettyAmount(p.price)}`))), m("button.confirm-pay", {onclick: doPayment}, i18n`Confirm Payment`), m("p", error ? error : []), + m(Details, contract) ]; } }; @@ -79,4 +118,4 @@ export function main() { offer); }); } -}
\ No newline at end of file +} |