aboutsummaryrefslogtreecommitdiff
path: root/extension/popup/popup.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'extension/popup/popup.tsx')
-rw-r--r--extension/popup/popup.tsx28
1 files changed, 27 insertions, 1 deletions
diff --git a/extension/popup/popup.tsx b/extension/popup/popup.tsx
index 258292df9..a9579f18c 100644
--- a/extension/popup/popup.tsx
+++ b/extension/popup/popup.tsx
@@ -20,6 +20,8 @@
"use strict";
+import {substituteFulfillmentUrl} from "../lib/web-common";
+
declare var m: any;
declare var i18n: any;
@@ -106,11 +108,22 @@ function formatAmount(amount) {
return `${v.toFixed(2)} ${amount.currency}`;
}
+
function abbrevKey(s: string) {
return m("span.abbrev", {title: s}, (s.slice(0, 5) + ".."))
}
+function retryPayment(url, contractHash) {
+ return function() {
+ chrome.tabs.create({
+ "url": substituteFulfillmentUrl(url,
+ {H_contract: contractHash})
+ });
+ }
+}
+
+
function formatHistoryItem(historyItem) {
const d = historyItem.detail;
const t = historyItem.timestamp;
@@ -124,10 +137,14 @@ function formatHistoryItem(historyItem) {
return m("p",
i18n`Withdraw at ${formatTimestamp(t)}`);
case "pay":
+ let url = substituteFulfillmentUrl(d.fulfillmentUrl,
+ {H_contract: d.contractHash});
return m("p",
[
i18n`Payment for ${formatAmount(d.amount)} to merchant ${d.merchantName}. `,
- m("a[href=javascript:;]", "Retry")
+ m(`a`,
+ {href: url, onclick: openTab(url)},
+ "Retry")
]);
default:
return m("p", i18n`Unknown event (${historyItem.type})`);
@@ -204,3 +221,12 @@ function openExtensionPage(page) {
}
}
+
+function openTab(page) {
+ return function() {
+ chrome.tabs.create({
+ "url": page
+ });
+ }
+}
+