summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/popup
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-02-18 16:54:15 -0300
committerSebastian <sebasjm@gmail.com>2022-02-18 16:55:38 -0300
commit606be7577be2bd249f19204d0c80b3b48e3065ca (patch)
tree1d3d72940cf590e1a643692046b43e2ac41354b3 /packages/taler-wallet-webextension/src/popup
parent2b2b8c160870d0c7e8fbcebca8b1ac157d93033b (diff)
downloadwallet-core-606be7577be2bd249f19204d0c80b3b48e3065ca.tar.gz
wallet-core-606be7577be2bd249f19204d0c80b3b48e3065ca.tar.bz2
wallet-core-606be7577be2bd249f19204d0c80b3b48e3065ca.zip
some fixes
-fix fulfillment messages -fix product list pricing and image on payment -filter exchange by currency on withdrawal -error message on operation error on withdrawal -add taler url on balance page (just for dev) -add no balance help -better text when doing manual withdraw for the firt time -removed balance from wallet (just history) -removed pending page
Diffstat (limited to 'packages/taler-wallet-webextension/src/popup')
-rw-r--r--packages/taler-wallet-webextension/src/popup/BalancePage.tsx32
-rw-r--r--packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx27
2 files changed, 41 insertions, 18 deletions
diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
index f5e721033..3ca5b3a02 100644
--- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
@@ -14,8 +14,9 @@
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 } from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact";
+import { useState } from "preact/hooks";
import { BalanceTable } from "../components/BalanceTable";
import { JustInDevMode } from "../components/JustInDevMode";
import { Loading } from "../components/Loading";
@@ -23,8 +24,9 @@ import { LoadingError } from "../components/LoadingError";
import { MultiActionButton } from "../components/MultiActionButton";
import { ButtonBoxPrimary, ButtonPrimary } from "../components/styled";
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
-import { PageLink } from "../renderHtml";
+import { AddNewActionView } from "../wallet/AddNewActionView";
import * as wxApi from "../wxApi";
+import { NoBalanceHelp } from "./NoBalanceHelp";
interface Props {
goToWalletDeposit: (currency: string) => void;
@@ -36,6 +38,7 @@ export function BalancePage({
goToWalletDeposit,
goToWalletHistory,
}: Props): VNode {
+ const [addingAction, setAddingAction] = useState(false);
const state = useAsyncAsHook(wxApi.getBalance);
const balances = !state || state.hasError ? [] : state.response.balances;
@@ -47,18 +50,24 @@ export function BalancePage({
return <LoadingError title="Could not load balance page" error={state} />;
}
+ if (addingAction) {
+ return <AddNewActionView onCancel={() => setAddingAction(false)} />;
+ }
+
return (
<BalanceView
balances={balances}
goToWalletManualWithdraw={goToWalletManualWithdraw}
goToWalletDeposit={goToWalletDeposit}
goToWalletHistory={goToWalletHistory}
+ goToAddAction={() => setAddingAction(true)}
/>
);
}
export interface BalanceViewProps {
balances: Balance[];
goToWalletManualWithdraw: () => void;
+ goToAddAction: () => void;
goToWalletDeposit: (currency: string) => void;
goToWalletHistory: (currency: string) => void;
}
@@ -68,6 +77,7 @@ export function BalanceView({
goToWalletManualWithdraw,
goToWalletDeposit,
goToWalletHistory,
+ goToAddAction,
}: BalanceViewProps): VNode {
const currencyWithNonZeroAmount = balances
.filter((b) => !Amounts.isZero(b.available))
@@ -75,21 +85,7 @@ export function BalanceView({
if (balances.length === 0) {
return (
- <Fragment>
- <p>
- <i18n.Translate>
- You have no balance to show.
- <a href="https://demo.taler.net/" style={{ display: "block" }}>
- Learn how to top up your wallet balance ยป
- </a>
- </i18n.Translate>
- </p>
- <footer style={{ justifyContent: "space-between" }}>
- <ButtonPrimary onClick={goToWalletManualWithdraw}>
- Withdraw
- </ButtonPrimary>
- </footer>
- </Fragment>
+ <NoBalanceHelp goToWalletManualWithdraw={goToWalletManualWithdraw} />
);
}
@@ -113,7 +109,7 @@ export function BalanceView({
/>
)}
<JustInDevMode>
- <ButtonBoxPrimary onClick={() => null}>enter uri</ButtonBoxPrimary>
+ <ButtonBoxPrimary onClick={goToAddAction}>enter uri</ButtonBoxPrimary>
</JustInDevMode>
</footer>
</Fragment>
diff --git a/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx b/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx
new file mode 100644
index 000000000..baff0aadf
--- /dev/null
+++ b/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx
@@ -0,0 +1,27 @@
+import { i18n } from "@gnu-taler/taler-util";
+import { h, VNode } from "preact";
+import { ButtonBoxWarning, WarningBox } from "../components/styled";
+
+export function NoBalanceHelp({
+ goToWalletManualWithdraw,
+}: {
+ goToWalletManualWithdraw: () => void;
+}): VNode {
+ return (
+ <WarningBox>
+ <p>
+ <b>
+ <i18n.Translate>You have no balance to show.</i18n.Translate>
+ </b>
+ <br />
+ <i18n.Translate>
+ To withdraw money you can start from your bank site or click the
+ "withdraw" button to use a known exchange.
+ </i18n.Translate>
+ </p>
+ <ButtonBoxWarning onClick={() => goToWalletManualWithdraw()}>
+ Withdraw
+ </ButtonBoxWarning>
+ </WarningBox>
+ );
+}