diff --git a/src/components/DataDimension/Info/DataElementInfo.js b/src/components/DataDimension/Info/DataElementInfo.js index ae2a129e3..e420ca284 100644 --- a/src/components/DataDimension/Info/DataElementInfo.js +++ b/src/components/DataDimension/Info/DataElementInfo.js @@ -2,7 +2,7 @@ import { useDataQuery } from '@dhis2/app-runtime' import PropTypes from 'prop-types' import React from 'react' import i18n from '../../../locales/index.js' -import { getCommonFields, InfoTable } from './InfoTable.js' +import { capitalizeWord, getCommonFields, InfoTable } from './InfoTable.js' import styles from './styles/InfoPopover.style.js' const dataElementQuery = { @@ -51,7 +51,7 @@ export const DataElementInfo = ({ id, displayNameProp }) => { {i18n.t('Value type')} - {data?.dataElement.valueType} + {capitalizeWord(data?.dataElement.valueType)} {i18n.t('Aggregation type')} diff --git a/src/components/DataDimension/Info/EventDataItemInfo.js b/src/components/DataDimension/Info/EventDataItemInfo.js index 7d9e3b2a1..449aff6c8 100644 --- a/src/components/DataDimension/Info/EventDataItemInfo.js +++ b/src/components/DataDimension/Info/EventDataItemInfo.js @@ -3,7 +3,7 @@ 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 { getCommonFields, InfoTable } from './InfoTable.js' +import { capitalizeWord, getCommonFields, InfoTable } from './InfoTable.js' import styles from './styles/InfoPopover.style.js' const programDataElementQuery = { @@ -54,7 +54,7 @@ export const EventDataItemInfo = ({ type, id, displayNameProp }) => { {i18n.t('Value type')} - {data?.valueType} + {capitalizeWord(data?.valueType)} {data?.optionSet && ( diff --git a/src/components/DataDimension/Info/InfoTable.js b/src/components/DataDimension/Info/InfoTable.js index 6e437225d..ee9d9fc74 100644 --- a/src/components/DataDimension/Info/InfoTable.js +++ b/src/components/DataDimension/Info/InfoTable.js @@ -9,6 +9,9 @@ import styles from './styles/InfoPopover.style.js' export const getCommonFields = (displayNameProp) => `attributeValues[id,displayName],code,created,createdBy,${displayNameProp}~rename(displayName),displayDescription,href,id,lastUpdated` +export const capitalizeWord = (word) => + word && word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() + export const InfoTable = ({ data, error, loading, children }) => { const { fromServerDate } = useTimeZoneConversion()