aboutsummaryrefslogtreecommitdiff
path: root/src/webex/pages
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-04-07 13:37:32 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-04-07 13:37:32 +0530
commitfb2e2f89935240666de66e4b2c11125cb3b2943d (patch)
tree7b7e148e6cce7bf7639a5e35102f5269f5920ab5 /src/webex/pages
parent1471aae8927c20d646cc2aa5ab0e20c1a7f2c0ca (diff)
more lint fixes
Diffstat (limited to 'src/webex/pages')
-rw-r--r--src/webex/pages/add-auditor.tsx4
-rw-r--r--src/webex/pages/auditors.tsx21
-rw-r--r--src/webex/pages/pay.tsx2
-rw-r--r--src/webex/pages/payback.tsx2
-rw-r--r--src/webex/pages/popup.tsx26
-rw-r--r--src/webex/pages/refund.tsx6
-rw-r--r--src/webex/pages/reset-required.tsx8
-rw-r--r--src/webex/pages/return-coins.tsx5
-rw-r--r--src/webex/pages/tip.tsx19
-rw-r--r--src/webex/pages/welcome.tsx4
-rw-r--r--src/webex/pages/withdraw.tsx23
11 files changed, 57 insertions, 63 deletions
diff --git a/src/webex/pages/add-auditor.tsx b/src/webex/pages/add-auditor.tsx
index fc7de920f..c28d15cad 100644
--- a/src/webex/pages/add-auditor.tsx
+++ b/src/webex/pages/add-auditor.tsx
@@ -91,9 +91,7 @@ function ConfirmAuditor(props: ConfirmAuditorProps): JSX.Element {
{addDone ? (
<div>
Auditor was added! You can also{" "}
- <a href={chrome.extension.getURL("/auditors.html")}>
- view and edit
- </a>{" "}
+ <a href={chrome.extension.getURL("/auditors.html")}>view and edit</a>{" "}
auditors.
</div>
) : (
diff --git a/src/webex/pages/auditors.tsx b/src/webex/pages/auditors.tsx
index e933aeace..ac93afd31 100644
--- a/src/webex/pages/auditors.tsx
+++ b/src/webex/pages/auditors.tsx
@@ -29,7 +29,6 @@ import {
import { getCurrencies, updateCurrency } from "../wxApi";
import * as React from "react";
-import * as ReactDOM from "react-dom";
interface CurrencyListState {
currencies?: CurrencyRecord[];
@@ -49,13 +48,16 @@ class CurrencyList extends React.Component<{}, CurrencyListState> {
this.state = {} as any;
}
- async update() {
+ async update(): Promise<void> {
const currencies = await getCurrencies();
console.log("currencies: ", currencies);
this.setState({ currencies });
}
- async confirmRemoveAuditor(c: CurrencyRecord, a: AuditorRecord) {
+ async confirmRemoveAuditor(
+ c: CurrencyRecord,
+ a: AuditorRecord,
+ ): Promise<void> {
if (
window.confirm(
`Do you really want to remove auditor ${a.baseUrl} for currency ${c.name}?`,
@@ -66,7 +68,10 @@ class CurrencyList extends React.Component<{}, CurrencyListState> {
}
}
- async confirmRemoveExchange(c: CurrencyRecord, e: ExchangeForCurrencyRecord) {
+ async confirmRemoveExchange(
+ c: CurrencyRecord,
+ e: ExchangeForCurrencyRecord,
+ ): Promise<void> {
if (
window.confirm(
`Do you really want to remove exchange ${e.baseUrl} for currency ${c.name}?`,
@@ -86,7 +91,7 @@ class CurrencyList extends React.Component<{}, CurrencyListState> {
<p>Trusted Auditors:</p>
<ul>
{c.auditors.map((a) => (
- <li>
+ <li key={a.baseUrl}>
{a.baseUrl}{" "}
<button
className="pure-button button-destructive"
@@ -114,7 +119,7 @@ class CurrencyList extends React.Component<{}, CurrencyListState> {
<p>Trusted Exchanges:</p>
<ul>
{c.exchanges.map((e) => (
- <li>
+ <li key={e.baseUrl}>
{e.baseUrl}{" "}
<button
className="pure-button button-destructive"
@@ -137,7 +142,7 @@ class CurrencyList extends React.Component<{}, CurrencyListState> {
return (
<div id="main">
{currencies.map((c) => (
- <div>
+ <div key={c.name}>
<h1>Currency {c.name}</h1>
<p>Displayed with {c.fractionalDigits} fractional digits.</p>
<h2>Auditors</h2>
@@ -151,6 +156,6 @@ class CurrencyList extends React.Component<{}, CurrencyListState> {
}
}
-function makeAuditorsPage() {
+export function makeAuditorsPage(): JSX.Element {
return <CurrencyList />;
}
diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx
index e3dd630b6..61f287708 100644
--- a/src/webex/pages/pay.tsx
+++ b/src/webex/pages/pay.tsx
@@ -47,7 +47,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
setPayStatus(p);
};
doFetch();
- }, [numTries]);
+ }, [numTries, talerPayUri]);
if (!payStatus) {
return <span>Loading payment information ...</span>;
diff --git a/src/webex/pages/payback.tsx b/src/webex/pages/payback.tsx
index 9c53aac91..5d42f5f47 100644
--- a/src/webex/pages/payback.tsx
+++ b/src/webex/pages/payback.tsx
@@ -25,6 +25,6 @@
*/
import * as React from "react";
-export function makePaybackPage() {
+export function makePaybackPage(): JSX.Element {
return <div>not implemented</div>;
}
diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx
index f62f64b73..cdb09d444 100644
--- a/src/webex/pages/popup.tsx
+++ b/src/webex/pages/popup.tsx
@@ -31,11 +31,7 @@ import * as Amounts from "../../util/amounts";
import { WalletBalance, WalletBalanceEntry } from "../../types/walletTypes";
-import {
- abbrev,
- renderAmount,
- PageLink,
-} from "../renderHtml";
+import { abbrev, renderAmount, PageLink } from "../renderHtml";
import * as wxApi from "../wxApi";
import React, { Fragment } from "react";
@@ -671,7 +667,7 @@ class WalletHistory extends React.Component<any, any> {
console.log("rendering history");
const history: HistoryEvent[] = this.myHistory;
if (this.gotError) {
- return i18n.str`Error: could not retrieve event history`;
+ return <span>i18n.str`Error: could not retrieve event history`</span>;
}
if (!history) {
@@ -734,18 +730,10 @@ function WalletDebug(props: any): JSX.Element {
return (
<div>
<p>Debug tools:</p>
- <button onClick={openExtensionPage("/popup.html")}>
- wallet tab
- </button>
- <button onClick={openExtensionPage("/benchmark.html")}>
- benchmark
- </button>
- <button onClick={openExtensionPage("/show-db.html")}>
- show db
- </button>
- <button onClick={openExtensionPage("/tree.html")}>
- show tree
- </button>
+ <button onClick={openExtensionPage("/popup.html")}>wallet tab</button>
+ <button onClick={openExtensionPage("/benchmark.html")}>benchmark</button>
+ <button onClick={openExtensionPage("/show-db.html")}>show db</button>
+ <button onClick={openExtensionPage("/tree.html")}>show tree</button>
<br />
<button onClick={confirmReset}>reset</button>
<button onClick={reload}>reload chrome extension</button>
@@ -788,4 +776,4 @@ function WalletPopup(): JSX.Element {
export function createPopup(): JSX.Element {
chrome.runtime.connect({ name: "popup" });
return <WalletPopup />;
-} \ No newline at end of file
+}
diff --git a/src/webex/pages/refund.tsx b/src/webex/pages/refund.tsx
index 4a13317cd..621a286bb 100644
--- a/src/webex/pages/refund.tsx
+++ b/src/webex/pages/refund.tsx
@@ -47,7 +47,7 @@ function RefundStatusView(props: { talerRefundUri: string }): JSX.Element {
}
};
doFetch();
- }, []);
+ }, [props.talerRefundUri]);
console.log("rendering");
@@ -63,7 +63,7 @@ function RefundStatusView(props: { talerRefundUri: string }): JSX.Element {
<>
<h2>Refund Status</h2>
<p>
- The product <em>{purchaseDetails.contractTerms.summary!}</em> has
+ The product <em>{purchaseDetails.contractTerms.summary}</em> has
received a total refund of{" "}
<AmountView amount={purchaseDetails.totalRefundAmount} />.
</p>
@@ -77,7 +77,7 @@ export function createRefundPage(): JSX.Element {
const container = document.getElementById("container");
if (!container) {
- throw Error("fatal: can't mount component, container missing")
+ throw Error("fatal: can't mount component, container missing");
}
const talerRefundUri = url.searchParams.get("talerRefundUri");
diff --git a/src/webex/pages/reset-required.tsx b/src/webex/pages/reset-required.tsx
index e58243b34..9e40e7981 100644
--- a/src/webex/pages/reset-required.tsx
+++ b/src/webex/pages/reset-required.tsx
@@ -42,17 +42,17 @@ class ResetNotification extends React.Component<any, State> {
this.state = { checked: false, resetRequired: true };
setInterval(() => this.update(), 500);
}
- async update() {
+ async update(): Promise<void> {
const res = await wxApi.checkUpgrade();
this.setState({ resetRequired: res.dbResetRequired });
}
- render() {
+ render(): JSX.Element {
if (this.state.resetRequired) {
return (
<div>
<h1>Manual Reset Reqired</h1>
<p>
- The wallet's database in your browser is incompatible with the{" "}
+ The wallet&apos;s database in your browser is incompatible with the{" "}
currently installed wallet. Please reset manually.
</p>
<p>
@@ -88,6 +88,6 @@ class ResetNotification extends React.Component<any, State> {
}
}
-export function createResetRequiredPage() {
+export function createResetRequiredPage(): JSX.Element {
return <ResetNotification />;
}
diff --git a/src/webex/pages/return-coins.tsx b/src/webex/pages/return-coins.tsx
index 7d759705f..ccdb6db53 100644
--- a/src/webex/pages/return-coins.tsx
+++ b/src/webex/pages/return-coins.tsx
@@ -290,8 +290,9 @@ class ReturnCoins extends React.Component<{}, ReturnCoinsState> {
<div id="main">
<h1>Wire electronic cash back to own bank account</h1>
<p>
- You can send coins back into your own bank account. Note that you're
- acting as a merchant when doing this, and thus the same fees apply.
+ You can send coins back into your own bank account. Note that
+ you&apos;re acting as a merchant when doing this, and thus the same
+ fees apply.
</p>
{this.state.lastConfirmedDetail ? (
<p className="okaybox">
diff --git a/src/webex/pages/tip.tsx b/src/webex/pages/tip.tsx
index 9c797f50d..4a1d3743a 100644
--- a/src/webex/pages/tip.tsx
+++ b/src/webex/pages/tip.tsx
@@ -25,10 +25,7 @@ import * as React from "react";
import { acceptTip, getTipStatus } from "../wxApi";
-import {
- renderAmount,
- ProgressButton,
-} from "../renderHtml";
+import { renderAmount, ProgressButton } from "../renderHtml";
import { useState, useEffect } from "react";
import { TipStatus } from "../../types/walletTypes";
@@ -45,7 +42,7 @@ function TipDisplay(props: { talerTipUri: string }): JSX.Element {
setTipStatus(ts);
};
doFetch();
- }, []);
+ }, [props.talerTipUri]);
if (discarded) {
return <span>You&apos;ve discarded the tip.</span>;
@@ -96,11 +93,11 @@ function TipDisplay(props: { talerTipUri: string }): JSX.Element {
}
export function createTipPage(): JSX.Element {
- const url = new URL(document.location.href);
- const talerTipUri = url.searchParams.get("talerTipUri");
- if (typeof talerTipUri !== "string") {
- throw Error("talerTipUri must be a string");
- }
+ const url = new URL(document.location.href);
+ const talerTipUri = url.searchParams.get("talerTipUri");
+ if (typeof talerTipUri !== "string") {
+ throw Error("talerTipUri must be a string");
+ }
- return <TipDisplay talerTipUri={talerTipUri} />;
+ return <TipDisplay talerTipUri={talerTipUri} />;
}
diff --git a/src/webex/pages/welcome.tsx b/src/webex/pages/welcome.tsx
index a99cadb05..eecbe2be5 100644
--- a/src/webex/pages/welcome.tsx
+++ b/src/webex/pages/welcome.tsx
@@ -69,7 +69,7 @@ function Diagnostics(): JSX.Element {
<p>Problems detected:</p>
<ol>
{diagnostics.errors.map((errMsg) => (
- <li>{errMsg}</li>
+ <li key={errMsg}>{errMsg}</li>
))}
</ol>
{diagnostics.firefoxIdbProblem ? (
@@ -112,4 +112,4 @@ function Welcome(): JSX.Element {
export function createWelcomePage(): JSX.Element {
return <Welcome />;
-} \ No newline at end of file
+}
diff --git a/src/webex/pages/withdraw.tsx b/src/webex/pages/withdraw.tsx
index 9020ddb0b..efd0adc86 100644
--- a/src/webex/pages/withdraw.tsx
+++ b/src/webex/pages/withdraw.tsx
@@ -30,7 +30,9 @@ import { WithdrawDetailView, renderAmount } from "../renderHtml";
import React, { useState, useEffect } from "react";
import { getWithdrawDetails, acceptWithdrawal } from "../wxApi";
-function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element {
+function NewExchangeSelection(props: {
+ talerWithdrawUri: string;
+}): JSX.Element {
const [details, setDetails] = useState<WithdrawDetails | undefined>();
const [selectedExchange, setSelectedExchange] = useState<
string | undefined
@@ -63,7 +65,7 @@ function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element
setDetails(d);
};
fetchData();
- }, [selectedExchange, errMsg, selecting]);
+ }, [selectedExchange, errMsg, selecting, talerWithdrawUri]);
if (errMsg) {
return (
@@ -145,8 +147,11 @@ function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element
}
const accept = async (): Promise<void> => {
+ if (!selectedExchange) {
+ throw Error("can't accept, no exchange selected");
+ }
console.log("accepting exchange", selectedExchange);
- const res = await acceptWithdrawal(talerWithdrawUri, selectedExchange!);
+ const res = await acceptWithdrawal(talerWithdrawUri, selectedExchange);
console.log("accept withdrawal response", res);
if (res.confirmTransferUrl) {
document.location.href = res.confirmTransferUrl;
@@ -198,9 +203,9 @@ function NewExchangeSelection(props: { talerWithdrawUri: string }): JSX.Element
export function createWithdrawPage(): JSX.Element {
const url = new URL(document.location.href);
- const talerWithdrawUri = url.searchParams.get("talerWithdrawUri");
- if (!talerWithdrawUri) {
- throw Error("withdraw URI required");
- }
- return <NewExchangeSelection talerWithdrawUri={talerWithdrawUri} />;
-} \ No newline at end of file
+ const talerWithdrawUri = url.searchParams.get("talerWithdrawUri");
+ if (!talerWithdrawUri) {
+ throw Error("withdraw URI required");
+ }
+ return <NewExchangeSelection talerWithdrawUri={talerWithdrawUri} />;
+}