From 955b957ef6d7d27d444d363cf80ea8942233f97c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 13 Jun 2024 13:02:53 -0300 Subject: simplify instance creation --- .../src/paths/admin/create/CreatePage.tsx | 41 +++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/paths/admin') diff --git a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx index a28992a2f..6a94109a0 100644 --- a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx @@ -25,7 +25,7 @@ import { createRFC8959AccessTokenPlain, } from "@gnu-taler/taler-util"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; -import { h, VNode } from "preact"; +import { VNode, h } from "preact"; import { useState } from "preact/hooks"; import { AsyncButton } from "../../../components/exception/AsyncButton.js"; import { @@ -34,6 +34,7 @@ import { } from "../../../components/form/FormProvider.js"; import { DefaultInstanceFormFields } from "../../../components/instance/DefaultInstanceFormFields.js"; import { SetTokenNewInstanceModal } from "../../../components/modal/index.js"; +import { usePreference } from "../../../hooks/preference.js"; import { INSTANCE_ID_REGEX } from "../../../utils/constants.js"; import { undefinedIfEmpty } from "../../../utils/table.js"; @@ -64,13 +65,13 @@ function with_defaults(id?: string): Partial { } export function CreatePage({ onCreate, onBack, forceId }: Props): VNode { + const [pref, updatePref] = usePreference(); + const { i18n } = useTranslationContext(); const [value, valueHandler] = useState(with_defaults(forceId)); const [isTokenSet, updateIsTokenSet] = useState(false); const [isTokenDialogActive, updateIsTokenDialogActive] = useState(false); - const { i18n } = useTranslationContext(); - const errors: FormErrors = { id: !value.id ? i18n.str`required` @@ -186,6 +187,34 @@ export function CreatePage({ onCreate, onBack, forceId }: Props): VNode {
+
+ +
{" "}
@@ -194,7 +223,11 @@ export function CreatePage({ onCreate, onBack, forceId }: Props): VNode { object={value} valueHandler={valueHandler} > - +
-- cgit v1.2.3