[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fixed width for popup, fixed
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fixed width for popup, fixed url redirect on manual taler link lookup, fixed uncontrolled checkbox handling |
Date: |
Thu, 20 May 2021 21:58:40 +0200 |
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 f0ab1449 fixed width for popup, fixed url redirect on manual taler
link lookup, fixed uncontrolled checkbox handling
f0ab1449 is described below
commit f0ab1449c56b23442beea57e6fd639cf584ec74a
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Thu May 20 16:58:22 2021 -0300
fixed width for popup, fixed url redirect on manual taler link lookup,
fixed uncontrolled checkbox handling
---
.../taler-wallet-webextension/src/pages/popup.tsx | 19 +++++++++----------
.../taler-wallet-webextension/src/pages/welcome.tsx | 21 ++++++++++++++-------
2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/packages/taler-wallet-webextension/src/pages/popup.tsx
b/packages/taler-wallet-webextension/src/pages/popup.tsx
index afd331c8..c361f4d9 100644
--- a/packages/taler-wallet-webextension/src/pages/popup.tsx
+++ b/packages/taler-wallet-webextension/src/pages/popup.tsx
@@ -24,7 +24,7 @@
/**
* Imports.
*/
- import {
+import {
AmountJson,
Amounts,
BalancesResponse,
@@ -66,7 +66,6 @@ function Tab(props: TabProps): JSX.Element {
}
function WalletNavBar({ current }: { current?: string }) {
-
return (
<div className="nav" id="header">
<Tab target="/popup/balance" current={current}>{i18n.str`Balance`}</Tab>
@@ -502,19 +501,19 @@ function actionForTalerUri(talerUri: string): string |
undefined {
const uriType = classifyTalerUri(talerUri);
switch (uriType) {
case TalerUriType.TalerWithdraw:
- return makeExtensionUrlWithParams("static/withdraw.html", {
+ return makeExtensionUrlWithParams("static/popup.html#/withdraw", {
talerWithdrawUri: talerUri,
});
case TalerUriType.TalerPay:
- return makeExtensionUrlWithParams("static/pay.html", {
+ return makeExtensionUrlWithParams("static/popup.html#/pay", {
talerPayUri: talerUri,
});
case TalerUriType.TalerTip:
- return makeExtensionUrlWithParams("static/tip.html", {
+ return makeExtensionUrlWithParams("static/popup.html#/tip", {
talerTipUri: talerUri,
});
case TalerUriType.TalerRefund:
- return makeExtensionUrlWithParams("static/refund.html", {
+ return makeExtensionUrlWithParams("static/popup.html#/refund", {
talerRefundUri: talerUri,
});
case TalerUriType.TalerNotifyReserve:
@@ -535,7 +534,7 @@ async function findTalerUriInActiveTab(): Promise<string |
undefined> {
{
code: `
(() => {
- let x = document.querySelector("a[href^='taler://'");
+ let x = document.querySelector("a[href^='taler://'") ||
document.querySelector("a[href^='taler+http://'");
return x ? x.href.toString() : null;
})();
`,
@@ -568,10 +567,10 @@ export function WalletPopup(): JSX.Element {
}
}
check();
- });
+ }, []);
if (talerActionUrl && !dismissed) {
return (
- <div style={{ padding: "1em" }}>
+ <div style={{ padding: "1em", width: 400 }}>
<h1>Taler Action</h1>
<p>This page has a Taler action. </p>
<p>
@@ -592,7 +591,7 @@ export function WalletPopup(): JSX.Element {
return (
<div>
<Match>{({ path }: any) => <WalletNavBar current={path} />}</Match>
- <div style={{ margin: "1em" }}>
+ <div style={{ margin: "1em", width: 400 }}>
<Router>
<Route path={Pages.balance} component={WalletBalanceView} />
<Route path={Pages.settings} component={WalletSettings} />
diff --git a/packages/taler-wallet-webextension/src/pages/welcome.tsx
b/packages/taler-wallet-webextension/src/pages/welcome.tsx
index 61c9f036..1ea0f6a0 100644
--- a/packages/taler-wallet-webextension/src/pages/welcome.tsx
+++ b/packages/taler-wallet-webextension/src/pages/welcome.tsx
@@ -20,14 +20,14 @@
* @author Florian Dold
*/
-import { useState, useEffect } from "preact/hooks";
+import { useState, useEffect, useMemo, useCallback } from "preact/hooks";
import { getDiagnostics } from "../wxApi";
import { PageLink } from "../renderHtml";
import * as wxApi from "../wxApi";
import { getPermissionsApi } from "../compat";
import { extendedPermissions } from "../permissions";
import { WalletDiagnostics } from "@gnu-taler/taler-util";
-import { JSX } from "preact/jsx-runtime";
+import { Fragment, JSX } from "preact/jsx-runtime";
function Diagnostics(): JSX.Element | null {
const [timedOut, setTimedOut] = useState(false);
@@ -100,7 +100,7 @@ function Diagnostics(): JSX.Element | null {
}
-async function handleExtendedPerm(isEnabled: boolean, setEnable: (v:boolean)
=> void): Promise<void> {
+async function handleExtendedPerm(isEnabled: boolean): Promise<boolean> {
let nextVal: boolean | undefined;
if (!isEnabled) {
@@ -124,26 +124,33 @@ async function handleExtendedPerm(isEnabled: boolean,
setEnable: (v:boolean) =>
const res = await wxApi.setExtendedPermissions(false);
nextVal = res.newValue;
}
- console.log("new permissions applied:", nextVal);
- setEnable(nextVal ?? false);
+ console.log("new permissions applied:", nextVal ?? false);
+ return nextVal ?? false
}
export function PermissionsCheckbox(): JSX.Element {
const [extendedPermissionsEnabled, setExtendedPermissionsEnabled] =
useState(false);
+ const togglePermission = () => {
+ setExtendedPermissionsEnabled(v => !v)
+ handleExtendedPerm(extendedPermissionsEnabled).then( result => {
+ setExtendedPermissionsEnabled(result)
+ } )
+ }
+
useEffect(() => {
async function getExtendedPermValue(): Promise<void> {
const res = await wxApi.getExtendedPermissions();
setExtendedPermissionsEnabled(res.newValue);
}
getExtendedPermValue();
- });
+ },[]);
return (
<div>
<input
checked={extendedPermissionsEnabled}
- onChange={() => handleExtendedPerm(extendedPermissionsEnabled,
setExtendedPermissionsEnabled) }
+ onClick={togglePermission}
type="checkbox"
id="checkbox-perm"
style={{ width: "1.5em", height: "1.5em", verticalAlign: "middle" }}
--
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: fixed width for popup, fixed url redirect on manual taler link lookup, fixed uncontrolled checkbox handling,
gnunet <=