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-3253: Move the details panel button below the Patient Header in the workspace #1844

Merged

Conversation

usamaidrsk
Copy link
Member

@usamaidrsk usamaidrsk commented May 22, 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

This PR moves the show details button below the patient details.

Screenshots

show-hide-details-below-patient-details.mp4

Related Issue

O3-3253

Other

@mogoodrich
Copy link
Member

@usamaidrsk can we have a screenshot of how this would look when used as the patient banner on the patient chart, and also with the actions button present.

@denniskigen
Copy link
Member

denniskigen commented May 22, 2024

@ibacher is this the implementation you envisaged? I've messaged Paul and Grace on #ux-design-advisory to get their thoughts on the redesign.

@ibacher
Copy link
Member

ibacher commented May 22, 2024

I would've anticipated only moving the button in the condensed version of the patient banner. I.e., in the chart, this actually makes the banner take up more visual space, which seems undesirable.

@denniskigen denniskigen changed the title (fix) O3-3253: move show details below the patient details on the patient … (fix) O3-3253: Move the details panel button in the patient header below the header May 22, 2024
@denniskigen denniskigen changed the title (fix) O3-3253: Move the details panel button in the patient header below the header (fix) O3-3253: Move the details panel button below the Patient Header May 22, 2024
@denniskigen
Copy link
Member

denniskigen commented May 22, 2024

I agree. Is there a contextual prop @usamaidrsk should be checking for to know whether the banner is the condensed version?

@ibacher
Copy link
Member

ibacher commented May 22, 2024

patientBannerRef.current.scrollWidth maybe? If it's <= 500px it should be being rendered in the workspace (we need to talk to Paul or Ciarán about the workspace size... It looks like we're mostly using the wide version everywhere?).

We might also want to make that dependent on the isTabletViewport state variable, so that it changes if the window resizes into tablet mode.

@denniskigen
Copy link
Member

It looks like we could also conditionally render based on isTabletViewport which is computed from ResizeObserver. Gives you this:

isTabletViewport.mp4

@usamaidrsk
Copy link
Member Author

It looks like we could also conditionally render based on isTabletViewport which is computed from ResizeObserver. Gives you this:

Yes, @denniskigen that does do the trick.

toggleContactDetails={toggleContactDetails}
showContactDetails={showContactDetails}
/>
{!isTabletViewport ? (
Copy link
Member

@ibacher ibacher May 23, 2024

Choose a reason for hiding this comment

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

So, I was expecting the condition here to be something like:

const renderDetailsButtonBelow = !isTabletViewport && (!Boolean(patientBannerRef.current) || patientBannerRef.current.scrollWidth <= 500);

Basically:

  1. We do not want to move the details button in tablet mode, because tablet mode is actually wider than the workspace, so this should be a non-issue. (We may want to move it in tablet mode when there are less than maybe 800px of screen width, but let's consider that if / when it comes up or we have more concrete design guidance).
  2. We only want to move the icon if the <header /> element is 500px or less, because that indicates that we're being rendered in the workspace (tablet mode is a minimum of 600px of screen real-estate).
  3. If the ref has not yet been set, we don't know which of these two modes to use, so we just assume the default (render to the right).

Copy link
Member

Choose a reason for hiding this comment

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

Defer to @ibacher on this....

Copy link
Member

Choose a reason for hiding this comment

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

This is the technical version of "we leave the patient banner as-is, but where there’s 500px or less of width to render the banner in, we move the “Show Details“ to a new line" 😁

Copy link
Member Author

Choose a reason for hiding this comment

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

I have pushed an update that uses

const renderDetailsButtonBelow = patientBannerRef.current?.scrollWidth <= 520;

As per zeroheight workspace documentation.

On desktop screens, the workspace sits on the right side of the page. Its width is 420px in most cases, and 520px if it's a clinical form.

@ibacher ibacher changed the title (fix) O3-3253: Move the details panel button below the Patient Header (feat) O3-3253: Move the details panel button below the Patient Header in the workspace May 23, 2024
@usamaidrsk usamaidrsk force-pushed the ft-show-details-btn-under-patient-details branch from 16acb90 to 4a6c36a Compare May 23, 2024 20:01
@@ -42,6 +42,9 @@ const PatientBanner: React.FC<PatientBannerProps> = ({ patient, patientUuid, hid
}, []);

const isDeceased = Boolean(patient?.deceasedDateTime);
// render details button below patient details for workspaces
// 520px is the maximum width a workspace occupies
const renderDetailsButtonBelow = patientBannerRef.current?.scrollWidth <= 520;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const renderDetailsButtonBelow = patientBannerRef.current?.scrollWidth <= 520;
const maxWorkspaceWidth = 520;
const showDetailsButtonBelowHeader = !isTabletViewport && (!Boolean(patientBannerRef.current) || patientBannerRef.current.scrollWidth <= maxWorkspaceWidth);

The current logic doesn't account for two of the situations Ian mentioned above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes @denniskigen. Thanks for pointing this out. I tested it with the condition provided, but the appearance on the desktop view was not as expected.

image

Therefore, I decided to only check the width of the banner instead. Whenever the width is less than 520px, the button will be displayed below the header. This way, the button will never appear under the header on tablets, as they are greater than 520px in width.

cc @ibacher

@denniskigen denniskigen force-pushed the ft-show-details-btn-under-patient-details branch from 2b235e0 to 8f67de4 Compare May 27, 2024 17:39
@denniskigen
Copy link
Member

denniskigen commented May 27, 2024

So I've just tested this and it works well with workspaces:

show-details-button-below-patient-header.mp4

It doesn't work as well with overlays (such as what we use for the Appointments form). Is it because we don't constrain the max-width @brandones @mogoodrich? Perhaps setting a max-width and using that value for the condition could be the ideal approach:

CleanShot 2024-05-27 at 8  56 49@2x

@usamaidrsk
Copy link
Member Author

usamaidrsk commented May 27, 2024

Thanks @denniskigen!,

It doesn't work as well with overlays (such as what we use for the Appointments form). Is it because we don't constrain the max-width
image

I think the screenshot looks okay, given that the patient details on the banner are not compressed/squeezed as to why @mogoodrich suggested to improve the layout.

Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

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

Ok. Approving and deferring to @mogoodrich to merge if it meets the acceptance criteria. Thanks, @usamaidrsk!

@denniskigen denniskigen merged commit 4e9e68b into openmrs:main May 28, 2024
6 checks passed
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