diff options
author | Sebastian <sebasjm@gmail.com> | 2023-09-29 16:02:15 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-09-29 16:02:15 -0300 |
commit | 1708d49a2d5da1f325173a030695223e5a24e75c (patch) | |
tree | 048995ac199c171e34fd7d99678c9699fe3321fc /packages/demobank-ui/src/pages/admin/AccountForm.tsx | |
parent | c10f3f3aded637111176487f95403294b1164633 (diff) | |
download | wallet-core-1708d49a2d5da1f325173a030695223e5a24e75c.tar.xz |
more ui
Diffstat (limited to 'packages/demobank-ui/src/pages/admin/AccountForm.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/admin/AccountForm.tsx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/packages/demobank-ui/src/pages/admin/AccountForm.tsx b/packages/demobank-ui/src/pages/admin/AccountForm.tsx index 02df824a2..ed8bf610d 100644 --- a/packages/demobank-ui/src/pages/admin/AccountForm.tsx +++ b/packages/demobank-ui/src/pages/admin/AccountForm.tsx @@ -4,6 +4,7 @@ import { PartialButDefined, RecursivePartial, WithIntermediate, undefinedIfEmpty import { useEffect, useRef, useState } from "preact/hooks"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { buildPayto, parsePaytoUri } from "@gnu-taler/taler-util"; +import { doAutoFocus } from "../PaytoWireTransferForm.js"; const IBAN_REGEX = /^[A-Z][A-Z0-9]*$/; const EMAIL_REGEX = @@ -37,10 +38,6 @@ export function AccountForm({ RecursivePartial<typeof initial> | undefined >(undefined); const { i18n } = useTranslationContext(); - const ref = useRef<HTMLInputElement>(null); - useEffect(() => { - if (focus) ref.current?.focus(); - }, [focus]); function updateForm(newForm: typeof initial): void { @@ -97,7 +94,6 @@ export function AccountForm({ <div class="px-4 py-6 sm:p-8"> <div class="grid max-w-2xl grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> - <div class="sm:col-span-5"> <label class="block text-sm font-medium leading-6 text-gray-900" @@ -108,7 +104,7 @@ export function AccountForm({ </label> <div class="mt-2"> <input - ref={ref} + ref={focus ? doAutoFocus : undefined} type="text" class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" name="username" |