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(resizable-side-panels): Make the left and right side panels (optionally) resizable. #4672

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jbocce
Copy link
Collaborator

@jbocce jbocce commented Jan 10, 2025

Context

Users might find that some side panels could use a little bit more real estate. Making the side panels resizable is one way to permit customized sizing of the side panels.

Changes & Results

Copied resizable component from shadcn/ui library.
Added a dependency to react-resizable-panels.
The resizing dependency and logic is contained in the ViewerLayout component. Added the isExpanded prop to SidePanel so that expanded/collapsed is no longer tied to the activeTabIndex prop.
Refactored SidePanel so that the border sizing info are props and thus the resizable panels can calculate their sizes accordingly. The side panel width sizes were already props.
Removed the open and close transition (animation) for the side panels. Added options to make either, both or neither side panels resizable. The tricky part was handling window resizes and converting between pixels and percentages.
Fixed the triggers for opening the side panels dynamically.

With these changes, the side panels can be resized by dragging either side edge of the viewport grid panel.

Testing

Attempt to resize either the left and/or right side panels.
Note that the resizing action will also collapse the side panel if one were to drag the edge of the viewport grid panel beyond the minimum size of the side panel.
Likewise dragging a collapsed side panel will expand the side panel.
Note also the effects of resizing the window. Care was taken to make the side panel sizing as consistent as possible for a window resize.

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • OS: Windows 11
  • 20.9.0 Node version:
  • Browser: Chrome 131.0.6778.265

…i library.

Added a dependency to react-resizable-panels.
The resizing dependency and logic is contained in the ViewerLayout component.
Added the isExpanded prop to SidePanel so that expanded/collapsed is no
longer tied to the activeTabIndex prop.
Refactored SidePanel so that the border sizing info are props and thus
the resizable panels can calculate their sizes accordingly. The side panel
width sizes were already props.
Removed the open and close transition (animation) for the side panels.
Added options to make either, both or neither side panels resizable.
The tricky part was handling window resizes and converting between
pixels and percentages.
Fixed the triggers for opening the side panels dynamically.
@jbocce jbocce requested a review from sedghi January 10, 2025 15:58
Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for ohif-platform-docs canceled.

Name Link
🔨 Latest commit 74d255d
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/678bf83b2fa1430008080b96

Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 74d255d
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/678bf83b1bff1f000897e41c

@jbocce jbocce requested a review from wayfarer3130 January 10, 2025 16:00
@jbocce jbocce requested a review from sedghi January 14, 2025 15:22
Copy link

cypress bot commented Jan 17, 2025

Viewers    Run #4717

Run Properties:  status check failed Failed #4717  •  git commit f0bf82f9f1: Resizing the browser window now maintains the side panels' pixel width.
Project Viewers
Branch Review feat/panel-responsive-layout
Run status status check failed Failed #4717
Run duration 02m 29s
Commit git commit f0bf82f9f1: Resizing the browser window now maintains the side panels' pixel width.
Committer Joe Boccanfuso
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 43
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/integration/measurement-tracking/OHIFMeasurementPanel.spec.js • 1 failed test

View Output Video

Test Artifacts
OHIF Measurement Panel > checks if Measurements right panel can be hidden/displayed Test Replay Screenshots Video

…. This is essential for maintaining the size of the side panels whenever the browser window is resized.
@jbocce jbocce force-pushed the feat/resizeable-side-panels branch from 5e90e9c to 74d255d Compare January 18, 2025 18:51
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.

2 participants