aboutsummaryrefslogtreecommitdiff
path: root/src/webex/pages
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-10-15 18:30:02 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-10-15 18:30:02 +0200
commit03782f8aea043042aaa069de0b91cdb80fbb4679 (patch)
treecc8890eb060fe15cefa107c9261fc7e558d564b1 /src/webex/pages
parent23633cf1be5ce8f1bc4d7823d1d561149cb6c8a8 (diff)
downloadwallet-core-03782f8aea043042aaa069de0b91cdb80fbb4679.tar.xz
derive history from db instead of storing it
Diffstat (limited to 'src/webex/pages')
-rw-r--r--src/webex/pages/popup.tsx23
-rw-r--r--src/webex/pages/refund.tsx6
-rw-r--r--src/webex/pages/tree.tsx2
3 files changed, 15 insertions, 16 deletions
diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx
index 7d12d365e..4e4e9687c 100644
--- a/src/webex/pages/popup.tsx
+++ b/src/webex/pages/popup.tsx
@@ -29,7 +29,6 @@ import * as i18n from "../../i18n";
import {
AmountJson,
Amounts,
- HistoryLevel,
HistoryRecord,
WalletBalance,
WalletBalanceEntry,
@@ -354,8 +353,7 @@ function formatHistoryItem(historyItem: HistoryRecord) {
</i18n.Translate>
);
case "confirm-reserve": {
- // FIXME: eventually remove compat fix
- const exchange = d.exchangeBaseUrl ? (new URI(d.exchangeBaseUrl)).host() : "??";
+ const exchange = (new URI(d.exchangeBaseUrl)).host();
const pub = abbrev(d.reservePub);
return (
<i18n.Translate wrap="p">
@@ -369,7 +367,7 @@ function formatHistoryItem(historyItem: HistoryRecord) {
const link = chrome.extension.getURL("view-contract.html");
return (
<i18n.Translate wrap="p">
- Merchant <em>{abbrev(d.merchantName, 15)}</em> offered contract <a href={link}>{abbrev(d.contractHash)}</a>;
+ Merchant <em>{abbrev(d.merchantName, 15)}</em> offered contract <a href={link}>{abbrev(d.contractTermsHash)}</a>;
</i18n.Translate>
);
}
@@ -395,6 +393,14 @@ function formatHistoryItem(historyItem: HistoryRecord) {
</i18n.Translate>
);
}
+ case "refund": {
+ const merchantElem = <em>{abbrev(d.merchantName, 15)}</em>;
+ return (
+ <i18n.Translate wrap="p">
+ Merchant <span>{merchantElem}</span> gave a refund over <span>{renderAmount(d.refundAmount)}</span>.
+ </i18n.Translate>
+ );
+ }
default:
return (<p>{i18n.str`Unknown event (${historyItem.type})`}</p>);
}
@@ -447,17 +453,8 @@ class WalletHistory extends React.Component<any, any> {
return <span />;
}
- const subjectMemo: {[s: string]: boolean} = {};
const listing: any[] = [];
for (const record of history.reverse()) {
- if (record.subjectId && subjectMemo[record.subjectId]) {
- continue;
- }
- if (record.level !== undefined && record.level < HistoryLevel.User) {
- continue;
- }
- subjectMemo[record.subjectId as string] = true;
-
const item = (
<div className="historyItem">
<div className="historyDate">
diff --git a/src/webex/pages/refund.tsx b/src/webex/pages/refund.tsx
index d2c21c2f4..73bed30ee 100644
--- a/src/webex/pages/refund.tsx
+++ b/src/webex/pages/refund.tsx
@@ -63,10 +63,12 @@ const RefundDetail = ({purchase, fullRefundFees}: {purchase: types.PurchaseRecor
amountDone = types.Amounts.add(amountDone, purchase.refundsDone[k].refund_amount).amount;
}
+ const hasPending = amountPending.fraction !== 0 || amountPending.value !== 0;
+
return (
<div>
- <p>Refund fully received: <AmountDisplay amount={amountDone} /> (refund fees: <AmountDisplay amount={fullRefundFees} />)</p>
- <p>Refund incoming: <AmountDisplay amount={amountPending} /></p>
+ {hasPending ? <p>Refund pending: <AmountDisplay amount={amountPending} /></p> : null}
+ <p>Refund received: <AmountDisplay amount={amountDone} /> (refund fees: <AmountDisplay amount={fullRefundFees} />)</p>
</div>
);
};
diff --git a/src/webex/pages/tree.tsx b/src/webex/pages/tree.tsx
index 2d542f01d..072150312 100644
--- a/src/webex/pages/tree.tsx
+++ b/src/webex/pages/tree.tsx
@@ -61,7 +61,7 @@ class ReserveView extends React.Component<ReserveViewProps, {}> {
<li>Created: {(new Date(r.created * 1000).toString())}</li>
<li>Current: {r.current_amount ? renderAmount(r.current_amount!) : "null"}</li>
<li>Requested: {renderAmount(r.requested_amount)}</li>
- <li>Confirmed: {r.confirmed}</li>
+ <li>Confirmed: {r.timestamp_confirmed}</li>
</ul>
</div>
);