fix text for logs
This commit is contained in:
parent
bebbea4ea8
commit
ce4d9c4703
@ -535,7 +535,7 @@ export class Wallet {
|
|||||||
merchantName: offer.contract.merchant.name,
|
merchantName: offer.contract.merchant.name,
|
||||||
amount: offer.contract.amount,
|
amount: offer.contract.amount,
|
||||||
contractHash: offer.H_contract,
|
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}`,
|
subjectId: `reserve-progress-${reserveRecord.reserve_pub}`,
|
||||||
timestamp: (new Date).getTime(),
|
timestamp: (new Date).getTime(),
|
||||||
detail: {
|
detail: {
|
||||||
|
exchangeBaseUrl: reserveRecord.exchange_base_url,
|
||||||
reservePub: reserveRecord.reserve_pub,
|
reservePub: reserveRecord.reserve_pub,
|
||||||
requestedAmount: reserveRecord.requested_amount,
|
requestedAmount: reserveRecord.requested_amount,
|
||||||
currentAmount: reserveRecord.current_amount,
|
currentAmount: reserveRecord.current_amount,
|
||||||
@ -759,6 +760,7 @@ export class Wallet {
|
|||||||
timestamp: now,
|
timestamp: now,
|
||||||
subjectId: `reserve-progress-${reserve.reserve_pub}`,
|
subjectId: `reserve-progress-${reserve.reserve_pub}`,
|
||||||
detail: {
|
detail: {
|
||||||
|
exchangeBaseUrl: reserve.exchange_base_url,
|
||||||
reservePub: req.reservePub,
|
reservePub: req.reservePub,
|
||||||
requestedAmount: reserve.requested_amount,
|
requestedAmount: reserve.requested_amount,
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="popup.css">
|
<link rel="stylesheet" type="text/css" href="popup.css">
|
||||||
|
|
||||||
<script src="../lib/vendor/preact.js"></script>
|
<script src="../lib/vendor/preact.js"></script>
|
||||||
|
<script src="../lib/vendor/URI.js"></script>
|
||||||
|
|
||||||
<script src="../lib/vendor/jed.js"></script>
|
<script src="../lib/vendor/jed.js"></script>
|
||||||
<script src="../lib/i18n.js"></script>
|
<script src="../lib/i18n.js"></script>
|
||||||
|
@ -102,11 +102,13 @@ export function main() {
|
|||||||
let el = (
|
let el = (
|
||||||
<div>
|
<div>
|
||||||
<WalletNavBar />
|
<WalletNavBar />
|
||||||
|
<div style="margin:1em">
|
||||||
<Router>
|
<Router>
|
||||||
<WalletBalance route="/balance" default/>
|
<WalletBalance route="/balance" default/>
|
||||||
<WalletHistory route="/history"/>
|
<WalletHistory route="/history"/>
|
||||||
<WalletDebug route="/debug"/>
|
<WalletDebug route="/debug"/>
|
||||||
</Router>
|
</Router>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -175,7 +177,7 @@ function ExtensionLink(props: any) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<a onClick={onClick}>
|
<a onClick={onClick} href={props.target}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</a>)
|
</a>)
|
||||||
}
|
}
|
||||||
@ -205,13 +207,22 @@ class WalletBalance extends preact.Component<any, any> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderEmpty() : JSX.Element {
|
||||||
|
let helpLink = (
|
||||||
|
<ExtensionLink target="pages/help/empty-wallet.html">
|
||||||
|
help
|
||||||
|
</ExtensionLink>
|
||||||
|
);
|
||||||
|
return <div>You have no balance to show. Need some {helpLink} getting started?</div>;
|
||||||
|
}
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
let wallet = this.myWallet;
|
let wallet = this.myWallet;
|
||||||
if (this.gotError) {
|
if (this.gotError) {
|
||||||
return i18n`Error: could not retrieve balance information.`;
|
return i18n`Error: could not retrieve balance information.`;
|
||||||
}
|
}
|
||||||
if (!wallet) {
|
if (!wallet) {
|
||||||
return <div></div>
|
return this.renderEmpty();
|
||||||
}
|
}
|
||||||
console.log(wallet);
|
console.log(wallet);
|
||||||
let listing = Object.keys(wallet).map((key) => {
|
let listing = Object.keys(wallet).map((key) => {
|
||||||
@ -220,13 +231,8 @@ class WalletBalance extends preact.Component<any, any> {
|
|||||||
if (listing.length > 0) {
|
if (listing.length > 0) {
|
||||||
return <div>{listing}</div>;
|
return <div>{listing}</div>;
|
||||||
}
|
}
|
||||||
let helpLink = (
|
|
||||||
<ExtensionLink target="pages/help/empty-wallet.html">
|
|
||||||
help
|
|
||||||
</ExtensionLink>
|
|
||||||
);
|
|
||||||
|
|
||||||
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)}.`}
|
d.requestedAmount)}.`}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
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 (
|
return (
|
||||||
<p>
|
<p>
|
||||||
{i18n.parts`Started to withdraw from reserve (${abbrev(d.reservePub)}) of ${formatAmount(
|
{i18n.parts`Started to withdraw ${amount} from ${exchange} (${pub}).`}
|
||||||
d.requestedAmount)}.`}
|
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
case "offer-contract": {
|
case "offer-contract": {
|
||||||
let link = chrome.extension.getURL("view-contract.html");
|
let link = chrome.extension.getURL("view-contract.html");
|
||||||
let linkElem = <a href={link}>{abbrev(d.contractHash)}</a>;
|
let linkElem = <a href={link}>{abbrev(d.contractHash)}</a>;
|
||||||
@ -279,11 +289,14 @@ function formatHistoryItem(historyItem: HistoryRecord) {
|
|||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
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 (<p>
|
return (<p>
|
||||||
{i18n.parts`Withdraw from reserve (${abbrev(d.reservePub)}) of ${formatAmount(
|
{i18n.parts`Withdrew ${amount} from ${exchange} (${pub}).`}
|
||||||
d.requestedAmount)} completed.`}
|
|
||||||
</p>);
|
</p>);
|
||||||
|
}
|
||||||
case "pay": {
|
case "pay": {
|
||||||
let url = substituteFulfillmentUrl(d.fulfillmentUrl,
|
let url = substituteFulfillmentUrl(d.fulfillmentUrl,
|
||||||
{H_contract: d.contractHash});
|
{H_contract: d.contractHash});
|
||||||
@ -291,7 +304,7 @@ function formatHistoryItem(historyItem: HistoryRecord) {
|
|||||||
let fulfillmentLinkElem = <a href={url} onClick={openTab(url)}>view product</a>;
|
let fulfillmentLinkElem = <a href={url} onClick={openTab(url)}>view product</a>;
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
{i18n.parts`Confirmed payment of ${formatAmount(d.amount)} to merchant ${merchantElem}. (${fulfillmentLinkElem})`}
|
{i18n.parts`Paid ${formatAmount(d.amount)} to merchant ${merchantElem}. (${fulfillmentLinkElem})`}
|
||||||
</p>);
|
</p>);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user