diff --git a/app/data/jsonSchemaForm/projectEmissionIntensitySchema.ts b/app/data/jsonSchemaForm/projectEmissionIntensitySchema.ts index 6ef61fd24c..4af330f4bd 100644 --- a/app/data/jsonSchemaForm/projectEmissionIntensitySchema.ts +++ b/app/data/jsonSchemaForm/projectEmissionIntensitySchema.ts @@ -95,6 +95,7 @@ export const emissionIntensityReportUiSchema = { calculatedGHGEmissionIntensityPerformance: { "ui:widget": "ReadOnlyCalculatedValueWidget", isPercent: true, + hideOptional: true, }, adjustedGHGEmissionIntensityPerformance: { "ui:widget": "AdjustableCalculatedValueWidget", diff --git a/app/lib/theme/FieldTemplate.tsx b/app/lib/theme/FieldTemplate.tsx index 44afc82301..828131445d 100644 --- a/app/lib/theme/FieldTemplate.tsx +++ b/app/lib/theme/FieldTemplate.tsx @@ -12,11 +12,17 @@ const FieldTemplate: React.FC = ({ displayLabel, required, id, + uiSchema, }) => { return (
{displayLabel && ( - + )} {help} {children} diff --git a/app/lib/theme/widgets/FieldLabel.tsx b/app/lib/theme/widgets/FieldLabel.tsx index 294e49e207..bb6868aa06 100644 --- a/app/lib/theme/widgets/FieldLabel.tsx +++ b/app/lib/theme/widgets/FieldLabel.tsx @@ -3,6 +3,7 @@ interface Props { required: boolean; htmlFor: string; tagName?: "label" | "dt"; + uiSchema?: any; } const FieldLabel: React.FC = ({ @@ -10,15 +11,15 @@ const FieldLabel: React.FC = ({ required, htmlFor, tagName = "label", + uiSchema, }) => { if (!label) { return null; } - const displayedLabel = - label === "GHG Emission Intensity Performance" - ? "GHG Emission Intensity Performance" - : label + (required ? "" : " (optional)") + " "; + const displayedLabel = uiSchema?.hideOptional + ? label + : label + (required ? "" : " (optional)") + " "; if (tagName === "label") return ;