Skip to content

Conversation

@harshita8120
Copy link

Resolves #3272 - Fix navbar items overflow on medium screens

This PR addresses the issue where navbar items would overlap or become inaccessible on medium-sized screens (768px - 1024px). Earlier in the specified screen size range (768px - 1024px), the sign in and theme change buttons were inaccessible due to overflow of the items in the navbar.

Changes Made:

  • Updated the responsive breakpoints in "Header.tsx" from md to lg.

  • Screenshots for different screen sizes after the changes were made:

Screenshot (72) Screenshot (73) Screenshot (74)

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

Summary by CodeRabbit

  • Style
    • Adjusted header responsive breakpoints so desktop navigation and mobile menu toggle appear at a larger screen-width threshold, changing when desktop vs. mobile header layouts are shown.
  • Tests
    • Updated unit tests to align with the new header breakpoint and expected responsive behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Header breakpoint moved from 768px to 1024px: Header component and shared constant now use the larger desktop breakpoint; unit test mock updated accordingly to reflect the new threshold.

Changes

Cohort / File(s) Summary
Header & breakpoint constant
frontend/src/components/Header.tsx, frontend/src/utils/constants.ts
Swapped md breakpoint usage for lg variants and updated desktopViewMinWidth from 768 to 1024, shifting when desktop vs. mobile header elements render.
Unit tests
frontend/__tests__/unit/pages/Header.test.tsx
Replaced static mock with forwarded real constants and an override to set desktopViewMinWidth to 1024, aligning tests with the new breakpoint.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • arkid15r
  • kasya
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adjusting navbar breakpoints to lg to prevent overflow, directly matching the core purpose of the PR.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, detailing the overflow issue on medium screens, the changes made, and including verification screenshots.
Linked Issues check ✅ Passed The PR successfully addresses issue #3272 by updating responsive breakpoints from md to lg in Header.tsx and synchronizing the breakpoint constant to 1024 across all files, resolving the navbar overflow issue on medium screens (768px-1024px).
Out of Scope Changes check ✅ Passed All changes are directly scoped to resolving the navbar overflow issue: breakpoint updates in Header.tsx, constant synchronization to 1024, and corresponding test updates. No out-of-scope modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 1

🤖 Fix all issues with AI agents
In @frontend/src/components/Header.tsx:
- Line 61: The breakpoint constant desktopViewMinWidth is still 768 causing JS
to mismatch the CSS lg breakpoint; update desktopViewMinWidth from 768 to 1024
in frontend/src/utils/constants.ts, ensure the useIsMobile hook (which reads
desktopViewMinWidth) will now treat widths <1024 as mobile, and adjust the
Header.tsx handleResize logic (and any checks referencing desktopViewMinWidth or
directly using 768 in Header.tsx) so the mobile menu closes at >=1024; also
update the unit test mock in frontend/__tests__/unit/pages/Header.test.tsx to
use 1024 instead of 768 so tests reflect the new breakpoint.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42459af and 73c025a.

📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx

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

🧹 Nitpick comments (1)
frontend/__tests__/unit/pages/Header.test.tsx (1)

107-130: LGTM! Mock value correctly synchronized with the updated constant.

The mock value desktopViewMinWidth: 1024 matches the actual constant in constants.ts.

Consider importing the actual constant instead of hardcoding the value in the mock. This would prevent the values from drifting out of sync in future updates:

♻️ Suggested improvement
+import { desktopViewMinWidth, headerLinks } from 'utils/constants'
+
 // Mock constants
-jest.mock('utils/constants', () => ({
-  desktopViewMinWidth: 1024,
-  headerLinks: [
+jest.mock('utils/constants', () => {
+  const actual = jest.requireActual('utils/constants')
+  return {
+    ...actual,
     // Override only if needed for specific test scenarios
-    ...
-  ],
-}))
+  }
+})

Alternatively, if the full mock is intentional for test isolation, the current approach is acceptable.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73c025a and 1846885.

📒 Files selected for processing (2)
  • frontend/__tests__/unit/pages/Header.test.tsx
  • frontend/src/utils/constants.ts
🔇 Additional comments (2)
frontend/__tests__/unit/pages/Header.test.tsx (1)

191-207: Consistent test setup with the new breakpoint.

The globalThis.innerWidth value of 1024 on line 198 correctly aligns with the updated desktopViewMinWidth constant, ensuring tests run at the desktop view threshold.

frontend/src/utils/constants.ts (1)

125-125: Breakpoint constant correctly aligned with Tailwind's lg breakpoint.

The change to 1024 consistently applies across the codebase:

  • JS constant matches Tailwind's lg breakpoint
  • CSS classes properly updated (lg:block, lg:table-cell, etc.)
  • Test mocks synchronized to 1024
  • All usages (Header resize handler, useIsMobile hook) operate correctly with the new value

@harshita8120
Copy link
Author

Thank you for the suggestion! I've synchronized the hardcoded values to 1024 across the constants and tests to ensure consistency, but I’m choosing to keep the code simple and consistent with how the rest of the project is written.

Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

@harshita8120 hi! Thanks for working on this! Left a question/request.
Also, please resolve CodeRabbit comment.

Also please run make check-test and address found issues before pushing to remote - you haven't done that this time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This works good overall 👍🏼

One thing I noticed is that when we are at a 1024 and collaps some of the menus - the button are now still showing in the Header until 768 breakpoint. However, we also have them in the menu on the side. This causes Star and Sponsor buttons to show up in both places.

Do you think you can update that?

Image

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, sure, I'll shortly update this.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 16, 2026
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: 1

🤖 Fix all issues with AI agents
In `@frontend/__tests__/unit/pages/Header.test.tsx`:
- Around line 106-126: Remove the duplicate "// Mock constants" comment and
replace the vague "// Matches your logic" with a clearer note describing the
breakpoint; update the jest.mock block that overrides utils/constants (the
desktopViewMinWidth and headerLinks mock) to have a single "// Mock constants"
header and change the desktopViewMinWidth inline comment to something like "//
Updated breakpoint threshold for lg screens" so the purpose is explicit.

@sonarqubecloud
Copy link

@harshita8120 harshita8120 requested a review from kasya January 16, 2026 23:12
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.

Hidden parts of the navbar on the screens of medium screens

2 participants