LF-3787 The common name for a crop should be displayed on the Crop Detailed page once changes are made#3667
Conversation
There was a problem hiding this comment.
This is a very interesting little UX issue which I didn't know about until taking a look at this ticket, thanks @den4ik1203!
It looks like there is some fundamental UX confusion in these forms, because the Jira ticket description and the linked bug both describe "editing the crop common name" when the form item in question is actually the crop variety common name.
I'm therefore not sure the right answer is showing the crop variety in the header (the use of the scientific name -- and also the name "Crop Header" for this component makes me think it was meant to stay fixed at crop) -- but I think we can take this to dev-design tomorrow; it will be an interesting discussion point there.
| <Back style={{ verticalAlign: 'text-bottom' }} /> | ||
| <Title className={clsx(styles.headerTitle, styles.textOverFlowBehaviour)}> | ||
| {t(`crop:${crop_translation_key}`)} | ||
| {t(`crop:${crop_variety_name}`)} |
There was a problem hiding this comment.
This definitely works to implement the Jira-described solution! 👍
However, it's just slightly misleading. What it is doing, is calling the translation function t() and saying "look for the translation in the crop file that corresponds to the key {{crop_variety_name}}". Crop variety name is going to be a user-input string (or by default, a translated string corresponding to the crop key) so it definitely doesn't exist as a key in that file.
Instead, I recommend using here {crop_variety_name} directly, without the call to i18n.
Since i18n will anyway default to displaying the key if it doesn't exist, the end result in the UI will be the same, but it's clearer because it's not suggesting that we have a translation for crop:${crop_variety_name} when we don't.
…are made
Description
The common name for a crop should be displayed on the Crop Detailed page once changes are made
Jira link: https://lite-farm.atlassian.net/browse/LF-3787
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: