diff --git a/web/src/components/config-form/theme/templates/FieldTemplate.tsx b/web/src/components/config-form/theme/templates/FieldTemplate.tsx index c651a2cda..c577c13c0 100644 --- a/web/src/components/config-form/theme/templates/FieldTemplate.tsx +++ b/web/src/components/config-form/theme/templates/FieldTemplate.tsx @@ -70,6 +70,20 @@ function humanizeKey(value: string): string { .join(" "); } +function _isArrayItemInAdditionalProperty( + pathSegments: Array, +): boolean { + // // If we find a numeric index, this is an array item + for (let i = 0; i < pathSegments.length; i++) { + const segment = pathSegments[i]; + if (typeof segment === "number") { + // Consider any array item as being inside additional properties if it's not at the root level + return i > 0; + } + } + return false; +} + type FieldRenderSpec = | ReactNode | ComponentType @@ -147,6 +161,19 @@ export function FieldTemplate(props: FieldTemplateProps) { const pathSegments = fieldPathId.path.filter( (segment): segment is string => typeof segment === "string", ); + + // Check if this is an array item inside an object with additionalProperties + const isArrayItemInAdditionalProp = _isArrayItemInAdditionalProperty( + fieldPathId.path, + ); + + // Conditions for showing descriptions/docs links + const shouldShowDescription = + !isMultiSchemaWrapper && + !isObjectField && + !isAdditionalProperty && + !isArrayItemInAdditionalProp; + const translationPath = buildTranslationPath(pathSegments, sectionI18nPrefix); const filterObjectLabel = getFilterObjectLabel(pathSegments); const translatedFilterObjectLabel = filterObjectLabel @@ -402,48 +429,12 @@ export function FieldTemplate(props: FieldTemplateProps) { )} )} - {finalDescription && - !isMultiSchemaWrapper && - !isAdditionalProperty && ( -

- {finalDescription} -

- )} - {fieldDocsUrl && - !isMultiSchemaWrapper && - !isObjectField && - !isAdditionalProperty && ( -
- - {t("readTheDocumentation", { ns: "common" })} - - -
- )} - -
{children}
- - ) : ( - <> - {children} - - {finalDescription && - !isMultiSchemaWrapper && - !isObjectField && - !isAdditionalProperty && ( + {finalDescription && shouldShowDescription && (

{finalDescription}

)} - {fieldDocsUrl && - !isMultiSchemaWrapper && - !isObjectField && - !isAdditionalProperty && ( + {fieldDocsUrl && shouldShowDescription && (
)} + +
{children}
+ + ) : ( + <> + {children} + + {finalDescription && shouldShowDescription && ( +

+ {finalDescription} +

+ )} + {fieldDocsUrl && shouldShowDescription && ( +
+ + {t("readTheDocumentation", { ns: "common" })} + + +
+ )} )} diff --git a/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx b/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx index 258c3e325..b491057cf 100644 --- a/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx +++ b/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx @@ -220,11 +220,11 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) { return (
{groups.map((group) => ( -
+
{group.label}
-
+
{group.items.map((element) => (
{element.content}
))} @@ -233,7 +233,7 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) { ))} {ungrouped.length > 0 && ( -
0 && "pt-2")}> +
0 && "pt-2")}> {ungrouped.map((element) => (
{element.content}
))} diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx index 766cfd72a..0689c88cb 100644 --- a/web/src/pages/Settings.tsx +++ b/web/src/pages/Settings.tsx @@ -341,6 +341,7 @@ const settingsGroups = [ key: "integrationObjectClassification", component: IntegrationObjectClassificationSettingsPage, }, + { key: "triggers", component: TriggerView }, { key: "integrationAudioTranscription", component: IntegrationAudioTranscriptionSettingsPage, @@ -387,10 +388,7 @@ const settingsGroups = [ }, { label: "notifications", - items: [ - { key: "notifications", component: NotificationView }, - { key: "triggers", component: TriggerView }, - ], + items: [{ key: "notifications", component: NotificationView }], }, { label: "frigateplus",