aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-03-02 02:16:18 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-03-02 02:16:18 +0100
commit8714240c909d9c2f2deeb6ae99f219295f67c708 (patch)
tree13833dee5b8eb30dda4de5f05af0a9a02291780f /pages
parent344d3bda09c2e03035598c3ad1c974dd0d9977e2 (diff)
show accepted exchanges
Diffstat (limited to 'pages')
-rw-r--r--pages/confirm-contract.tsx38
1 files changed, 35 insertions, 3 deletions
diff --git a/pages/confirm-contract.tsx b/pages/confirm-contract.tsx
index 9ce1b0a5a..0c7419c6c 100644
--- a/pages/confirm-contract.tsx
+++ b/pages/confirm-contract.tsx
@@ -21,12 +21,14 @@
* @author Florian Dold
*/
-/// <reference path="../lib/decl/handlebars/handlebars.d.ts" />
-"use strict";
+/// <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;
@@ -34,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());
@@ -58,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)
];
}
};