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(regulations-admin): Modal visible by default. Bugfixing. #14814

Merged
merged 6 commits into from
May 15, 2024

Conversation

thordurhhh
Copy link
Member

@thordurhhh thordurhhh commented May 15, 2024

What

Add the confirmation modal display to show by default.
Minor bugfixing

Why

Modal not visible enough.
Bugs need to be fixed yes.

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

    • Added an optional title prop to the confirmation modal for customizable headings.
  • Improvements

    • Enhanced state management in the Edit Basics component for a better user experience with modals and form handling.

@thordurhhh thordurhhh added the automerge Merge this PR as soon as all checks pass label May 15, 2024
@thordurhhh thordurhhh requested a review from a team as a code owner May 15, 2024 15:28
Copy link
Contributor

coderabbitai bot commented May 15, 2024

Walkthrough

The recent updates encompass improvements and adjustments across various components and utilities. The ConfirmModal component now offers the flexibility of an optional title prop for customization. Within EditBasics, there are refinements in state management with the introduction of new states and changes in types. Furthermore, formatting functions in formatAmendingRegulation.ts have been fine-tuned for enhanced text handling and conditional formatting.

Changes

File Path Change Summary
.../ConfirmModal/ConfirmModal.tsx Added optional title prop to ConfirmModal for a modal heading.
.../EditBasics.tsx Modified state declarations and types, changed DraftChangeForm to DraftImpactForm, added hasConfirmed and hasSeenModal states.
.../formatAmendingRegulation.ts Updated template strings and conditionals for improved text handling.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

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

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 08e214d and 54590ee.
Files selected for processing (3)
  • libs/portals/admin/regulations-admin/src/components/ConfirmModal/ConfirmModal.tsx (2 hunks)
  • libs/portals/admin/regulations-admin/src/components/EditBasics.tsx (5 hunks)
  • libs/portals/admin/regulations-admin/src/utils/formatAmendingRegulation.ts (3 hunks)
Additional Context Used
Path-based Instructions (3)
libs/portals/admin/regulations-admin/src/components/ConfirmModal/ConfirmModal.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/regulations-admin/src/components/EditBasics.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/regulations-admin/src/utils/formatAmendingRegulation.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."
Additional comments not posted (9)
libs/portals/admin/regulations-admin/src/components/ConfirmModal/ConfirmModal.tsx (2)

10-10: The addition of the title prop to the ConfirmModalProps interface is correct and enhances the component's flexibility.


18-18: The title prop is correctly destructured and used within the Text component to render the modal's title.

Also applies to: 40-40

libs/portals/admin/regulations-admin/src/components/EditBasics.tsx (4)

35-35: The references state now uses DraftImpactForm[] instead of DraftChangeForm[]. Ensure that this change is consistent with the rest of the codebase and that DraftImpactForm is the correct type to use here.


36-36: The default value of isModalVisible has been changed from false to true, which aligns with the objective of making the modal visible by default.


37-37: The hasConfirmed state variable has been added and initialized to false. This is a useful addition for tracking user confirmation actions.


38-38: The hasSeenModal state variable has been added and initialized to false. This is a useful addition for tracking whether the user has seen the modal.

libs/portals/admin/regulations-admin/src/utils/formatAmendingRegulation.ts (3)

29-29: The adjustment to the template strings for amendingTitles and repealTitles to conditionally remove a space after the prefix is a minor but important formatting change.

Also applies to: 37-37


267-267: The addition of the condition to check if newText is '<br />' when determining if an item is deleted is a necessary change to handle specific cases where the new text is just a line break.


369-369: Passing item.type to formatAmendingRegBody for conditional formatting is a logical change that ensures the correct formatting based on the item type.

Copy link
Member

@thorkellmani thorkellmani left a comment

Choose a reason for hiding this comment

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

LGTM (mostly)

@thorkellmani thorkellmani removed the automerge Merge this PR as soon as all checks pass label May 15, 2024
@thordurhhh thordurhhh added the automerge Merge this PR as soon as all checks pass label May 15, 2024
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

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 54590ee and d8aae29.
Files selected for processing (1)
  • libs/portals/admin/regulations-admin/src/components/EditBasics.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/portals/admin/regulations-admin/src/components/EditBasics.tsx

@datadog-island-is
Copy link

datadog-island-is bot commented May 15, 2024

Datadog Report

Branch report: regulations-admin/bugfixing-regs
Commit report: 554befb
Test service: portals-admin-regulations-admin

✅ 0 Failed, 24 Passed, 0 Skipped, 14.41s Total Time
🔻 Test Sessions change in coverage: 1 decreased (-0.01%)

🔻 Code Coverage Decreases vs Default Branch (1)

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

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between d8aae29 and 494bfea.
Files selected for processing (1)
  • libs/portals/admin/regulations-admin/src/utils/formatAmendingRegulation.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/portals/admin/regulations-admin/src/utils/formatAmendingRegulation.ts

Copy link

codecov bot commented May 15, 2024

Codecov Report

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

Project coverage is 36.90%. Comparing base (3213643) to head (7eb900c).
Report is 1 commits behind head on main.

❗ Current head 7eb900c differs from pull request most recent head 494bfea. Consider uploading reports for the commit 494bfea to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14814      +/-   ##
==========================================
- Coverage   36.90%   36.90%   -0.01%     
==========================================
  Files        6322     6322              
  Lines      128797   128808      +11     
  Branches    36729    36736       +7     
==========================================
  Hits        47535    47535              
- Misses      81262    81273      +11     
Flag Coverage Δ
portals-admin-regulations-admin 2.12% <0.00%> (-0.02%) ⬇️

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

Files Coverage Δ
...admin/src/components/ConfirmModal/ConfirmModal.tsx 0.00% <ø> (ø)
...ations-admin/src/utils/formatAmendingRegulation.ts 0.00% <0.00%> (ø)
...in/regulations-admin/src/components/EditBasics.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 08e214d...494bfea. Read the comment docs.

@kodiakhq kodiakhq bot merged commit 36271b4 into main May 15, 2024
23 checks passed
@kodiakhq kodiakhq bot deleted the regulations-admin/bugfixing-regs branch May 15, 2024 15:50
jonnigs pushed a commit that referenced this pull request May 17, 2024
* Fix amending bug

* fix titles. Fix reference error

* Add confirm modal

* Remove console log

* chore: nx format:write update dirty files

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: andes-it <builders@andes.is>
jonnigs pushed a commit that referenced this pull request May 17, 2024
* Fix amending bug

* fix titles. Fix reference error

* Add confirm modal

* Remove console log

* chore: nx format:write update dirty files

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: andes-it <builders@andes.is>
Ballioli pushed a commit that referenced this pull request May 17, 2024
* Fix amending bug

* fix titles. Fix reference error

* Add confirm modal

* Remove console log

* chore: nx format:write update dirty files

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: andes-it <builders@andes.is>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants