Skip to content

Commit

Permalink
fix: capitalize valueType
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Nov 11, 2024
1 parent d677cde commit 3edb797
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/DataDimension/Info/DataElementInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -51,7 +51,7 @@ export const DataElementInfo = ({ id, displayNameProp }) => {
</tr>
<tr>
<th>{i18n.t('Value type')}</th>
<td>{data?.dataElement.valueType}</td>
<td>{capitalizeWord(data?.dataElement.valueType)}</td>
</tr>
<tr>
<th>{i18n.t('Aggregation type')}</th>
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataDimension/Info/EventDataItemInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -54,7 +54,7 @@ export const EventDataItemInfo = ({ type, id, displayNameProp }) => {
</tr>
<tr>
<th>{i18n.t('Value type')}</th>
<td>{data?.valueType}</td>
<td>{capitalizeWord(data?.valueType)}</td>
</tr>
{data?.optionSet && (
<tr>
Expand Down
3 changes: 3 additions & 0 deletions src/components/DataDimension/Info/InfoTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 3edb797

Please sign in to comment.