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(service-portal): Revert modal upgrade #16080

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Conversation

thorkellmani
Copy link
Member

@thorkellmani thorkellmani commented Sep 19, 2024

This reverts commit 6bfcab3.

What

  • Revert

Why

  • Unforseen errors in functionality on modals in health center registration

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new RegisterModal component for user registration with health centers, simplifying the registration process.
    • Added styles for the RegisterModal, enhancing its visual appeal and usability.
  • Improvements

    • Simplified the existing Modal component by removing unnecessary props and state management, focusing on a more streamlined design.
  • Bug Fixes

    • Improved modal visibility handling and user interaction flow in the registration process.

These changes enhance user experience and streamline the registration process within the application.

Copy link
Contributor

coderabbitai bot commented Sep 19, 2024

Walkthrough

The changes involve the refactoring of modal components within the service portal. The existing Modal component has been simplified, with the removal of several props and internal state management. A new RegisterModal component has been introduced, which streamlines the registration process for users, including health center registration and dentist registration. This new component replaces the previous modal implementations and includes new styles defined in a CSS file. The overall structure and complexity of the modal handling have been reduced.

Changes

Files Change Summary
libs/service-portal/core/src/components/Modal/Modal.css.ts Removed the image style definition, simplifying the modal's styling logic.
libs/service-portal/core/src/components/Modal/Modal.tsx Removed several props from the Props interface and eliminated internal state management for modal visibility. The component now relies on rendering children directly instead of predefined props.
libs/service-portal/health/src/components/RegisterModal/RegisterModal.css.ts Introduced styles for the new RegisterModal, including base styles, grid layout, and button styles to enhance the modal's visual presentation.
libs/service-portal/health/src/components/RegisterModal/RegisterModal.tsx Added a new RegisterModal component that handles user registration with a health center, including props for managing visibility, selection of doctors, and internationalization.
libs/service-portal/health/src/components/RegisterModal/index.ts Added an export statement for the RegisterModal component to facilitate its use throughout the application.
libs/service-portal/health/src/screens/DentistRegistration/DentistRegistration.tsx Replaced the previous modal implementation with the new RegisterModal, simplifying the registration process and reducing state management complexity.
libs/service-portal/health/src/screens/HealthCenterRegistration/HealthCenterRegistration.tsx Replaced the existing Modal with the RegisterModal for health center registration, streamlining the interaction and reducing complexity in managing modal visibility and state.

Suggested reviewers

  • thordurhhh
  • disaerna

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thorkellmani thorkellmani added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 19, 2024
@thorkellmani thorkellmani marked this pull request as ready for review September 19, 2024 13:22
@thorkellmani thorkellmani requested a review from a team as a code owner September 19, 2024 13:22
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 36.66%. Comparing base (dffc347) to head (eeba4b2).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...lth/src/components/RegisterModal/RegisterModal.tsx 0.00% 7 Missing ⚠️
...ortal/health/src/components/RegisterModal/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16080   +/-   ##
=======================================
  Coverage   36.66%   36.66%           
=======================================
  Files        6748     6748           
  Lines      138720   138720           
  Branches    39403    39403           
=======================================
  Hits        50862    50862           
  Misses      87858    87858           
Flag Coverage Δ
api 3.39% <ø> (ø)
api-domains-auth-admin 49.89% <ø> (ø)
application-system-api 41.52% <ø> (ø)
application-template-api-modules 23.44% <ø> (-0.02%) ⬇️
judicial-system-web 28.66% <ø> (ø)
services-auth-admin-api 52.95% <ø> (ø)
services-auth-delegation-api 61.28% <ø> (ø)
services-auth-ids-api 53.99% <ø> (ø)
services-auth-personal-representative 47.91% <ø> (-0.04%) ⬇️
services-auth-personal-representative-public 43.87% <ø> (+0.04%) ⬆️
services-auth-public-api 51.76% <ø> (ø)
services-user-notification 47.17% <ø> (ø)
services-user-profile 62.28% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...service-portal/core/src/components/Modal/Modal.tsx 14.28% <ø> (ø)
...creens/DentistRegistration/DentistRegistration.tsx 0.00% <ø> (ø)
...lthCenterRegistration/HealthCenterRegistration.tsx 0.00% <ø> (ø)
...ortal/health/src/components/RegisterModal/index.ts 0.00% <0.00%> (ø)
...lth/src/components/RegisterModal/RegisterModal.tsx 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dffc347...eeba4b2. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 1a3ca89 🔗

3 Total Test Services: 0 Failed, 2 Passed
➡️ Test Sessions change in coverage: 21 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
judicial-system-web 0 0 0 338 0 1m 8.54s 1 no change Link
service-portal-core 0 0 0 5 0 2.2s N/A Link
service-portal-health 0 0 0 0 0 509.48ms 1 no change Link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
libs/service-portal/health/src/components/RegisterModal/RegisterModal.css.ts (1)

3-11: Consider using a more responsive maxWidth value.

The fixed maxWidth of '55.5rem' may not be optimal for all screen sizes. Consider using a more responsive value, such as a percentage or a CSS variable, to ensure the modal adapts better to different screen sizes.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dffc347 and eeba4b2.

Files selected for processing (7)
  • libs/service-portal/core/src/components/Modal/Modal.css.ts (0 hunks)
  • libs/service-portal/core/src/components/Modal/Modal.tsx (2 hunks)
  • libs/service-portal/health/src/components/RegisterModal/RegisterModal.css.ts (1 hunks)
  • libs/service-portal/health/src/components/RegisterModal/RegisterModal.tsx (1 hunks)
  • libs/service-portal/health/src/components/RegisterModal/index.ts (1 hunks)
  • libs/service-portal/health/src/screens/DentistRegistration/DentistRegistration.tsx (4 hunks)
  • libs/service-portal/health/src/screens/HealthCenterRegistration/HealthCenterRegistration.tsx (3 hunks)
Files not reviewed due to no reviewable changes (1)
  • libs/service-portal/core/src/components/Modal/Modal.css.ts
Files skipped from review due to trivial changes (1)
  • libs/service-portal/health/src/components/RegisterModal/index.ts
Additional context used
Path-based instructions (5)
libs/service-portal/core/src/components/Modal/Modal.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/components/RegisterModal/RegisterModal.css.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/components/RegisterModal/RegisterModal.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/screens/DentistRegistration/DentistRegistration.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/screens/HealthCenterRegistration/HealthCenterRegistration.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/service-portal/health/src/screens/DentistRegistration/DentistRegistration.tsx

[error] 166-166: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (18)
libs/service-portal/health/src/components/RegisterModal/RegisterModal.css.ts (5)

13-16: LGTM!

The modalGridStyle object effectively establishes a grid layout for the modal's content with well-balanced column fractions.


18-20: LGTM!

The modalGridContentStyle object correctly positions the modal's content in the second column of the grid, aligning with the defined grid template.


22-24: LGTM!

The modalGridImageStyle object effectively centers the modal's image within its grid cell, ensuring proper alignment.


26-31: LGTM!

The closeModalButtonStyle object effectively positions the close button in the top-right corner of the modal and sets the appropriate cursor style for user interaction.


33-37: LGTM!

The modalGridButtonGroup object effectively organizes buttons within the modal in a flexible row layout with a consistent gap between buttons, enhancing usability.

libs/service-portal/core/src/components/Modal/Modal.tsx (2)

1-3: Imports adhere to reusability and TypeScript guidelines.

The imports are sourced from a reusable library, use named imports for effective tree-shaking, and leverage TypeScript for type definitions. This aligns with the additional instructions provided.


31-31: Modal close logic is correct.

The handleOnVisibilityChange function correctly calls the onCloseModal callback when the modal is not visible. The logic is straightforward and has no apparent issues.

libs/service-portal/health/src/components/RegisterModal/RegisterModal.tsx (4)

1-99: LGTM! The RegisterModal component is well-implemented and follows best practices.

The component provides a clear and user-friendly interface for registering with a health center by selecting a doctor. It effectively utilizes the useLocale hook for internationalization and follows a modular structure with a clear separation of concerns.


1-99: Verify the reusability of the component across different NextJS apps.

The RegisterModal component seems to be designed in a reusable manner, with a clear set of props that can be easily integrated into different parts of the application. However, please ensure that the component can be seamlessly used across different NextJS apps without any dependencies on the specific app's context or state.


15-24: Effective use of TypeScript for defining props.

The component effectively utilizes TypeScript by defining the props using a type alias RegisterModalProps. This ensures type safety and provides clear documentation for the component's expected inputs.


1-99: Ensure that the component is tree-shakable and can be effectively bundled.

The component seems to be well-structured and modular, which should allow for effective tree-shaking and bundling. However, please verify that the component and its dependencies are properly exported and imported to ensure optimal bundling and minimize the final bundle size.

libs/service-portal/health/src/screens/DentistRegistration/DentistRegistration.tsx (4)

16-16: LGTM!

The import statement is correct and adheres to the reusability guideline for the libs directory.


25-25: LGTM!

The import statement is correct and adheres to the reusability guideline for the libs directory.


161-184: LGTM!

The RegisterModal component is correctly rendered and configured based on the component state. The code segment adheres to the reusability guideline for the libs directory.

Tools
Biome

[error] 166-166: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


222-234: LGTM!

The Button component is correctly rendered and configured based on the component state. The onClick prop correctly updates the selectedDentist state with the current dentist's data.

The static analysis hint is a false positive, as the selectedDentist state is always set with an object containing the id and name properties. No changes are needed.

libs/service-portal/health/src/screens/HealthCenterRegistration/HealthCenterRegistration.tsx (3)

29-29: LGTM!

The import statement for the RegisterModal component looks good. It follows the correct naming convention and is imported from the expected local path.


240-254: LGTM!

The usage of the RegisterModal component looks good:

  • The modal's visibility is correctly controlled by the selectedHealthCenter state.
  • The modal's title and description are dynamically populated using the formatMessage function, providing context-specific information.
  • The onClose handler correctly resets the necessary states when the modal is closed.
  • The onAccept handler appropriately invokes the handleHealthCenterTransfer function to initiate the registration process.
  • The healthCenterDoctors prop allows the modal to display the list of doctors associated with the selected health center.

309-323: LGTM!

The usage of the Button component within the table cell looks good:

  • The button's visibility is correctly controlled by the hoverId state, ensuring it is only visible when the corresponding table row is hovered.
  • The onClick handler appropriately sets the selectedHealthCenter state with the necessary information (id and name) of the selected health center.
  • The button's label is dynamically populated using the formatMessage function, providing a localized label for the button.

@kodiakhq kodiakhq bot merged commit 5de8553 into main Sep 19, 2024
66 checks passed
@kodiakhq kodiakhq bot deleted the fix/revert-modal-upgrade branch September 19, 2024 13:35
thordurhhh pushed a commit that referenced this pull request Sep 19, 2024
kodiakhq bot pushed a commit that referenced this pull request Sep 19, 2024
This reverts commit 6bfcab3.

Co-authored-by: Þorkell Máni Þorkelsson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants