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: Add support for Custom Modal component in Modal Service #4752

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

Conversation

abhijith-trenser
Copy link
Contributor

Context

  • Added support for a custom Modal component in ModalProvider without modifying App.tsx.
  • Exposed setAppConfig in the appConfig provider to allow adding custom configurations without modifying App.

Changes & Results

  • Implemented new logic in UIModalService and ModalProvider to support a custom Modal component without modifying App. If no custom component is provided, the default modal will be rendered. Users can set a custom component through the setServiceImplementation method.
 uiModalService.setServiceImplementation({
      component: Modal,
    });
  • Exposed setAppConfig from the appConfig provider to allow adding custom configurations from the application without modifying App.tsx.

Testing

Modal

  • Create a new Modal component
  • Set the new component using the setServiceImplementation method.
uiModalService.setServiceImplementation({
    component: Modal,
  });
  • Trigger a Modal in the viewer. It will render with the newly provided component as the Modal.

Config

  • Set additional configurations from another area using the setAppConfig method from the useAppConfig hook.
  • Observe the behavior in viewer: The newly provided configuration will be appended to the existing configuration.

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:
  • Node version:
  • Browser:

Copy link

netlify bot commented Jan 31, 2025

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 5184e49
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/67a1acf845e68f0008b08727

Copy link

netlify bot commented Jan 31, 2025

Deploy Preview for ohif-platform-docs failed. Why did it fail? →

Name Link
🔨 Latest commit 5184e49
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/67a1acf830bf060008088467

@abhijith-trenser abhijith-trenser marked this pull request as draft January 31, 2025 16:56
@abhijith-trenser abhijith-trenser force-pushed the feat/add-component-support-in-modal-service branch from 12fbe1e to f706ced Compare February 3, 2025 06:44
@abhijith-trenser abhijith-trenser marked this pull request as ready for review February 3, 2025 07:00
Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

looks good, see my comments.
Can we add some docs here https://docs.ohif.org/platform/services/ui/ui-modal-service/ that says how to use custom component?

@abhijith-trenser abhijith-trenser force-pushed the feat/add-component-support-in-modal-service branch from 27bb8a5 to ee38a80 Compare February 4, 2025 04:38
@abhijith-trenser
Copy link
Contributor Author

looks good, see my comments. Can we add some docs here https://docs.ohif.org/platform/services/ui/ui-modal-service/ that says how to use custom component?

@sedghi I have updated the documentation of UIModalService. Could you please check that also? Thank you!

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