-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'(fix)O3-2473': Visit Type selector fails and is not needed #1036
Open
jwnasambu
wants to merge
1
commit into
openmrs:main
Choose a base branch
from
jwnasambu:(fix)O3-2473
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,10 @@ interface BaseVisitTypeProps { | |
onChange: (event) => void; | ||
patientUuid: string; | ||
visitTypes: Array<VisitType>; | ||
enableSearch?: boolean; | ||
} | ||
|
||
const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ onChange, visitTypes }) => { | ||
const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ onChange, visitTypes, enableSearch = false }) => { | ||
const { t } = useTranslation(); | ||
const isTablet = useLayoutType() === 'tablet'; | ||
const [searchTerm, setSearchTerm] = useState<string>(''); | ||
|
@@ -39,7 +40,7 @@ const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ onChange, visitTypes }) = | |
[styles.tablet]: isTablet, | ||
[styles.desktop]: !isTablet, | ||
})}> | ||
{results.length ? ( | ||
{enableSearch && ( | ||
<> | ||
{isTablet ? ( | ||
<Layer> | ||
|
@@ -56,19 +57,21 @@ const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ onChange, visitTypes }) = | |
labelText="" | ||
/> | ||
)} | ||
|
||
<RadioButtonGroup | ||
className={styles.radioButtonGroup} | ||
defaultSelected={defaultVisitType} | ||
orientation="vertical" | ||
onChange={onChange} | ||
name="radio-button-group" | ||
valueSelected={results?.length >= 1 && results[0].uuid}> | ||
{results.map(({ uuid, display, name }) => ( | ||
<RadioButton key={uuid} className={styles.radioButton} id={name} labelText={display} value={uuid} /> | ||
))} | ||
</RadioButtonGroup> | ||
</> | ||
)} | ||
|
||
{results.length ? ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks right - moving the search conditional around the results table, but not around the actual search box itself. |
||
<RadioButtonGroup | ||
className={styles.radioButtonGroup} | ||
defaultSelected={defaultVisitType} | ||
orientation="vertical" | ||
onChange={onChange} | ||
name="radio-button-group" | ||
valueSelected={results?.length >= 1 && results[0].uuid}> | ||
{results.map(({ uuid, display, name }) => ( | ||
<RadioButton key={uuid} className={styles.radioButton} id={name} labelText={display} value={uuid} /> | ||
))} | ||
</RadioButtonGroup> | ||
) : ( | ||
<Layer> | ||
<Tile className={styles.tile}> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
enableSearch
is still a bit of a question mark. Personally, I see no reason to have a search here. But let's just leave the search as-is for now and we can assess more in the future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mseaton Kindly could you please provide more insight into the reasons behind this opinion? Let's maintain the search feature as it is for now, and we can reassess its relevance and effectiveness in the future? I am a bit confused on the changes to be made basing on the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jwnasambu - issue with the search getting hidden is a real bug. The issue with the search not being necessary is an opinion I am expressing, but not really a problem. Given that the designs have the search, we can leave it for now and maybe start a conversation on the ux-design-advisory asking about the thinking behind the visit type search. It would be good to make sure we fully understand what use case this is envisioned for (eg. are there implementations out there that have so many visit types we would need an auto-complete search for them; who/what implementation is this designed for where this is a need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beyond this, if we are going to have this boolean
enableSearch
prop on the component, then we will need to also support this configurability in the config schema and ensure the configured value is getting passed in and used when this component is instantiated. I don't see that in this PR, and it's not really priority for us to have this removed, so this is why I said just to leave it.