summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/popup
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-03-11 02:17:40 -0300
committerSebastian <sebasjm@gmail.com>2022-03-11 11:15:06 -0300
commit4d66f774c3ad4040f522d2ec52b5b4c2edd2b478 (patch)
treeb73ce595926f6db58a206968666e7d3a0978feaf /packages/taler-wallet-webextension/src/popup
parent2150f3d96b25772dd608e245cd3508f857478c5b (diff)
downloadwallet-core-4d66f774c3ad4040f522d2ec52b5b4c2edd2b478.tar.gz
wallet-core-4d66f774c3ad4040f522d2ec52b5b4c2edd2b478.tar.bz2
wallet-core-4d66f774c3ad4040f522d2ec52b5b4c2edd2b478.zip
pending operations
Diffstat (limited to 'packages/taler-wallet-webextension/src/popup')
-rw-r--r--packages/taler-wallet-webextension/src/popup/BalancePage.tsx30
1 files changed, 27 insertions, 3 deletions
diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
index d7bfdf545..199ff10df 100644
--- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
@@ -14,7 +14,13 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { Amounts, Balance, i18n } from "@gnu-taler/taler-util";
+import {
+ Amounts,
+ Balance,
+ i18n,
+ NotificationType,
+ Transaction,
+} from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
import { BalanceTable } from "../components/BalanceTable";
@@ -22,6 +28,7 @@ import { JustInDevMode } from "../components/JustInDevMode";
import { Loading } from "../components/Loading";
import { LoadingError } from "../components/LoadingError";
import { MultiActionButton } from "../components/MultiActionButton";
+import PendingTransactions from "../components/PendingTransactions";
import { ButtonBoxPrimary, ButtonPrimary } from "../components/styled";
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
import { AddNewActionView } from "../wallet/AddNewActionView";
@@ -39,8 +46,19 @@ export function BalancePage({
goToWalletHistory,
}: Props): VNode {
const [addingAction, setAddingAction] = useState(false);
- const state = useAsyncAsHook(wxApi.getBalance);
- const balances = !state || state.hasError ? [] : state.response.balances;
+ const state = useAsyncAsHook(
+ async () => ({
+ balance: await wxApi.getBalance(),
+ pending: await wxApi.getTransactions(),
+ }),
+ [NotificationType.WithdrawGroupFinished],
+ );
+ const balances =
+ !state || state.hasError ? [] : state.response.balance.balances;
+ const pending =
+ !state || state.hasError
+ ? []
+ : state.response.pending.transactions.filter((t) => t.pending);
if (!state) {
return <Loading />;
@@ -62,6 +80,7 @@ export function BalancePage({
return (
<BalanceView
balances={balances}
+ pending={pending}
goToWalletManualWithdraw={goToWalletManualWithdraw}
goToWalletDeposit={goToWalletDeposit}
goToWalletHistory={goToWalletHistory}
@@ -71,6 +90,7 @@ export function BalancePage({
}
export interface BalanceViewProps {
balances: Balance[];
+ pending: Transaction[];
goToWalletManualWithdraw: () => void;
goToAddAction: () => void;
goToWalletDeposit: (currency: string) => void;
@@ -79,6 +99,7 @@ export interface BalanceViewProps {
export function BalanceView({
balances,
+ pending,
goToWalletManualWithdraw,
goToWalletDeposit,
goToWalletHistory,
@@ -96,6 +117,9 @@ export function BalanceView({
return (
<Fragment>
+ {pending.length > 0 ? (
+ <PendingTransactions transactions={pending} />
+ ) : undefined}
<section>
<BalanceTable
balances={balances}