From fc5ad3edf74a2988c503d1abd01590c959042e9c Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 12 Feb 2026 12:03:56 -0600 Subject: [PATCH] clean up field template --- .../theme/templates/FieldTemplate.tsx | 420 ++++++++---------- .../theme/widgets/TimezoneSelectWidget.tsx | 6 +- 2 files changed, 190 insertions(+), 236 deletions(-) diff --git a/web/src/components/config-form/theme/templates/FieldTemplate.tsx b/web/src/components/config-form/theme/templates/FieldTemplate.tsx index 39915457d..d16b05a38 100644 --- a/web/src/components/config-form/theme/templates/FieldTemplate.tsx +++ b/web/src/components/config-form/theme/templates/FieldTemplate.tsx @@ -378,6 +378,190 @@ export function FieldTemplate(props: FieldTemplateProps) { uiOptions, ); + const shouldRenderStandardLabel = + displayLabel && + finalLabel && + !isBoolean && + !useSplitLayout && + !isMultiSchemaWrapper && + !isObjectField && + !isAdditionalProperty; + + const shouldRenderSplitLabel = + displayLabel && + finalLabel && + !isMultiSchemaWrapper && + !isObjectField && + !isAdditionalProperty; + + const shouldRenderBooleanLabel = displayLabel && finalLabel; + + const renderDocsLink = (className?: string) => { + if (!fieldDocsUrl || !shouldShowDescription) { + return null; + } + + return ( +
+ {finalDescription} +
+ ); + }; + + const renderStandardLabel = () => { + if (!shouldRenderStandardLabel) { + return null; + } + + return ( + + ); + }; + + const renderBooleanLabel = () => { + if (!shouldRenderBooleanLabel) { + return null; + } + + return ( + + ); + }; + + const renderSplitLabel = () => { + if (!shouldRenderSplitLabel) { + return null; + } + + return ( + + ); + }; + + const renderBooleanSplitLayout = () => ( + <> +- {finalDescription} -
- )} - {fieldDocsUrl && shouldShowDescription && ( -- {finalDescription} -
- )} - {fieldDocsUrl && shouldShowDescription && ( -- {finalDescription} -
- )} - {fieldDocsUrl && shouldShowDescription && ( -- {finalDescription} -
- )} - {fieldDocsUrl && shouldShowDescription && ( -- {finalDescription} -
- )} - {fieldDocsUrl && shouldShowDescription && ( -- {finalDescription} -
- )} - {fieldDocsUrl && shouldShowDescription && ( -