From c69af122958c85494e4e06ec1f4c62fdd4b8e73e Mon Sep 17 00:00:00 2001 From: No-Cash-7970 Date: Mon, 6 Nov 2023 19:56:28 -0800 Subject: [PATCH] perf(compose_txn): replace `
`s with field sets It is best to use a field set to create sections in a form because it improve accessibility (a type of performance improvement) --- .../components/fields/AppCallFields.tsx | 67 +++++++++---------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/src/app/[lang]/txn/compose/components/fields/AppCallFields.tsx b/src/app/[lang]/txn/compose/components/fields/AppCallFields.tsx index e47a5c7..d52469f 100644 --- a/src/app/[lang]/txn/compose/components/fields/AppCallFields.tsx +++ b/src/app/[lang]/txn/compose/components/fields/AppCallFields.tsx @@ -1,6 +1,12 @@ /** Fields for the compose-transaction form that are for application call transaction */ -import { NumberField, TextField, SelectField, TextAreaField } from '@/app/[lang]/components/form'; +import { + NumberField, + TextField, + SelectField, + TextAreaField, + FieldGroup, +} from '@/app/[lang]/components/form'; import { type TFunction } from 'i18next'; import { PrimitiveAtom, useAtom, useAtomValue } from 'jotai'; import * as Icons from '@tabler/icons-react'; @@ -60,9 +66,7 @@ export function AppId({ t }: { t: TFunction }) { export function AppArgs({ t }: { t: TFunction }) { const [appArgs, dispatch] = useAtom(txnDataAtoms.apaa); return ( -
-

{t('fields.apaa.title')}

- +
{t('fields.apaa.no_abi_support')}
{!appArgs.length &&

{t('fields.apaa.none')}

} @@ -89,7 +93,7 @@ export function AppArgs({ t }: { t: TFunction }) { {t('fields.apaa.remove_btn')} -
+ ); } function AppArgInput({ t, argAtom, index }: @@ -260,28 +264,24 @@ export function AppProperties({ t }: { t: TFunction }) { (onComplete === OnApplicationComplete.NoOpOC && !appId) || onComplete === OnApplicationComplete.UpdateApplicationOC // updating app ) && -
-

{t('fields.app_props_title')}

+ {// Creating app onComplete === OnApplicationComplete.NoOpOC && <> -
-

{t('fields.global_state_title')}

+ -
-
-

{t('fields.local_state_title')}

+ + -
-
-

{t('fields.extra_pages_title')}

+ + -
+
} -
+ ); } @@ -470,11 +470,13 @@ function Boxes({ t }: { t: TFunction }) { {boxes.map( (boxAtom, i) => -
-

{t('fields.apbx.box_title', { index: i + 1 })}

+ -
+ )}
@@ -540,24 +542,19 @@ function BoxNameInput({ t, boxAtom, index }: export function AppDependencies({ t }: { t: TFunction }) { return ( -
-

{t('fields.app_deps_title')}

-
-

{t('fields.apat.title')}

+ + -
-
-

{t('fields.apfa.title')}

+ + -
-
-

{t('fields.apas.title')}

+ + -
-
-

{t('fields.apbx.title')}

+ + -
-
+ + ); }