Skip to content

Commit

Permalink
refactor: move description out of identifiable
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Feb 29, 2024
1 parent 0991494 commit cff43ba
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
5 changes: 0 additions & 5 deletions src/components/formFields/DefaultIdentifibleFIelds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import { useSchemaSectionHandleOrThrow } from '../../lib'
import { StandardFormField } from '../standardForm'
import { CodeField } from './CodeField'
import { DescriptionField } from './DescriptionField'
import { NameField } from './NameField'
import { ShortNameField } from './ShortNameField'

Expand All @@ -22,10 +21,6 @@ export const DefaultIdentifiableFields = () => {
<StandardFormField>
<CodeField schemaSection={schemaSection} />
</StandardFormField>

<StandardFormField>
<DescriptionField schemaSection={schemaSection} />
</StandardFormField>
</>
)
}
5 changes: 1 addition & 4 deletions src/components/formFields/DescriptionField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ export function DescriptionField({
const validate = useCheckMaxLengthFromSchema(schemaSection.name, 'formName')

const helpString =
helpText ||
i18n.t(
"Explain the purpose of this data element and how it's measured."
)
helpText || i18n.t("Explain the purpose of this and how it's measured.")

return (
<FieldRFF
Expand Down
17 changes: 16 additions & 1 deletion src/pages/dataElementGroups/form/DataElementGroupFormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ import {
StandardFormSectionDescription,
StandardFormField,
} from '../../../components'
import { DefaultIdentifiableFields } from '../../../components/formFields'
import {
DefaultIdentifiableFields,
DescriptionField,
} from '../../../components/formFields'
import { SCHEMA_SECTIONS } from '../../../lib'
import { DataElementsField } from '../fields'

const schemaSection = SCHEMA_SECTIONS.dataElementGroup

export function DataElementGroupFormFields() {
return (
<>
Expand All @@ -24,6 +30,15 @@ export function DataElementGroupFormFields() {
</StandardFormSectionDescription>

<DefaultIdentifiableFields />

<StandardFormField>
<DescriptionField
schemaSection={schemaSection}
helpText={i18n.t(
'Explain the purpose of this data element group.'
)}
/>
</StandardFormField>
</StandardFormSection>

<StandardFormSection>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/dataElements/fields/FormNameField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { InputFieldFF } from '@dhis2/ui'
import React from 'react'
import { Field as FieldRFF } from 'react-final-form'
import { useCheckMaxLengthFromSchema } from '../../../lib'
import type { SchemaName } from '../../../types'
import { SchemaName } from '../../../types'

export function FormNameField() {
const validate = useCheckMaxLengthFromSchema(
'dataElement' as SchemaName,
SchemaName.dataElement,
'formName'
)

Expand All @@ -17,7 +17,7 @@ export function FormNameField() {
dataTest="dataelementsformfields-formname"
inputWidth="400px"
name="formName"
label={i18n.t('StandardForm name')}
label={i18n.t('Form name')}
helpText={i18n.t(
'An alternative name used in section or automatic data entry forms.'
)}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/dataElements/form/DataElementFormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ export function DataElementFormFields() {
</StandardFormField>

<StandardFormField>
<DescriptionField schemaSection={schemaSection} />
<DescriptionField
helpText={i18n.t(
'Explain the purpose of this data element.'
)}
schemaSection={schemaSection}
/>
</StandardFormField>

<StandardFormField>
Expand Down

0 comments on commit cff43ba

Please sign in to comment.