show tip in history

This commit is contained in:
Florian Dold 2017-12-12 15:38:03 +01:00
parent b4484c8af3
commit 1bcc5022c2
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
9 changed files with 96 additions and 16 deletions

View File

@ -255,17 +255,27 @@ msgstr "Reserve (%1$s) mit %2$s bei %3$s erzeugt"
msgid "Merchant%1$sgave a refund over%2$s.\n"
msgstr ""
#: src/webex/pages/popup.tsx:405
#: src/webex/pages/popup.tsx:408
#, fuzzy, c-format
msgid ""
"Merchant%1$sgave a%2$sof%3$s.\n"
"%4$s%5$s"
msgstr ""
"%1$s\n"
" möchte einen Vertrag über %2$s\n"
" mit Ihnen abschließen."
#: src/webex/pages/popup.tsx:417
#, c-format
msgid "Unknown event (%1$s)"
msgstr ""
#: src/webex/pages/popup.tsx:448
#: src/webex/pages/popup.tsx:460
#, c-format
msgid "Error: could not retrieve event history"
msgstr ""
#: src/webex/pages/popup.tsx:473
#: src/webex/pages/popup.tsx:485
#, c-format
msgid "Your wallet has no events recorded."
msgstr "Ihre Geldbörse verzeichnet keine Vorkommnisse."

View File

@ -252,17 +252,24 @@ msgstr ""
msgid "Merchant%1$sgave a refund over%2$s.\n"
msgstr ""
#: src/webex/pages/popup.tsx:405
#: src/webex/pages/popup.tsx:408
#, c-format
msgid ""
"Merchant%1$sgave a%2$sof%3$s.\n"
"%4$s%5$s"
msgstr ""
#: src/webex/pages/popup.tsx:417
#, c-format
msgid "Unknown event (%1$s)"
msgstr ""
#: src/webex/pages/popup.tsx:448
#: src/webex/pages/popup.tsx:460
#, c-format
msgid "Error: could not retrieve event history"
msgstr ""
#: src/webex/pages/popup.tsx:473
#: src/webex/pages/popup.tsx:485
#, c-format
msgid "Your wallet has no events recorded."
msgstr ""

View File

@ -252,17 +252,24 @@ msgstr ""
msgid "Merchant%1$sgave a refund over%2$s.\n"
msgstr ""
#: src/webex/pages/popup.tsx:405
#: src/webex/pages/popup.tsx:408
#, c-format
msgid ""
"Merchant%1$sgave a%2$sof%3$s.\n"
"%4$s%5$s"
msgstr ""
#: src/webex/pages/popup.tsx:417
#, c-format
msgid "Unknown event (%1$s)"
msgstr ""
#: src/webex/pages/popup.tsx:448
#: src/webex/pages/popup.tsx:460
#, c-format
msgid "Error: could not retrieve event history"
msgstr ""
#: src/webex/pages/popup.tsx:473
#: src/webex/pages/popup.tsx:485
#, c-format
msgid "Your wallet has no events recorded."
msgstr ""

View File

@ -252,17 +252,24 @@ msgstr ""
msgid "Merchant%1$sgave a refund over%2$s.\n"
msgstr ""
#: src/webex/pages/popup.tsx:405
#: src/webex/pages/popup.tsx:408
#, c-format
msgid ""
"Merchant%1$sgave a%2$sof%3$s.\n"
"%4$s%5$s"
msgstr ""
#: src/webex/pages/popup.tsx:417
#, c-format
msgid "Unknown event (%1$s)"
msgstr ""
#: src/webex/pages/popup.tsx:448
#: src/webex/pages/popup.tsx:460
#, c-format
msgid "Error: could not retrieve event history"
msgstr ""
#: src/webex/pages/popup.tsx:473
#: src/webex/pages/popup.tsx:485
#, c-format
msgid "Your wallet has no events recorded."
msgstr ""

View File

@ -144,6 +144,9 @@ strings['de'] = {
"Merchant%1$sgave a refund over%2$s.\n": [
""
],
"Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [
"%1$s\n möchte einen Vertrag über %2$s\n mit Ihnen abschließen."
],
"Unknown event (%1$s)": [
""
],
@ -330,6 +333,9 @@ strings['en-US'] = {
"Merchant%1$sgave a refund over%2$s.\n": [
""
],
"Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [
""
],
"Unknown event (%1$s)": [
""
],
@ -516,6 +522,9 @@ strings['fr'] = {
"Merchant%1$sgave a refund over%2$s.\n": [
""
],
"Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [
""
],
"Unknown event (%1$s)": [
""
],
@ -702,6 +711,9 @@ strings['it'] = {
"Merchant%1$sgave a refund over%2$s.\n": [
""
],
"Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [
""
],
"Unknown event (%1$s)": [
""
],

View File

@ -252,17 +252,24 @@ msgstr ""
msgid "Merchant%1$sgave a refund over%2$s.\n"
msgstr ""
#: src/webex/pages/popup.tsx:405
#: src/webex/pages/popup.tsx:408
#, c-format
msgid ""
"Merchant%1$sgave a%2$sof%3$s.\n"
"%4$s%5$s"
msgstr ""
#: src/webex/pages/popup.tsx:417
#, c-format
msgid "Unknown event (%1$s)"
msgstr ""
#: src/webex/pages/popup.tsx:448
#: src/webex/pages/popup.tsx:460
#, c-format
msgid "Error: could not retrieve event history"
msgstr ""
#: src/webex/pages/popup.tsx:473
#: src/webex/pages/popup.tsx:485
#, c-format
msgid "Your wallet has no events recorded."
msgstr ""

View File

@ -1948,6 +1948,8 @@ export interface TipRecord {
* URL to go to once the tip has been accepted.
*/
nextUrl: string;
timestamp: number;
}

View File

@ -329,7 +329,7 @@ export const WALLET_PROTOCOL_VERSION = "2:0:0";
* In the future we might consider adding migration functions for
* each version increment.
*/
export const WALLET_DB_VERSION = 22;
export const WALLET_DB_VERSION = 23;
const builtinCurrencies: CurrencyRecord[] = [
{
@ -2356,6 +2356,20 @@ export class Wallet {
}
}
const tips: TipRecord[] = await this.q().iter<TipRecord>(Stores.tips).toArray();
for (const tip of tips) {
history.push({
detail: {
merchantDomain: tip.merchantDomain,
amount: tip.amount,
reservePub: tip.accepted,
tipId: tip.tipId,
},
timestamp: tip.timestamp,
type: "tip",
});
}
history.sort((h1, h2) => Math.sign(h1.timestamp - h2.timestamp));
return {history};
@ -2869,6 +2883,7 @@ export class Wallet {
const denomsForWithdraw = await this.getVerifiedWithdrawDenomList(exchangeUrl, amount);
const planchets = await Promise.all(denomsForWithdraw.map(d => this.cryptoApi.createTipPlanchet(d)));
const coinPubs: string[] = planchets.map(x => x.coinPub);
const now = (new Date()).getTime();
tipRecord = {
accepted: false,
amount,
@ -2878,6 +2893,7 @@ export class Wallet {
merchantDomain,
nextUrl,
planchets,
timestamp: now,
tipId,
};
await this.q().put(Stores.tips, tipRecord).finish();

View File

@ -401,6 +401,18 @@ function formatHistoryItem(historyItem: HistoryRecord) {
</i18n.Translate>
);
}
case "tip": {
const tipPageUrl = new URI(chrome.extension.getURL("/src/webex/pages/tip.html"));
const params = { tip_id: d.tipId, merchant_domain: d.merchantDomain };
const url = tipPageUrl.query(params).href();
return (
<i18n.Translate wrap="p">
Merchant <span>{d.merchantDomain}</span> gave a <a href={url} onClick={openTab(url)}> tip</a> of <span>{renderAmount(d.amount)}</span>.
<span> </span>
{d.accepted ? null : <span>You did not accepted the tip yet.</span> }
</i18n.Translate>
);
}
default:
return (<p>{i18n.str`Unknown event (${historyItem.type})`}</p>);
}