Skip to content

Conversation

@Dishant1804
Copy link
Collaborator

@Dishant1804 Dishant1804 commented Mar 15, 2025

Resolves #700

  • Sidebar migrated to ChakraUI and it is now more clean and readable
  • Fixed the responsive behaviour of home page

Before

2025-03-15.19-16-59.mp4

After

2025-03-15.19-17-42.mp4

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2025

Summary by CodeRabbit

  • New Features

    • Mobile menu now uses a modern modal interface for a smoother and more intuitive navigation experience on mobile devices.
  • Style

    • Updated home page layouts improve responsiveness with enhanced text wrapping and clear element alignment across various screen sizes.

Walkthrough

This pull request refactors the mobile menu functionality in the Header component by replacing a custom outside click handler with Chakra UI’s Drawer and Portal components. The implementation now uses the onInteractOutside prop to manage menu closure. Additionally, the Home page has been updated to improve responsiveness by adjusting text wrapping and flex layouts for various screen sizes, along with minor structural refinements.

Changes

File(s) Change Summary
frontend/.../Header.tsx Refactored mobile menu: replaced custom click outside handling with Chakra UI’s Drawer (and Portal) using onInteractOutside; removed previous handleOutsideClick function and related event listener.
frontend/.../Home.tsx Modified typography and layout: updated <h3> classes for text wrapping; altered flex container layouts from flex-wrap to flex-col on small screens and flex-row on larger screens; encapsulated post author names in a <div>.
frontend/.../e2e/pages/Contribute.spec.ts Updated dialog interaction test: simplified button retrieval and visibility checks for dialog content and links to improve clarity and reduce reliance on specific locators.

Possibly related PRs

  • migrate: footer component to chakra-ui #1018: The changes in the main PR for the Header.tsx file, which involve refactoring to use Chakra UI components, are related to the changes in the retrieved PR for the Footer.tsx file, as both involve migrating components to utilize Chakra UI for improved styling and structure.

Suggested labels

frontend-tests

Suggested reviewers

  • kasya
  • arkid15r

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50819f1 and ce87e6e.

📒 Files selected for processing (1)
  • frontend/__tests__/e2e/pages/Contribute.spec.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: Run frontend unit tests
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run backend tests
🔇 Additional comments (4)
frontend/__tests__/e2e/pages/Contribute.spec.ts (4)

44-44: Improved element selection for better test reliability.

The changes here improve the test by:

  1. Correctly removing the unnecessary await since getByRole() returns a Locator, not a Promise
  2. Adding .first() to specifically target the first matching button, making the test more robust if multiple "Read More" buttons exist

46-47: Better dialog handling approach.

Storing the dialog element in a variable and then checking its visibility is a good practice for:

  1. Better code organization
  2. Reusability throughout the test
  3. Clearer intent of what's being tested

49-52: Improved text verification within dialog context.

Scoping the text verification to within the dialog context using dialog.getByText() instead of page-level verification makes the test more precise and less susceptible to false positives if similar text appears elsewhere on the page.


53-53: Better link verification scoping.

Checking for the "View Issue" link within the dialog context rather than globally on the page ensures you're verifying the correct element, making the test more accurate and reliable.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

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.

@Dishant1804
Copy link
Collaborator Author

image

The test which is failing is not even related to the issue and i haven't even touched the contribute page 🤷‍♂️
how come it is failing here🤔

@Dishant1804
Copy link
Collaborator Author

Dishant1804 commented Mar 15, 2025

image

The test which is failing is not even related to the issue and i haven't even touched the contribute page 🤷‍♂️ how come it is failing here🤔

I have fixed the test, there was no requirement of the dynamic id as it can vary, also all the expected things are now rendered correctly, thus passing the tests and giving us expected outcome :)

@Dishant1804 Dishant1804 changed the title Header migration to chakra ui Sidebar migration to chakra ui Mar 15, 2025
@arkid15r arkid15r enabled auto-merge March 15, 2025 16:28
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

@arkid15r arkid15r added this pull request to the merge queue Mar 15, 2025
Merged via the queue into OWASP:main with commit b90b337 Mar 15, 2025
18 checks passed
shdwcodr pushed a commit to shdwcodr/Nest that referenced this pull request Jun 5, 2025
* navbar improvements

* fixed contibute e2e test

* checks and lint

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrating header to chakra Ui component

2 participants