diff --git a/lib/wallet/wallet.ts b/lib/wallet/wallet.ts index 45d083570..fbd80a812 100644 --- a/lib/wallet/wallet.ts +++ b/lib/wallet/wallet.ts @@ -535,7 +535,7 @@ export class Wallet { merchantName: offer.contract.merchant.name, amount: offer.contract.amount, contractHash: offer.H_contract, - fulfillmentUrl: offer.contract.fulfillment_url + fulfillmentUrl: offer.contract.fulfillment_url, } }; @@ -661,6 +661,7 @@ export class Wallet { subjectId: `reserve-progress-${reserveRecord.reserve_pub}`, timestamp: (new Date).getTime(), detail: { + exchangeBaseUrl: reserveRecord.exchange_base_url, reservePub: reserveRecord.reserve_pub, requestedAmount: reserveRecord.requested_amount, currentAmount: reserveRecord.current_amount, @@ -759,6 +760,7 @@ export class Wallet { timestamp: now, subjectId: `reserve-progress-${reserve.reserve_pub}`, detail: { + exchangeBaseUrl: reserve.exchange_base_url, reservePub: req.reservePub, requestedAmount: reserve.requested_amount, } diff --git a/popup/popup.html b/popup/popup.html index 4c05c6f56..39678c80f 100644 --- a/popup/popup.html +++ b/popup/popup.html @@ -8,6 +8,7 @@ + diff --git a/popup/popup.tsx b/popup/popup.tsx index fd24f83a4..c4727d598 100644 --- a/popup/popup.tsx +++ b/popup/popup.tsx @@ -102,11 +102,13 @@ export function main() { let el = (
+
+
); @@ -175,7 +177,7 @@ function ExtensionLink(props: any) { e.preventDefault(); }; return ( - + {props.children} ) } @@ -205,13 +207,22 @@ class WalletBalance extends preact.Component { }); } + renderEmpty() : JSX.Element { + let helpLink = ( + + help + + ); + return
You have no balance to show. Need some {helpLink} getting started?
; + } + render(): JSX.Element { let wallet = this.myWallet; if (this.gotError) { return i18n`Error: could not retrieve balance information.`; } if (!wallet) { - return
+ return this.renderEmpty(); } console.log(wallet); let listing = Object.keys(wallet).map((key) => { @@ -220,13 +231,8 @@ class WalletBalance extends preact.Component { if (listing.length > 0) { return
{listing}
; } - let helpLink = ( - - help - - ); - return i18n.parts`You have no balance to show. Need some ${helpLink} getting started?`; + return this.renderEmpty(); } } @@ -262,13 +268,17 @@ function formatHistoryItem(historyItem: HistoryRecord) { d.requestedAmount)}.`}

); - case "confirm-reserve": + case "confirm-reserve": { + // FIXME: eventually remove compat fix + let exchange = d.exchangeBaseUrl ? URI(d.exchangeBaseUrl).host() : "??"; + let amount = formatAmount(d.requestedAmount); + let pub = abbrev(d.reservePub); return (

- {i18n.parts`Started to withdraw from reserve (${abbrev(d.reservePub)}) of ${formatAmount( - d.requestedAmount)}.`} + {i18n.parts`Started to withdraw ${amount} from ${exchange} (${pub}).`}

); + } case "offer-contract": { let link = chrome.extension.getURL("view-contract.html"); let linkElem = {abbrev(d.contractHash)}; @@ -279,11 +289,14 @@ function formatHistoryItem(historyItem: HistoryRecord) {

); } - case "depleted-reserve": + case "depleted-reserve": { + let exchange = d.exchangeBaseUrl ? URI(d.exchangeBaseUrl).host() : "??"; + let amount = formatAmount(d.requestedAmount); + let pub = abbrev(d.reservePub); return (

- {i18n.parts`Withdraw from reserve (${abbrev(d.reservePub)}) of ${formatAmount( - d.requestedAmount)} completed.`} + {i18n.parts`Withdrew ${amount} from ${exchange} (${pub}).`}

); + } case "pay": { let url = substituteFulfillmentUrl(d.fulfillmentUrl, {H_contract: d.contractHash}); @@ -291,7 +304,7 @@ function formatHistoryItem(historyItem: HistoryRecord) { let fulfillmentLinkElem = view product; return (

- {i18n.parts`Confirmed payment of ${formatAmount(d.amount)} to merchant ${merchantElem}. (${fulfillmentLinkElem})`} + {i18n.parts`Paid ${formatAmount(d.amount)} to merchant ${merchantElem}. (${fulfillmentLinkElem})`}

); } default: