diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-01-03 14:42:06 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-01-03 14:42:06 +0100 |
commit | fd2cd9c383b07cd681c18137396deae025d98047 (patch) | |
tree | 05de454bb6fc0fcb95b66b6ef87bcd555e81b58c /src/webex/pages | |
parent | eb689d60aca8fc80e27ea60c4e4d7e848b01bea9 (diff) | |
download | wallet-core-fd2cd9c383b07cd681c18137396deae025d98047.tar.xz |
fix lint issues and separate message types into multiple files
Diffstat (limited to 'src/webex/pages')
-rw-r--r-- | src/webex/pages/add-auditor.tsx | 2 | ||||
-rw-r--r-- | src/webex/pages/auditors.tsx | 2 | ||||
-rw-r--r-- | src/webex/pages/confirm-contract.tsx | 9 | ||||
-rw-r--r-- | src/webex/pages/confirm-create-reserve.tsx | 27 | ||||
-rw-r--r-- | src/webex/pages/payback.tsx | 2 | ||||
-rw-r--r-- | src/webex/pages/popup.tsx | 11 | ||||
-rw-r--r-- | src/webex/pages/refund.tsx | 21 | ||||
-rw-r--r-- | src/webex/pages/return-coins.tsx | 7 | ||||
-rw-r--r-- | src/webex/pages/tip.tsx | 27 | ||||
-rw-r--r-- | src/webex/pages/tree.tsx | 3 |
10 files changed, 68 insertions, 43 deletions
diff --git a/src/webex/pages/add-auditor.tsx b/src/webex/pages/add-auditor.tsx index 4b898b13c..1ab6fdf9c 100644 --- a/src/webex/pages/add-auditor.tsx +++ b/src/webex/pages/add-auditor.tsx @@ -23,7 +23,7 @@ import { CurrencyRecord, -} from "../../types"; +} from "../../dbTypes"; import { ImplicitStateComponent, StateHolder } from "../components"; import { diff --git a/src/webex/pages/auditors.tsx b/src/webex/pages/auditors.tsx index 9d57218ad..276a7e8e1 100644 --- a/src/webex/pages/auditors.tsx +++ b/src/webex/pages/auditors.tsx @@ -25,7 +25,7 @@ import { AuditorRecord, CurrencyRecord, ExchangeForCurrencyRecord, -} from "../../types"; +} from "../../dbTypes"; import { getCurrencies, diff --git a/src/webex/pages/confirm-contract.tsx b/src/webex/pages/confirm-contract.tsx index e41b0a1df..83de738b9 100644 --- a/src/webex/pages/confirm-contract.tsx +++ b/src/webex/pages/confirm-contract.tsx @@ -24,12 +24,15 @@ * Imports. */ import * as i18n from "../../i18n"; + import { - CheckPayResult, - ContractTerms, ExchangeRecord, ProposalRecord, -} from "../../types"; +} from "../../dbTypes"; +import { ContractTerms } from "../../talerTypes"; +import { + CheckPayResult, +} from "../../walletTypes"; import { renderAmount } from "../renderHtml"; import * as wxApi from "../wxApi"; diff --git a/src/webex/pages/confirm-create-reserve.tsx b/src/webex/pages/confirm-create-reserve.tsx index 48bcd97c9..903975c6e 100644 --- a/src/webex/pages/confirm-create-reserve.tsx +++ b/src/webex/pages/confirm-create-reserve.tsx @@ -24,13 +24,17 @@ import { canonicalizeBaseUrl } from "../../helpers"; import * as i18n from "../../i18n"; + +import { AmountJson } from "../../amounts"; +import * as Amounts from "../../amounts"; + import { - AmountJson, - Amounts, - CreateReserveResponse, CurrencyRecord, +} from "../../dbTypes"; +import { + CreateReserveResponse, ReserveCreationInfo, -} from "../../types"; +} from "../../walletTypes"; import { ImplicitStateComponent, StateHolder } from "../components"; import { @@ -40,7 +44,10 @@ import { getReserveCreationInfo, } from "../wxApi"; -import { renderAmount, WithdrawDetailView } from "../renderHtml"; +import { + WithdrawDetailView, + renderAmount, +} from "../renderHtml"; import * as React from "react"; import * as ReactDOM from "react-dom"; @@ -78,8 +85,6 @@ class EventTrigger { } - - interface ExchangeSelectionProps { suggestedExchangeUrl: string; amount: AmountJson; @@ -273,7 +278,8 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> { if (rci.versionMatch.currentCmp === -1) { return ( <p className="errorbox"> - Your wallet (protocol version <span>{rci.walletVersion}</span>) might be outdated. The exchange has a higher, incompatible + Your wallet (protocol version <span>{rci.walletVersion}</span>) might be outdated.<span> </span> + The exchange has a higher, incompatible protocol version (<span>{rci.exchangeVersion}</span>). </p> ); @@ -281,7 +287,8 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> { if (rci.versionMatch.currentCmp === 1) { return ( <p className="errorbox"> - The chosen exchange (protocol version <span>{rci.exchangeVersion}</span> might be outdated. The exchange has a lower, incompatible + The chosen exchange (protocol version <span>{rci.exchangeVersion}</span> might be outdated.<span> </span> + The exchange has a lower, incompatible protocol version than your wallet (protocol version <span>{rci.walletVersion}</span>). </p> ); @@ -429,8 +436,8 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> { amount_fraction: amount.fraction, amount_value: amount.value, exchange: resp.exchange, - reserve_pub: resp.reservePub, exchange_wire_details: JSON.stringify(filteredWireDetails), + reserve_pub: resp.reservePub, }; const url = new URI(callback_url).addQuery(q); if (!url.is("absolute")) { diff --git a/src/webex/pages/payback.tsx b/src/webex/pages/payback.tsx index a380a33d0..f69a33493 100644 --- a/src/webex/pages/payback.tsx +++ b/src/webex/pages/payback.tsx @@ -26,7 +26,7 @@ */ import { ReserveRecord, -} from "../../types"; +} from "../../dbTypes"; import { ImplicitStateComponent, StateHolder } from "../components"; import { renderAmount } from "../renderHtml"; diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx index ded430d2b..134ee6dea 100644 --- a/src/webex/pages/popup.tsx +++ b/src/webex/pages/popup.tsx @@ -26,13 +26,15 @@ * Imports. */ import * as i18n from "../../i18n"; + +import { AmountJson } from "../../amounts"; +import * as Amounts from "../../amounts"; + import { - AmountJson, - Amounts, HistoryRecord, WalletBalance, WalletBalanceEntry, -} from "../../types"; +} from "../../walletTypes"; import { abbrev, renderAmount } from "../renderHtml"; import * as wxApi from "../wxApi"; @@ -407,7 +409,8 @@ function formatHistoryItem(historyItem: HistoryRecord) { 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>. + 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 accept the tip yet.</span> } </i18n.Translate> diff --git a/src/webex/pages/refund.tsx b/src/webex/pages/refund.tsx index e76fdfff3..3e82f3667 100644 --- a/src/webex/pages/refund.tsx +++ b/src/webex/pages/refund.tsx @@ -26,7 +26,10 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; import URI = require("urijs"); -import * as types from "../../types"; +import * as dbTypes from "../../dbTypes"; + +import { AmountJson } from "../../amounts"; +import * as Amounts from "../../amounts"; import { AmountDisplay } from "../renderHtml"; import * as wxApi from "../wxApi"; @@ -36,14 +39,14 @@ interface RefundStatusViewProps { } interface RefundStatusViewState { - purchase?: types.PurchaseRecord; - refundFees?: types.AmountJson; + purchase?: dbTypes.PurchaseRecord; + refundFees?: AmountJson; gotResult: boolean; } interface RefundDetailProps { - purchase: types.PurchaseRecord; - fullRefundFees: types.AmountJson; + purchase: dbTypes.PurchaseRecord; + fullRefundFees: AmountJson; } const RefundDetail = ({purchase, fullRefundFees}: RefundDetailProps) => { @@ -59,13 +62,13 @@ const RefundDetail = ({purchase, fullRefundFees}: RefundDetailProps) => { throw Error("invariant"); } - let amountPending = types.Amounts.getZero(currency); + let amountPending = Amounts.getZero(currency); for (const k of pendingKeys) { - amountPending = types.Amounts.add(amountPending, purchase.refundsPending[k].refund_amount).amount; + amountPending = Amounts.add(amountPending, purchase.refundsPending[k].refund_amount).amount; } - let amountDone = types.Amounts.getZero(currency); + let amountDone = Amounts.getZero(currency); for (const k of doneKeys) { - amountDone = types.Amounts.add(amountDone, purchase.refundsDone[k].refund_amount).amount; + amountDone = Amounts.add(amountDone, purchase.refundsDone[k].refund_amount).amount; } const hasPending = amountPending.fraction !== 0 || amountPending.value !== 0; diff --git a/src/webex/pages/return-coins.tsx b/src/webex/pages/return-coins.tsx index 5bcb2252a..26db52ef4 100644 --- a/src/webex/pages/return-coins.tsx +++ b/src/webex/pages/return-coins.tsx @@ -25,12 +25,13 @@ * Imports. */ +import { AmountJson } from "../../amounts"; +import * as Amounts from "../../amounts"; + import { - AmountJson, - Amounts, SenderWireInfos, WalletBalance, -} from "../../types"; +} from "../../walletTypes"; import * as i18n from "../../i18n"; diff --git a/src/webex/pages/tip.tsx b/src/webex/pages/tip.tsx index 678c0dfdd..7f96401c5 100644 --- a/src/webex/pages/tip.tsx +++ b/src/webex/pages/tip.tsx @@ -33,9 +33,13 @@ import { getTipStatus, } from "../wxApi"; -import { renderAmount, WithdrawDetailView } from "../renderHtml"; +import { + WithdrawDetailView, + renderAmount, +} from "../renderHtml"; -import { Amounts, TipStatus } from "../../types"; +import * as Amounts from "../../amounts"; +import { TipStatus } from "../../walletTypes"; interface TipDisplayProps { merchantDomain: string; @@ -54,7 +58,7 @@ class TipDisplay extends React.Component<TipDisplayProps, TipDisplayState> { } async update() { - let tipStatus = await getTipStatus(this.props.merchantDomain, this.props.tipId); + const tipStatus = await getTipStatus(this.props.merchantDomain, this.props.tipId); this.setState({ tipStatus }); } @@ -73,7 +77,7 @@ class TipDisplay extends React.Component<TipDisplayProps, TipDisplayState> { renderExchangeInfo(ts: TipStatus) { const rci = ts.rci; if (!rci) { - return <p>Waiting for info about exchange ...</p> + return <p>Waiting for info about exchange ...</p>; } const totalCost = Amounts.add(rci.overhead, rci.withdrawFee).amount; return ( @@ -102,7 +106,9 @@ class TipDisplay extends React.Component<TipDisplayProps, TipDisplayState> { className="pure-button pure-button-primary" type="button" onClick={() => this.accept()}> - { this.state.working ? <span><object className="svg-icon svg-baseline" data="/img/spinner-bars.svg" /> </span> : null } + { this.state.working + ? <span><object className="svg-icon svg-baseline" data="/img/spinner-bars.svg" /> </span> + : null } Accept tip </button> {" "} @@ -119,7 +125,8 @@ class TipDisplay extends React.Component<TipDisplayProps, TipDisplayState> { return ( <div> <h2>Tip Received!</h2> - <p>You received a tip of <strong>{renderAmount(ts.tip.amount)}</strong> from <strong>{this.props.merchantDomain}</strong>.</p> + <p>You received a tip of <strong>{renderAmount(ts.tip.amount)}</strong> from <span> </span> + <strong>{this.props.merchantDomain}</strong>.</p> {ts.tip.accepted ? <p>You've accepted this tip! <a href={ts.tip.nextUrl}>Go back to merchant</a></p> : this.renderButtons() @@ -134,10 +141,10 @@ async function main() { try { const url = new URI(document.location.href); const query: any = URI.parseQuery(url.query()); - - let merchantDomain = query.merchant_domain; - let tipId = query.tip_id; - let props: TipDisplayProps = { tipId, merchantDomain }; + + const merchantDomain = query.merchant_domain; + const tipId = query.tip_id; + const props: TipDisplayProps = { tipId, merchantDomain }; ReactDOM.render(<TipDisplay {...props} />, document.getElementById("container")!); diff --git a/src/webex/pages/tree.tsx b/src/webex/pages/tree.tsx index 2ac0b8631..67e58a1df 100644 --- a/src/webex/pages/tree.tsx +++ b/src/webex/pages/tree.tsx @@ -22,6 +22,7 @@ import { getTalerStampDate } from "../../helpers"; + import { CoinRecord, CoinStatus, @@ -29,7 +30,7 @@ import { ExchangeRecord, PreCoinRecord, ReserveRecord, -} from "../../types"; +} from "../../dbTypes"; import { ImplicitStateComponent, StateHolder } from "../components"; import { |