From 03782f8aea043042aaa069de0b91cdb80fbb4679 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 15 Oct 2017 18:30:02 +0200 Subject: derive history from db instead of storing it --- src/webex/pages/popup.tsx | 23 ++++++++++------------- src/webex/pages/refund.tsx | 6 ++++-- src/webex/pages/tree.tsx | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src/webex/pages') 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) { ); 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 ( @@ -369,7 +367,7 @@ function formatHistoryItem(historyItem: HistoryRecord) { const link = chrome.extension.getURL("view-contract.html"); return ( - Merchant {abbrev(d.merchantName, 15)} offered contract {abbrev(d.contractHash)}; + Merchant {abbrev(d.merchantName, 15)} offered contract {abbrev(d.contractTermsHash)}; ); } @@ -395,6 +393,14 @@ function formatHistoryItem(historyItem: HistoryRecord) { ); } + case "refund": { + const merchantElem = {abbrev(d.merchantName, 15)}; + return ( + + Merchant {merchantElem} gave a refund over {renderAmount(d.refundAmount)}. + + ); + } default: return (

{i18n.str`Unknown event (${historyItem.type})`}

); } @@ -447,17 +453,8 @@ class WalletHistory extends React.Component { return ; } - 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 = (
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 (
-

Refund fully received: (refund fees: )

-

Refund incoming:

+ {hasPending ?

Refund pending:

: null} +

Refund received: (refund fees: )

); }; 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 {
  • Created: {(new Date(r.created * 1000).toString())}
  • Current: {r.current_amount ? renderAmount(r.current_amount!) : "null"}
  • Requested: {renderAmount(r.requested_amount)}
  • -
  • Confirmed: {r.confirmed}
  • +
  • Confirmed: {r.timestamp_confirmed}
  • ); -- cgit v1.2.3