From 30f86f8748a0d9c23538e972d30270a4f1e83941 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 7 May 2021 10:38:28 -0300
Subject: migrate to preact

---
 packages/taler-wallet-webextension/src/pages/welcome.tsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/pages/welcome.tsx')

diff --git a/packages/taler-wallet-webextension/src/pages/welcome.tsx b/packages/taler-wallet-webextension/src/pages/welcome.tsx
index dd10ac13c..54819558c 100644
--- a/packages/taler-wallet-webextension/src/pages/welcome.tsx
+++ b/packages/taler-wallet-webextension/src/pages/welcome.tsx
@@ -20,13 +20,14 @@
  * @author Florian Dold
  */
 
-import React, { useState, useEffect } from "react";
+import { useState, useEffect } 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";
 
 function Diagnostics(): JSX.Element | null {
   const [timedOut, setTimedOut] = useState(false);
@@ -102,9 +103,9 @@ export function PermissionsCheckbox(): JSX.Element {
   const [extendedPermissionsEnabled, setExtendedPermissionsEnabled] = useState(
     false,
   );
-  async function handleExtendedPerm(requestedVal: boolean): Promise<void> {
+  async function handleExtendedPerm(): Promise<void> {
     let nextVal: boolean | undefined;
-    if (requestedVal) {
+    if (extendedPermissionsEnabled) {
       const granted = await new Promise<boolean>((resolve, reject) => {
         // We set permissions here, since apparently FF wants this to be done
         // as the result of an input event ...
@@ -141,7 +142,7 @@ export function PermissionsCheckbox(): JSX.Element {
     <div>
       <input
         checked={extendedPermissionsEnabled}
-        onChange={(x) => handleExtendedPerm(x.target.checked)}
+        onChange={() => handleExtendedPerm()}
         type="checkbox"
         id="checkbox-perm"
         style={{ width: "1.5em", height: "1.5em", verticalAlign: "middle" }}
-- 
cgit v1.2.3

