Skip to content

Conversation

@ZendeAditya
Copy link
Contributor

@ZendeAditya ZendeAditya commented Apr 18, 2025

Date: 18/04/2025

Developer Name: aditya-zende-1


Issue Ticket Number

#1312

Description

To Remove a feature flag from PR so that cross button will show on modal.

Remove a feature flag from #1312 PR.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1
rds.status.mp4

Test Coverage

Screenshot 1

image

Additional Notes

@coderabbitai
Copy link

coderabbitai bot commented Apr 18, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Summary by CodeRabbit

  • New Features

    • Added a close button to the Task Update Modal, allowing users to easily dismiss the modal.
  • Style

    • Introduced new styles for the close button and adjusted modal container positioning for improved layout and accessibility.
  • Tests

    • Updated test suite to ensure Task Update Modal is tested within the appropriate router context and improved modal mock for better accessibility.

Walkthrough

The updates introduce a close button to the TaskUpdateModal component, styled and positioned using new SCSS rules. The component now imports an icon for the close button and removes unused router-related imports. The test suite for TaskUpdateModal is updated to use a custom renderWithRouter utility, ensuring the component is always rendered within a router context. The modal mock in the tests is also adjusted for conditional rendering and accessibility. No changes were made to the public API of the component.

Changes

File(s) Change Summary
src/components/taskDetails/TaskUpdateModal.tsx Replaced useRouter import with close icon import; added a close button with accessibility attributes and handler.
src/components/taskDetails/task-details.module.scss Added .closeButton class for absolute-positioned close button; set .taskUpdateModal to position: relative;.
tests/Unit/Components/Tasks/TaskUpdateModal.test.tsx Switched from direct render to renderWithRouter; improved modal mock for accessibility and conditional rendering.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TaskUpdateModal
    participant CloseButton

    User->>TaskUpdateModal: Opens modal
    TaskUpdateModal->>User: Displays modal content with close button
    User->>CloseButton: Clicks close button
    CloseButton->>TaskUpdateModal: Triggers onClick handler
    TaskUpdateModal->>User: Closes modal
Loading

Poem

Oh, a button now closes the modal with grace,
Styled in the corner, it found its right place.
With icons and tests, the code hops along,
Wrapped in a router, where all routes belong.
A click and a wink, the modal is gone—
Another small hop, and the journey goes on!
🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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 generate docstrings to generate docstrings for this 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.

CodeRabbit Configuration 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

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf3e03 and eef33c3.

📒 Files selected for processing (3)
  • __tests__/Unit/Components/Tasks/TaskUpdateModal.test.tsx (8 hunks)
  • src/components/taskDetails/TaskUpdateModal.tsx (2 hunks)
  • src/components/taskDetails/task-details.module.scss (3 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
__tests__/Unit/Components/Tasks/TaskUpdateModal.test.tsx

[error] 16-20: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

src/components/taskDetails/TaskUpdateModal.tsx

[error] 31-36: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

🔇 Additional comments (5)
src/components/taskDetails/task-details.module.scss (2)

245-251: LGTM! Good positioning setup for the modal.

Adding position: relative to the .taskUpdateModal class provides the necessary context for absolute positioning of the close button that was added. This is the correct approach.


253-265: Well-implemented close button styling.

The styling for the close button is properly implemented with absolute positioning and appropriate hover effects. The color change from gray to black on hover provides good visual feedback to users.

src/components/taskDetails/TaskUpdateModal.tsx (1)

8-8: LGTM! Good icon choice for modal closure.

The import of IoMdClose from react-icons is appropriate for implementing a close button.

__tests__/Unit/Components/Tasks/TaskUpdateModal.test.tsx (2)

2-2: LGTM! Proper test utility import.

Good refactoring to use the specialized renderWithRouter instead of the basic render function, which ensures the component is properly tested within a router context.

Also applies to: 10-10


71-75: LGTM! Consistent test rendering.

All test cases have been properly updated to use renderWithRouter instead of render, maintaining consistency throughout the test suite.

Also applies to: 88-92, 101-105, 117-121, 133-137, 143-147, 170-177

Comment on lines +31 to +38
<button
className={styles.closeButton}
onClick={() => setIsOpen(false)}
data-testid="task-update-modal-close-button"
aria-label="Close"
>
<IoMdClose size={25} />
</button>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add explicit button type for accessibility.

The close button implementation is good, but it's missing an explicit type attribute which is required for accessibility compliance.

<button
    className={styles.closeButton}
    onClick={() => setIsOpen(false)}
    data-testid="task-update-modal-close-button"
    aria-label="Close"
+   type="button"
>
    <IoMdClose size={25} />
</button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
className={styles.closeButton}
onClick={() => setIsOpen(false)}
data-testid="task-update-modal-close-button"
aria-label="Close"
>
<IoMdClose size={25} />
</button>
<button
className={styles.closeButton}
onClick={() => setIsOpen(false)}
data-testid="task-update-modal-close-button"
aria-label="Close"
type="button"
>
<IoMdClose size={25} />
</button>
🧰 Tools
🪛 Biome (1.9.4)

[error] 31-36: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

Comment on lines 13 to 26
jest.fn(({ isOpen, toggle, children }) =>
isOpen ? (
<div data-testid="mock-modal">
<button
data-testid="close-modal"
onClick={toggle}
aria-label="Close"
>
Close
</button>
{children}
</div>
) : null
)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add button type in the Modal mock.

The Modal mock needs the same accessibility fix as the main component - an explicit button type.

<button
    data-testid="close-modal"
    onClick={toggle}
    aria-label="Close"
+   type="button"
>
    Close
</button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
jest.fn(({ isOpen, toggle, children }) =>
isOpen ? (
<div data-testid="mock-modal">
<button
data-testid="close-modal"
onClick={toggle}
aria-label="Close"
>
Close
</button>
{children}
</div>
) : null
)
jest.fn(({ isOpen, toggle, children }) =>
isOpen ? (
<div data-testid="mock-modal">
<button
data-testid="close-modal"
onClick={toggle}
aria-label="Close"
type="button"
>
Close
</button>
{children}
</div>
) : null
)
🧰 Tools
🪛 Biome (1.9.4)

[error] 16-20: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

@ZendeAditya ZendeAditya force-pushed the remove/feature-flag branch from eef33c3 to d7433ce Compare April 18, 2025 15:06
@vercel
Copy link

vercel bot commented Apr 18, 2025

@ZendeAditya is attempting to deploy a commit to the RDS-Team Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@AnujChhikara AnujChhikara left a comment

Choose a reason for hiding this comment

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

why do we have removed all the test cases?

@ZendeAditya
Copy link
Contributor Author

why do we have removed all the test cases?

I accidentally remove first test case will add again

@ZendeAditya
Copy link
Contributor Author

Hey @AnujChhikara, I added the test case and remainings are running ok

Copy link
Contributor

@AnujChhikara AnujChhikara left a comment

Choose a reason for hiding this comment

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

Can we please write better PR title?

Copy link
Contributor

@AnujChhikara AnujChhikara left a comment

Choose a reason for hiding this comment

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

couldn’t find any proof or demo showing the changes working

@ZendeAditya ZendeAditya changed the title Remove/feature flag Remove Feature flag from #1312 Apr 20, 2025
@ZendeAditya
Copy link
Contributor Author

Video added

@ZendeAditya
Copy link
Contributor Author

Hey @AnujChhikara can you please check now

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