Skip to content
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-3861 - ward app - add tooltip to obs to show encounter date #1312

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

chibongho
Copy link
Contributor

@chibongho chibongho commented Sep 7, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

The observations displayed in the ward patient cards current has no indication to show when the obs values were taken. If the values were mis-configured to show from previous visits then the values might not be accurate.

This PR introduces ToggleTips that allow user to click on the obs values and see the corresponding encounter date.

Screenshots

image
image
image

Related Issue

https://openmrs.atlassian.net/browse/O3-3861

Other

Copy link
Contributor

github-actions bot commented Sep 7, 2024

Size Change: -33.8 kB (-0.55%)

Total Size: 6.1 MB

Filename Size Change
packages/esm-ward-app/dist/930.js 0 B -35.1 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/106.js 8.63 kB 0 B
packages/esm-active-visits-app/dist/130.js 345 kB 0 B
packages/esm-active-visits-app/dist/233.js 3.37 kB 0 B
packages/esm-active-visits-app/dist/271.js 800 B 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 709 B 0 B
packages/esm-active-visits-app/dist/325.js 3.09 kB 0 B
packages/esm-active-visits-app/dist/443.js 6.98 kB 0 B
packages/esm-active-visits-app/dist/460.js 824 B 0 B
packages/esm-active-visits-app/dist/574.js 615 B 0 B
packages/esm-active-visits-app/dist/586.js 53.5 kB 0 B
packages/esm-active-visits-app/dist/6.js 26.2 kB 0 B
packages/esm-active-visits-app/dist/644.js 800 B 0 B
packages/esm-active-visits-app/dist/725.js 643 B 0 B
packages/esm-active-visits-app/dist/757.js 721 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 628 B 0 B
packages/esm-active-visits-app/dist/807.js 959 B 0 B
packages/esm-active-visits-app/dist/814.js 3.04 kB 0 B
packages/esm-active-visits-app/dist/833.js 765 B 0 B
packages/esm-active-visits-app/dist/879.js 3.02 kB 0 B
packages/esm-active-visits-app/dist/967.js 611 B 0 B
packages/esm-active-visits-app/dist/main.js 81.9 kB 0 B
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.32 kB 0 B
packages/esm-appointments-app/dist/130.js 345 kB 0 B
packages/esm-appointments-app/dist/171.js 223 B 0 B
packages/esm-appointments-app/dist/198.js 250 kB 0 B
packages/esm-appointments-app/dist/2.js 2.23 kB 0 B
packages/esm-appointments-app/dist/265.js 1.79 kB 0 B
packages/esm-appointments-app/dist/269.js 7.38 kB 0 B
packages/esm-appointments-app/dist/271.js 2.41 kB 0 B
packages/esm-appointments-app/dist/319.js 2.23 kB 0 B
packages/esm-appointments-app/dist/325.js 3.08 kB 0 B
packages/esm-appointments-app/dist/372.js 2.57 kB 0 B
packages/esm-appointments-app/dist/385.js 31.1 kB 0 B
packages/esm-appointments-app/dist/440.js 16.6 kB 0 B
packages/esm-appointments-app/dist/460.js 2.45 kB 0 B
packages/esm-appointments-app/dist/501.js 7.02 kB 0 B
packages/esm-appointments-app/dist/574.js 2.02 kB 0 B
packages/esm-appointments-app/dist/581.js 9.03 kB 0 B
packages/esm-appointments-app/dist/591.js 16.8 kB 0 B
packages/esm-appointments-app/dist/644.js 2.41 kB 0 B
packages/esm-appointments-app/dist/711.js 129 kB 0 B
packages/esm-appointments-app/dist/757.js 2.28 kB 0 B
packages/esm-appointments-app/dist/784.js 2.62 kB 0 B
packages/esm-appointments-app/dist/788.js 2.02 kB 0 B
packages/esm-appointments-app/dist/807.js 2.65 kB 0 B
packages/esm-appointments-app/dist/833.js 2.37 kB 0 B
packages/esm-appointments-app/dist/903.js 879 B 0 B
packages/esm-appointments-app/dist/main.js 396 kB 0 B
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.56 kB 0 B
packages/esm-bed-management-app/dist/130.js 345 kB 0 B
packages/esm-bed-management-app/dist/148.js 1.22 kB 0 B
packages/esm-bed-management-app/dist/169.js 6.98 kB 0 B
packages/esm-bed-management-app/dist/271.js 680 B 0 B
packages/esm-bed-management-app/dist/319.js 680 B 0 B
packages/esm-bed-management-app/dist/325.js 3.09 kB 0 B
packages/esm-bed-management-app/dist/339.js 50.2 kB 0 B
packages/esm-bed-management-app/dist/455.js 26.5 kB 0 B
packages/esm-bed-management-app/dist/460.js 680 B 0 B
packages/esm-bed-management-app/dist/501.js 7.03 kB 0 B
packages/esm-bed-management-app/dist/542.js 395 B 0 B
packages/esm-bed-management-app/dist/574.js 672 B 0 B
packages/esm-bed-management-app/dist/591.js 16.8 kB 0 B
packages/esm-bed-management-app/dist/644.js 680 B 0 B
packages/esm-bed-management-app/dist/757.js 731 B 0 B
packages/esm-bed-management-app/dist/766.js 113 kB 0 B
packages/esm-bed-management-app/dist/784.js 2.63 kB 0 B
packages/esm-bed-management-app/dist/788.js 680 B 0 B
packages/esm-bed-management-app/dist/807.js 680 B 0 B
packages/esm-bed-management-app/dist/833.js 680 B 0 B
packages/esm-bed-management-app/dist/main.js 3.87 kB 0 B
packages/esm-bed-management-app/dist/openmrs-esm-bed-management-app.js 3.25 kB 0 B
packages/esm-patient-list-management-app/dist/130.js 345 kB 0 B
packages/esm-patient-list-management-app/dist/233.js 3.38 kB 0 B
packages/esm-patient-list-management-app/dist/271.js 1.57 kB 0 B
packages/esm-patient-list-management-app/dist/319.js 1.51 kB 0 B
packages/esm-patient-list-management-app/dist/325.js 3.09 kB 0 B
packages/esm-patient-list-management-app/dist/37.js 8.38 kB 0 B
packages/esm-patient-list-management-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-list-management-app/dist/455.js 57.7 kB 0 B
packages/esm-patient-list-management-app/dist/460.js 1.71 kB 0 B
packages/esm-patient-list-management-app/dist/574.js 1.33 kB 0 B
packages/esm-patient-list-management-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-management-app/dist/644.js 1.57 kB 0 B
packages/esm-patient-list-management-app/dist/658.js 102 kB 0 B
packages/esm-patient-list-management-app/dist/757.js 1.56 kB 0 B
packages/esm-patient-list-management-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-list-management-app/dist/788.js 1.33 kB 0 B
packages/esm-patient-list-management-app/dist/807.js 1.84 kB 0 B
packages/esm-patient-list-management-app/dist/814.js 3.05 kB 0 B
packages/esm-patient-list-management-app/dist/833.js 1.59 kB 0 B
packages/esm-patient-list-management-app/dist/main.js 162 kB 0 B
packages/esm-patient-list-management-app/dist/openmrs-esm-patient-list-management-app.js 3.3 kB 0 B
packages/esm-patient-registration-app/dist/130.js 344 kB 0 B
packages/esm-patient-registration-app/dist/169.js 6.71 kB 0 B
packages/esm-patient-registration-app/dist/2.js 2.24 kB 0 B
packages/esm-patient-registration-app/dist/271.js 2.43 kB 0 B
packages/esm-patient-registration-app/dist/319.js 2.32 kB 0 B
packages/esm-patient-registration-app/dist/325.js 3.09 kB 0 B
packages/esm-patient-registration-app/dist/371.js 547 B 0 B
packages/esm-patient-registration-app/dist/372.js 2.57 kB 0 B
packages/esm-patient-registration-app/dist/460.js 2.42 kB 0 B
packages/esm-patient-registration-app/dist/501.js 7.03 kB 0 B
packages/esm-patient-registration-app/dist/574.js 2.04 kB 0 B
packages/esm-patient-registration-app/dist/591.js 16.8 kB 0 B
packages/esm-patient-registration-app/dist/623.js 6.19 kB 0 B
packages/esm-patient-registration-app/dist/644.js 2.43 kB 0 B
packages/esm-patient-registration-app/dist/662.js 453 B 0 B
packages/esm-patient-registration-app/dist/700.js 69.6 kB 0 B
packages/esm-patient-registration-app/dist/757.js 2.37 kB 0 B
packages/esm-patient-registration-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-registration-app/dist/788.js 2.04 kB 0 B
packages/esm-patient-registration-app/dist/807.js 2.66 kB 0 B
packages/esm-patient-registration-app/dist/833.js 2.31 kB 0 B
packages/esm-patient-registration-app/dist/879.js 3.03 kB 0 B
packages/esm-patient-registration-app/dist/998.js 67.2 kB 0 B
packages/esm-patient-registration-app/dist/main.js 137 kB 0 B
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.34 kB 0 B
packages/esm-patient-search-app/dist/130.js 345 kB 0 B
packages/esm-patient-search-app/dist/233.js 3.37 kB 0 B
packages/esm-patient-search-app/dist/271.js 920 B 0 B
packages/esm-patient-search-app/dist/319.js 861 B 0 B
packages/esm-patient-search-app/dist/325.js 3.09 kB 0 B
packages/esm-patient-search-app/dist/334.js 24.6 kB 0 B
packages/esm-patient-search-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-search-app/dist/460.js 939 B 0 B
packages/esm-patient-search-app/dist/574.js 742 B 0 B
packages/esm-patient-search-app/dist/591.js 16.8 kB 0 B
packages/esm-patient-search-app/dist/634.js 52 kB 0 B
packages/esm-patient-search-app/dist/644.js 920 B 0 B
packages/esm-patient-search-app/dist/757.js 871 B 0 B
packages/esm-patient-search-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/788.js 736 B 0 B
packages/esm-patient-search-app/dist/807.js 1.04 kB 0 B
packages/esm-patient-search-app/dist/814.js 3.05 kB 0 B
packages/esm-patient-search-app/dist/833.js 877 B 0 B
packages/esm-patient-search-app/dist/main.js 77.4 kB 0 B
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.29 kB 0 B
packages/esm-service-queues-app/dist/130.js 345 kB 0 B
packages/esm-service-queues-app/dist/169.js 6.98 kB 0 B
packages/esm-service-queues-app/dist/199.js 1.36 kB 0 B
packages/esm-service-queues-app/dist/2.js 2.23 kB 0 B
packages/esm-service-queues-app/dist/236.js 5.84 kB 0 B
packages/esm-service-queues-app/dist/271.js 4.56 kB 0 B
packages/esm-service-queues-app/dist/282.js 8.97 kB 0 B
packages/esm-service-queues-app/dist/319.js 3.85 kB 0 B
packages/esm-service-queues-app/dist/325.js 3.09 kB 0 B
packages/esm-service-queues-app/dist/366.js 7.86 kB 0 B
packages/esm-service-queues-app/dist/372.js 2.57 kB 0 B
packages/esm-service-queues-app/dist/392.js 7.85 kB 0 B
packages/esm-service-queues-app/dist/460.js 4.77 kB 0 B
packages/esm-service-queues-app/dist/501.js 7.03 kB 0 B
packages/esm-service-queues-app/dist/574.js 3.86 kB 0 B
packages/esm-service-queues-app/dist/591.js 16.8 kB 0 B
packages/esm-service-queues-app/dist/6.js 1.75 kB 0 B
packages/esm-service-queues-app/dist/60.js 1.82 kB 0 B
packages/esm-service-queues-app/dist/604.js 6.96 kB 0 B
packages/esm-service-queues-app/dist/644.js 4.56 kB 0 B
packages/esm-service-queues-app/dist/665.js 160 kB 0 B
packages/esm-service-queues-app/dist/670.js 10 kB 0 B
packages/esm-service-queues-app/dist/727.js 8.1 kB 0 B
packages/esm-service-queues-app/dist/748.js 116 kB 0 B
packages/esm-service-queues-app/dist/752.js 1.62 kB 0 B
packages/esm-service-queues-app/dist/757.js 4.14 kB 0 B
packages/esm-service-queues-app/dist/760.js 7.13 kB 0 B
packages/esm-service-queues-app/dist/784.js 2.63 kB 0 B
packages/esm-service-queues-app/dist/788.js 3.85 kB 0 B
packages/esm-service-queues-app/dist/800.js 1.68 kB 0 B
packages/esm-service-queues-app/dist/807.js 5.13 kB 0 B
packages/esm-service-queues-app/dist/818.js 2.55 kB 0 B
packages/esm-service-queues-app/dist/828.js 1.39 kB 0 B
packages/esm-service-queues-app/dist/833.js 4.46 kB 0 B
packages/esm-service-queues-app/dist/911.js 7.76 kB 0 B
packages/esm-service-queues-app/dist/940.js 21.4 kB 0 B
packages/esm-service-queues-app/dist/main.js 276 kB 0 B
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.31 kB 0 B
packages/esm-ward-app/dist/109.js 344 B 0 B
packages/esm-ward-app/dist/125.js 5.68 kB -1 B (-0.02%)
packages/esm-ward-app/dist/130.js 345 kB 0 B
packages/esm-ward-app/dist/169.js 6.97 kB 0 B
packages/esm-ward-app/dist/2.js 2.23 kB 0 B
packages/esm-ward-app/dist/269.js 829 B +61 B (+7.94%) 🔍
packages/esm-ward-app/dist/314.js 32.3 kB +343 B (+1.07%)
packages/esm-ward-app/dist/325.js 3.08 kB 0 B
packages/esm-ward-app/dist/342.js 1.08 kB 0 B
packages/esm-ward-app/dist/348.js 349 B 0 B
packages/esm-ward-app/dist/372.js 2.56 kB 0 B
packages/esm-ward-app/dist/466.js 393 B 0 B
packages/esm-ward-app/dist/500.js 4.99 kB 0 B
packages/esm-ward-app/dist/501.js 7.02 kB 0 B
packages/esm-ward-app/dist/53.js 11.3 kB -2 B (-0.02%)
packages/esm-ward-app/dist/545.js 35.6 kB 0 B
packages/esm-ward-app/dist/559.js 342 B 0 B
packages/esm-ward-app/dist/574.js 1.39 kB +22 B (+1.61%)
packages/esm-ward-app/dist/577.js 18 kB -2 B (-0.01%)
packages/esm-ward-app/dist/591.js 16.8 kB 0 B
packages/esm-ward-app/dist/659.js 9.89 kB -2 B (-0.02%)
packages/esm-ward-app/dist/701.js 3.46 kB -26 B (-0.75%)
packages/esm-ward-app/dist/749.js 8.18 kB 0 B
packages/esm-ward-app/dist/767.js 648 B 0 B
packages/esm-ward-app/dist/784.js 2.62 kB 0 B
packages/esm-ward-app/dist/922.js 9.3 kB -2 B (-0.02%)
packages/esm-ward-app/dist/940.js 21.4 kB 0 B
packages/esm-ward-app/dist/969.js 202 B 0 B
packages/esm-ward-app/dist/main.js 68.4 kB +879 B (+1.3%)
packages/esm-ward-app/dist/openmrs-esm-ward-app.js 3.29 kB 0 B

compressed-size-action

@@ -44,7 +38,7 @@ export function useMotherAndChildren(
requireChildBornDuringMothersActiveVisit?.toString() ?? 'false',
);
rep && url.searchParams.append('v', rep);
return useOpenmrsPagination<MotherAndChildren>(fetch ? url : null, 50);
return useOpenmrsFetchAll<MotherAndChildren>(fetch ? url : null);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaking this fix in. This shouldn't have use useOpenmrsPagination.

@@ -62,16 +68,6 @@ const WardPatientCard: WardPatientCard = (wardPatient) => {
))}
<ExtensionSlot name={footerExtensionSlotName} state={wardPatient} />
</div>
<button
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the patient card was made clickable by adding this button to overlay on top of the elements of the card. I'm not sure why it was implemented that way, but I had to change it in order for the ToggleTips to receive click events.

cc @brandones

Copy link
Contributor

@brandones brandones Sep 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is widely and strongly recommended against adding onClick to a div.

There are myriad articles about how to create a "clickable card" component, which is simply kind of a hard problem, but I really like this one. I implemented Method 3 from it, which agrees with the recommendations of the widely-cited Card guidelines from Inclusive Components.

Rather than using JS as recommended by Method 4 of that article, I would recommend just using the current approach and increasing the z-index of any links you need to be clickable on top of the card. The only reason Method 4 would be preferable would be to make the text selectable, and I don't think that's relevant to this interface.

As an aside, did this ToggleTip thing get designed? It makes the interface look a lot busier, appears to have the info button at the same level of visual hierarchy as the obs information itself, and seems like it would be easy to click the wrong thing. I would suggest making the tooltip appear on hover anywhere over the tag element (with a 500ms delay), with no info icon. You would only need JS to do touch handling on mobile, something like touch-and-hold shows the tooltip while tap clicks the card. You would still need the z-index fix.

Alternatively, since it seems like this is supposed to solve a problem not actually faced by users (but rather by devs & admins) you could add a boolean config option that makes all tags show some metadata. Then you would be able to debug just by switching it in the implementer tools.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense. I'll implement it using z-index.

As an aside, did this ToggleTip thing get designed?

No, I did this before I got a reply from UX designers. I'll make the whole tag clickable for mobile and hoverable on desktop.

Alternatively, since it seems like this is supposed to solve a problem not actually faced by users (but rather by devs & admins)

While it's mostly for debugging, I think it's also important to show this info so that mistakes in implementation / configuration are as apparent as possible to the end users.

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chibongho ! Looks good, though one comment on formatting the display information.

<ToggletipButton>
<Information />
</ToggletipButton>
<ToggletipContent>{o.encounter?.display}</ToggletipContent>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we generally don't use the "display" property much because we often want finer-grained control of what to "display". For one thing, "display" does not support our localization strategy for metadata (though it likely should), but also, this will return the time formatted in the server time zone, which was our general standard for O2, but probably not what we want in O3? ie, it's probably better to explicitly format the encounter type and encounter date here... thoughts @ibacher @mseaton ?

} else {
summaryTagTooltipText.push(
<div key={uuid}>
{display} ({o.encounter.display})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about "display"

<ToggletipButton>
<Information />
</ToggletipButton>
<ToggletipContent>{o.encounter?.display}</ToggletipContent>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about display.

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I'm not sure encounterType.display supports localization, but if it doesn't we should fix on the server side when we encounter the issue.

@denniskigen
Copy link
Member

From the screenshots, it looks like the Toggletips could benefit from some left margin.

@chibongho
Copy link
Contributor Author

From the screenshots, it looks like the Toggletips could benefit from some left margin.

Oh... I should have mentioned. The screenshots are not up to date anymore. I'm making the entire tags be a tooltip on hover when on desktop and a toggletip when on mobile. It looks like this now:

image

image

@chibongho chibongho merged commit 6822458 into main Sep 18, 2024
6 checks passed
@chibongho chibongho deleted the O3-3861 branch September 18, 2024 14:24
@denniskigen denniskigen mentioned this pull request Dec 17, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants