Skip to content

Commit

Permalink
refactor: use translated names for value type
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Nov 29, 2024
1 parent 4979e0b commit 915e51f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/components/DataDimension/Info/DataElementInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useDataQuery } from '@dhis2/app-runtime'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../../locales/index.js'
import { capitalizeText, getCommonFields, InfoTable } from './InfoTable.js'
import { valueTypeDisplayNames } from '../../../modules/valueTypes.js'
import { getCommonFields, InfoTable } from './InfoTable.js'
import styles from './styles/InfoPopover.style.js'

const dataElementQuery = {
Expand Down Expand Up @@ -54,7 +55,9 @@ export const DataElementInfo = ({ id, displayNameProp }) => {
</tr>
<tr>
<th>{i18n.t('Value type')}</th>
<td>{capitalizeText(data?.dataElement.valueType)}</td>
<td>
{valueTypeDisplayNames[data?.dataElement.valueType]}
</td>
</tr>
<tr>
<th>{i18n.t('Aggregation type')}</th>
Expand Down
11 changes: 7 additions & 4 deletions src/components/DataDimension/Info/DataElementOperandInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useConfig, useDataEngine } from '@dhis2/app-runtime'
import PropTypes from 'prop-types'
import React, { useCallback, useEffect, useState } from 'react'
import i18n from '../../../locales/index.js'
import { capitalizeText, getCommonFields, InfoTable } from './InfoTable.js'
import { valueTypeDisplayNames } from '../../../modules/valueTypes.js'
import { getCommonFields, InfoTable } from './InfoTable.js'
import styles from './styles/InfoPopover.style.js'

const dataElementOperandsQuery = {
Expand Down Expand Up @@ -108,9 +109,11 @@ export const DataElementOperandInfo = ({ id, displayNameProp }) => {
<tr>
<th>{i18n.t('Value type')}</th>
<td>
{capitalizeText(
data?.dataElementOperand.dataElement.valueType
)}
{
valueTypeDisplayNames[
data?.dataElementOperand.dataElement.valueType
]
}
</td>
</tr>
<tr>
Expand Down
5 changes: 3 additions & 2 deletions src/components/DataDimension/Info/EventDataItemInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../../locales/index.js'
import { DIMENSION_TYPE_PROGRAM_DATA_ELEMENT } from '../../../modules/dataTypes.js'
import { capitalizeText, getCommonFields, InfoTable } from './InfoTable.js'
import { valueTypeDisplayNames } from '../../../modules/valueTypes.js'
import { getCommonFields, InfoTable } from './InfoTable.js'
import styles from './styles/InfoPopover.style.js'

const programDataElementQuery = {
Expand Down Expand Up @@ -54,7 +55,7 @@ export const EventDataItemInfo = ({ type, id, displayNameProp }) => {
</tr>
<tr>
<th>{i18n.t('Value type')}</th>
<td>{capitalizeText(data?.valueType)}</td>
<td>{valueTypeDisplayNames[data?.valueType]}</td>
</tr>
{data?.optionSet && (
<tr>
Expand Down

0 comments on commit 915e51f

Please sign in to comment.