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

fix(auth-admin): Fix ui issues #16140

Merged
merged 11 commits into from
Sep 25, 2024
Merged

fix(auth-admin): Fix ui issues #16140

merged 11 commits into from
Sep 25, 2024

Conversation

magnearun
Copy link
Contributor

@magnearun magnearun commented Sep 24, 2024

What

Fixing ui issues with the paper delegation flow and adds success toast for successfully created delegation and navigate to delegation list for fromNationalId

Why

Have it match the design

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

  • New Features

    • Updated user-facing messages for delegation creation and reference ID.
    • Introduced a success notification for successful delegation creation.
  • Improvements

    • Enhanced layout structure for delegation admin screens, improving visual alignment and flexibility.
    • Adjusted navigation and response handling for delegation actions, focusing on data-centric communication.
  • Bug Fixes

    • Resolved issues with message accuracy in user notifications.

Copy link
Contributor

coderabbitai bot commented Sep 24, 2024

Walkthrough

The changes involve updates to user-facing messages in the delegation admin module, modifications to action handling in the CreateDelegation feature, and layout restructuring in various components. Key alterations include the introduction of a new success message, adjustments to the data returned from delegation actions, and enhancements to the UI layout for better flexibility and alignment. These modifications aim to improve the overall user experience in managing delegations.

Changes

File Path Change Summary
libs/portals/admin/delegation-admin/src/lib/messages.ts Updated default messages for createNewDelegation and referenceId; added createDelegationSuccessToast.
libs/portals/admin/delegation-admin/src/screens/CreateDelegation/*.ts Removed redirect import; updated CreateDelegationResult type; modified createDelegationAction return structure; added new async success function and successToast.
libs/portals/admin/delegation-admin/src/screens/DelegationAdminDetails/*.tsx Restructured layout by replacing GridRow and GridColumn with Box for improved alignment.
libs/portals/admin/delegation-admin/src/screens/Root.tsx Simplified layout by using Box for IntroHeader; removed unnecessary grid components.

Possibly related PRs

Suggested labels

automerge, high priority

Suggested reviewers

  • thordurhhh
  • jonnigs

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.

@magnearun magnearun marked this pull request as ready for review September 25, 2024 09:47
@magnearun magnearun requested a review from a team as a code owner September 25, 2024 09:47
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: 4

🧹 Outside diff range and nitpick comments (3)
libs/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.action.ts (1)

85-92: LGTM: Improved createDelegationAction return structure and error handling

The changes to the createDelegationAction function are well-implemented:

  1. The new return object structure provides more detailed information about the action result, which aligns with the PR objective of adding a success toast notification.
  2. The removal of the redirect allows for more flexible navigation handling, supporting the implementation of navigation to the delegation list.
  3. The addition of error logging improves debugging capabilities.

These changes adhere to the coding guidelines for reusability and TypeScript usage.

Consider using a constant for the success message to improve maintainability:

const SUCCESS_MESSAGE = 'Delegation created successfully';

// In the return statement
return {
  errors: null,
  data: null,
  globalError: false,
  success: true,
  message: SUCCESS_MESSAGE,
};

This approach would make it easier to update the success message in the future if needed.

libs/portals/admin/delegation-admin/src/lib/messages.ts (1)

120-123: LGTM: Added success toast message for delegation creation

The addition of the createDelegationSuccessToast message is a good improvement. It provides user feedback when a delegation is successfully created, enhancing the user experience.

Consider adding a period at the end of the message for consistency with other messages in the file:

-    defaultMessage: 'Umboð var skráð',
+    defaultMessage: 'Umboð var skráð.',
libs/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.tsx (1)

121-121: Simplify the condition when calling getFromNationalId().

Using double negation !! is unnecessary when checking for truthiness.

You can simplify the condition:

-    !!defaultFromNationalId && getFromNationalId()
+    if (defaultFromNationalId) {
+      getFromNationalId()
+    }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 621b5bb and d40eda5.

📒 Files selected for processing (5)
  • libs/portals/admin/delegation-admin/src/lib/messages.ts (3 hunks)
  • libs/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.action.ts (2 hunks)
  • libs/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.tsx (5 hunks)
  • libs/portals/admin/delegation-admin/src/screens/DelegationAdminDetails/DelegationAdmin.tsx (2 hunks)
  • libs/portals/admin/delegation-admin/src/screens/Root.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
libs/portals/admin/delegation-admin/src/lib/messages.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/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.action.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/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.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/portals/admin/delegation-admin/src/screens/DelegationAdminDetails/DelegationAdmin.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/portals/admin/delegation-admin/src/screens/Root.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."
🔇 Additional comments not posted (12)
libs/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.action.ts (2)

53-53: LGTM: Addition of success property to CreateDelegationResult

The addition of the success property to the CreateDelegationResult type is a good improvement. It aligns with the PR objective of adding a success toast notification and follows the TypeScript usage guideline for defining types in the libs directory.


85-90: Verify implementation of success toast and navigation

The changes in this file provide the necessary structure to support adding a success toast notification and implementing navigation to the delegation list. However, the actual implementation of these features is not present in this file.

Please ensure that the success toast notification and navigation to the delegation list are implemented in the appropriate component or hook that consumes the result of this action. You can use the following script to verify the implementation:

libs/portals/admin/delegation-admin/src/screens/Root.tsx (4)

10-10: LGTM: Import of Box component

The addition of the Box component import from the shared UI library aligns with the layout changes and supports reusability across different NextJS apps.


52-73: Improved layout structure, but clarification needed

The changes to the IntroHeader component improve the layout structure and flexibility:

  • Simplified IntroHeader props
  • Added Box component for better alignment and responsiveness
  • Improved button placement within the header

However, it's not immediately clear how these changes relate to the PR objectives of fixing UI issues in the paper delegation flow. Could you please clarify the connection?


75-76: Improved layout structure, but clarification needed

The addition of the GridRow and adjustment of the GridColumn span improve the overall layout structure and maintain responsive design. However, it's not clear how these changes relate to the PR objectives of fixing UI issues in the paper delegation flow. Could you please elaborate on the connection?


Line range hint 1-108: LGTM: Adherence to coding guidelines

The changes in this file adhere to the coding guidelines for the libs directory:

  • TypeScript is used effectively for defining props and types.
  • Components and hooks are reusable across different NextJS apps.
  • The use of shared UI components (e.g., Box, GridColumn) supports effective tree-shaking and bundling practices.

Good job on maintaining code quality and following the established guidelines.

libs/portals/admin/delegation-admin/src/screens/DelegationAdminDetails/DelegationAdmin.tsx (2)

1-1: Approved: Import statement updated to support layout changes

The modification of the import statement, adding Box and removing GridRow, aligns well with the layout restructuring in the component. This change supports better reusability across different NextJS apps, as per our coding guidelines.


Line range hint 1-66: Approved: Improved component structure while maintaining functionality

The overall changes to the DelegationAdminScreen component have improved its structure by simplifying the layout and removing unnecessary grid components. The core functionality remains intact, and the component continues to use TypeScript consistently, ensuring type safety.

These modifications align well with our coding guidelines for libs/**/* files, particularly in terms of:

  1. Enhancing reusability across different NextJS apps
  2. Maintaining proper TypeScript usage for props and exported types
  3. Supporting effective tree-shaking and bundling practices

The restructured component is more flexible and maintainable while preserving its original functionality.

libs/portals/admin/delegation-admin/src/lib/messages.ts (3)

22-22: LGTM: Improved wording for createNewDelegation message

The change from "Stofna nýtt umboð" to "Skrá nýtt umboð" is a good refinement. The new wording "Skrá" (Register) might be more accurate than "Stofna" (Create) in this context, potentially improving user understanding.


Line range hint 1-123: Overall assessment: Changes align with PR objectives and coding guidelines

The modifications in this file successfully address the PR objectives by improving UI text and adding a success notification for delegation creation. The changes adhere to the coding guidelines for libs/**/* files:

  1. The file uses TypeScript for defining and exporting types.
  2. The messages are defined in a way that allows for effective tree-shaking and bundling.
  3. These message definitions are reusable across different NextJS apps within the project.

The changes improve the user experience and maintain consistency with the existing codebase structure and practices.


82-82: LGTM: Clarified referenceId message

The change from "Númer mála í Zendesk" to "Númer máls í Zendesk" improves clarity. It now correctly indicates that each delegation is associated with a single Zendesk case rather than multiple cases.

To ensure consistency, please verify that this singular form is used throughout the codebase where Zendesk case numbers are referenced. You can use the following script:

✅ Verification successful

Verified: Singular 'máls' Consistently Used

The singular form 'máls' is consistently used in all instances referencing Zendesk case numbers within the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for occurrences of 'Zendesk' to verify consistent usage of singular 'máls'
rg --type typescript --type javascript "Zendesk"

Length of output: 83


Script:

#!/bin/bash
# Search for occurrences of 'Zendesk' to verify consistent usage of singular 'máls'
rg --type ts --type js "máls.*Zendesk"

Length of output: 255

libs/portals/admin/delegation-admin/src/screens/CreateDelegation/CreateDelegation.tsx (1)

369-370: Verify the label property in the DatePicker component.

The label for the DatePicker is set using formatMessage(m.type), which may not match the intended label for this field.

Please confirm if the label should be using m.validTo instead:

 <DatePicker
   name="validToPicker"
-  label={formatMessage(m.type)}
+  label={formatMessage(m.validTo)}
   // other props
 />

If m.validTo provides the correct label (e.g., "Valid To"), this change will improve the form's clarity.

Copy link
Member

@GunnlaugurG GunnlaugurG left a comment

Choose a reason for hiding this comment

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

✍️

@magnearun magnearun added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 25, 2024
@datadog-island-is
Copy link

datadog-island-is bot commented Sep 25, 2024

Datadog Report

All test runs d0a778f 🔗

2 Total Test Services: 0 Failed, 2 Passed
➡️ Test Sessions change in coverage: 4 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 4.88s 1 no change Link
web 0 0 0 84 0 31.41s 1 no change Link

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.64%. Comparing base (9e0fd78) to head (5d0861c).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16140   +/-   ##
=======================================
  Coverage   36.64%   36.64%           
=======================================
  Files        6769     6769           
  Lines      139439   139439           
  Branches    39656    39656           
=======================================
  Hits        51100    51100           
  Misses      88339    88339           
Flag Coverage Δ
judicial-system-web 28.19% <ø> (ø)
web 1.83% <ø> (ø)

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


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 9e0fd78...5d0861c. Read the comment docs.

@kodiakhq kodiakhq bot merged commit 8f37c3d into main Sep 25, 2024
38 checks passed
@kodiakhq kodiakhq bot deleted the fix/create-delegation-form-ui branch September 25, 2024 13:27
thoreyjona pushed a commit that referenced this pull request Oct 2, 2024
* fix alignment issues on root screen

* fixes alignment issues on details screen

* success toast on create and only allow future dates in datepicker

* navigate to delegation list for from nationalId when create is successful

* add appearInline to datepicker

* remove comment

* chore: nx format:write update dirty files

* refactor

---------

Co-authored-by: andes-it <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
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.

3 participants