Skip to content

Commit

Permalink
Advanced expression editor: show attribute name instead of label (#3018)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Ricci <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 18, 2023
1 parent 475539e commit 41a2415
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions webapp/components/expression/expressionEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import PropTypes from 'prop-types'
import * as R from 'ramda'

import * as Expression from '@core/expressionParser/expression'
import * as Survey from '@core/survey/survey'
import * as NodeDef from '@core/survey/nodeDef'
import { TestId } from '@webapp/utils/testId'
import { useI18n } from '@webapp/store/system'

import ExpressionEditorPopup from './expressionEditorPopup'
import { ExpressionEditorType } from './expressionEditorType'
import { useSurvey, useSurveyPreferredLang } from '@webapp/store/survey'
import { useNodeDefByUuid } from '@webapp/store/survey'
import { Button } from '../buttons'

const ExpressionEditor = (props) => {
Expand All @@ -33,8 +32,7 @@ const ExpressionEditor = (props) => {
} = props

const i18n = useI18n()
const survey = useSurvey()
const lang = useSurveyPreferredLang()
const nodeDefCurrent = useNodeDefByUuid(nodeDefUuidCurrent)

const [edit, setEdit] = useState(false)

Expand All @@ -54,11 +52,10 @@ const ExpressionEditor = (props) => {
const idPrefix = `expression-editor-${placeholder ? 'placeholder' : index}-${qualifier}`

const qualifierLabel = i18n.t(`expressionEditor.qualifier.${qualifier}`)
const nodeDefCurrent = Survey.getNodeDefByUuid(nodeDefUuidCurrent)(survey)
const popupHeader = nodeDefCurrent
? i18n.t('expressionEditor.header.editingExpressionForNodeDefinition', {
qualifier: qualifierLabel,
nodeDef: NodeDef.getLabel(nodeDefCurrent, lang),
nodeDef: NodeDef.getName(nodeDefCurrent),
})
: null

Expand Down

0 comments on commit 41a2415

Please sign in to comment.