[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fix deposit navigation
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fix deposit navigation |
Date: |
Fri, 13 Jan 2023 21:31:31 +0100 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 8e8bada64 fix deposit navigation
8e8bada64 is described below
commit 8e8bada643b73b78991cde9abc375825a18bf9d9
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Jan 13 17:31:20 2023 -0300
fix deposit navigation
---
packages/taler-wallet-webextension/src/context/alert.ts | 13 ++++++++-----
.../taler-wallet-webextension/src/wallet/Application.tsx | 3 ++-
.../src/wallet/DepositPage/index.ts | 1 -
.../src/wallet/DepositPage/state.ts | 3 +--
.../src/wallet/DepositPage/test.ts | 11 ++++++-----
5 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/packages/taler-wallet-webextension/src/context/alert.ts
b/packages/taler-wallet-webextension/src/context/alert.ts
index 8527f30f6..da37a2768 100644
--- a/packages/taler-wallet-webextension/src/context/alert.ts
+++ b/packages/taler-wallet-webextension/src/context/alert.ts
@@ -49,13 +49,16 @@ type Type = {
pushAlert: (n: Alert) => void;
removeAlert: (n: Alert) => void;
/**
- *
- * @param h
- * @returns
+ *
+ * @param h
+ * @returns
* @deprecated use safely
*/
pushAlertOnError: <T>(h: (p: T) => Promise<void>) => SafeHandler<T>;
- safely: <T>(h: (p: T) => Promise<void>, error: TranslatedString) =>
SafeHandler<T>;
+ safely: <T>(
+ h: (p: T) => Promise<void>,
+ error: TranslatedString,
+ ) => SafeHandler<T>;
};
const initial: Type = {
@@ -112,7 +115,7 @@ export const AlertProvider = ({ children }: Props): VNode
=> {
function safely<T>(
handler: (p: T) => Promise<void>,
- message: TranslatedString
+ message: TranslatedString,
): SafeHandler<T> {
return withSafe(handler, (e) => {
const a = alertFromError(message, e);
diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx
b/packages/taler-wallet-webextension/src/wallet/Application.tsx
index 0db06fe08..ec34606dd 100644
--- a/packages/taler-wallet-webextension/src/wallet/Application.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx
@@ -207,9 +207,10 @@ export function Application(): VNode {
<Route
path={Pages.balanceDeposit.pattern}
- component={() => (
+ component={({ amount }: { amount: string }) => (
<WalletTemplate path="balance">
<DepositPage
+ amount={amount}
onCancel={(currency: string) => {
redirectTo(Pages.balanceHistory({ currency }));
}}
diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/index.ts
b/packages/taler-wallet-webextension/src/wallet/DepositPage/index.ts
index 6de406400..838739ad1 100644
--- a/packages/taler-wallet-webextension/src/wallet/DepositPage/index.ts
+++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/index.ts
@@ -35,7 +35,6 @@ import {
export interface Props {
amount?: string;
- currency?: string;
onCancel: (currency: string) => void;
onSuccess: (currency: string) => void;
}
diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts
b/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts
index 935adf012..1b628047a 100644
--- a/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts
+++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts
@@ -33,7 +33,6 @@ import { Props, State } from "./index.js";
export function useComponentState({
amount: amountStr,
- currency: currencyStr,
onCancel,
onSuccess,
}: Props): State {
@@ -41,7 +40,7 @@ export function useComponentState({
const { i18n } = useTranslationContext();
const { pushAlertOnError } = useAlertContext();
const parsed = amountStr === undefined ? undefined :
Amounts.parse(amountStr);
- const currency = parsed !== undefined ? parsed.currency : currencyStr;
+ const currency = parsed !== undefined ? parsed.currency : undefined;
const hook = useAsyncAsHook(async () => {
const { balances } = await api.wallet.call(
diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts
b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts
index 0054ab5af..42b76cf50 100644
--- a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts
+++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts
@@ -34,6 +34,7 @@ import { createWalletApiMock } from "../../test-utils.js";
import { useComponentState } from "./state.js";
const currency = "EUR";
+const amount = `${currency}:0`;
const withoutFee = (): DepositGroupFees => ({
coin: Amounts.stringify(`${currency}:0`),
wire: Amounts.stringify(`${currency}:0`),
@@ -49,7 +50,7 @@ const withSomeFee = (): DepositGroupFees => ({
describe("DepositPage states", () => {
it("should have status 'no-enough-balance' when balance is empty", async ()
=> {
const { handler, TestingContext } = createWalletApiMock();
- const props = { currency, onCancel: nullFunction, onSuccess: nullFunction
};
+ const props = { amount, onCancel: nullFunction, onSuccess: nullFunction };
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
@@ -90,7 +91,7 @@ describe("DepositPage states", () => {
it("should have status 'no-accounts' when balance is not empty and accounts
is empty", async () => {
const { handler, TestingContext } = createWalletApiMock();
- const props = { currency, onCancel: nullFunction, onSuccess: nullFunction
};
+ const props = { amount, onCancel: nullFunction, onSuccess: nullFunction };
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
@@ -144,7 +145,7 @@ describe("DepositPage states", () => {
it("should have status 'ready' but unable to deposit ", async () => {
const { handler, TestingContext } = createWalletApiMock();
- const props = { currency, onCancel: nullFunction, onSuccess: nullFunction
};
+ const props = { amount, onCancel: nullFunction, onSuccess: nullFunction };
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
@@ -198,7 +199,7 @@ describe("DepositPage states", () => {
it("should not be able to deposit more than the balance ", async () => {
const { handler, TestingContext } = createWalletApiMock();
- const props = { currency, onCancel: nullFunction, onSuccess: nullFunction
};
+ const props = { amount, onCancel: nullFunction, onSuccess: nullFunction };
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
@@ -273,7 +274,7 @@ describe("DepositPage states", () => {
it("should calculate the fee upon entering amount ", async () => {
const { handler, TestingContext } = createWalletApiMock();
- const props = { currency, onCancel: nullFunction, onSuccess: nullFunction
};
+ const props = { amount, onCancel: nullFunction, onSuccess: nullFunction };
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: fix deposit navigation,
gnunet <=