-
Notifications
You must be signed in to change notification settings - Fork 184
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
(feat) O3-2790: Create a reusable location picker component #913
base: main
Are you sure you want to change the base?
Conversation
@ibacher The e2e test is failing for this PR as we don't package esm-framework. What can we do? https://github.com/openmrs/openmrs-esm-core/blob/main/e2e/support/github/run-e2e-docker-env.sh |
Several things:
|
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.
See previous comment as well.
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 don't think .module.scss
is consistent with our naming conventions (and the couple of other places it's used should be fixed).
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 tried using without .module
suffix earlier and the css didn't get modularised (#910 (comment)). Then I thought that it was the intended behaviour as the files doesn't have the suffix used to write normal css classes. ex: Snackbar
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.
Yeah @ibacher unfortunately it's a webpack issue, .module.scss
magically makes the styles work. I don't understand it. @denniskigen pointed it out to me.
Thanks for your thoughtful review, @ibacher. Let me try address your queries here:
I appreciate your feedback and would love to hear your thoughts. :) |
@jayasanka-sack So, I'm on-board with a component for viewing locations. I'm less keen on the data-fetching part living in the styleguide. That is, I think the fetching should be handled by a component that mounts this component and passed in as props rather than having the fetch logic itself in the styleguide. There might be a case for putting those hooks in esm-react-utils... There are issues with components in the styleguide, like the translation system won't work nor will the configuration system. These need to come via props to the component. Components in the styleguide should really just be, effectively the HTML markup and component behaviour (like drop-downs or something). |
And, yeah, for the e2e tests in core, we also need to run the |
Please also document the places in the code that this location picker would be used. What existing location pickers exist throughout O3? It's important to make sure that styleguide components are very well designed in terms of being adequate for current use cases (while being minimalist in their API and simple in their implementation). I don't have strong feelings about whether the data fetching is included or not. I'm inclined to say that whether it should be included should depend on whether users of the component will want control over the data that gets used. For example, the Patient Banner Contact Details component fetches the patient object; this is fine because it would be very strange for someone to want to customize the patient data being used. But here, there is already the location tag prop, which indicates some need for customization. On the other hand, Infinite Scroll requires a pretty high degree of coupling between the UI and data fetcher. So it might be hard to design a good component API where the data is provided by the component user. |
We do have And we now support core translations, as you all know :) |
@jayasanka-sack I have merged this with the latest. Please give it a look over to see if you think I messed anything up. It was an extremely messy merge. |
Also, the build is failing. Unfortunately it is a pretty difficult error to debug. @jayasanka-sack will you have time to work on this and get this in? Once the build is passing I would support merging this in, if @ibacher agrees. I like the approach you've taken and think you did a great job with it. Unless there are reasons we might want the function-user to be able to customize the list of locations going in to the picker, I think having the picker handle the fetching/paging/etc itself is the right call. |
Thanks @brandones ! Let me try to fix this. |
Requirements
feat
,fix
, orchore
, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
This PR introduces a significant enhancement by establishing a reusable location picker through the relocation of the current picker to our styleguide. The key modifications include:
Screenshots
No visual changes
Related Issue
https://openmrs.atlassian.net/browse/O3-2790
Other