Skip to content

fix: resolved the navbar item link problem that leads to its respecti…#23

Open
akashmeapen wants to merge 1 commit intoAOSSIE-Org:mainfrom
akashmeapen:fix/navbar-item-link
Open

fix: resolved the navbar item link problem that leads to its respecti…#23
akashmeapen wants to merge 1 commit intoAOSSIE-Org:mainfrom
akashmeapen:fix/navbar-item-link

Conversation

@akashmeapen
Copy link

@akashmeapen akashmeapen commented Mar 14, 2026

##Description

  • This PR redirects the items on the navbar to their respective sections.

Addressed Issues:

Closes #22

Testing

  1. Clone the repo and run npm install and npm run dev
  2. Open http://localhost:5173
  3. Click on the items to go their respective sections.

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • New Features
    • Enhanced in-page navigation with smooth scrolling between sections.
    • Added new navigation links to Features, About, and Download sections.
    • Redesigned mobile menu with improved layout and streamlined navigation experience.
    • Scroll-to-top functionality on home link navigation for better usability.

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

Walkthrough

The PR adds anchor-based navigation to the website by introducing section identifiers (id attributes) to key page sections and implementing smooth scroll-to-section functionality in the navbar. This enables users to navigate to Features, About, and Download sections within the page, and provides a scrollToTop function for returning to the top.

Changes

Cohort / File(s) Summary
Anchor Point Setup
src/Pages/HowItWorks/HowItWorks.tsx, src/components/ui/Bouncy Card Features.tsx
Added id="about" and id="features" attributes to section elements respectively, creating anchor targets for in-page navigation.
Navigation Restructuring
src/Pages/Landing page/Navbar.tsx
Introduced scrollToTop helper function for animated top scrolling. Expanded desktop navigation with Features, About, and Download links using isScrollLink for smooth scrolling. Reorganized mobile menu layout (relocated outside nav element, added new header with logo and close button). Implemented menu close behavior on navigation and added scroll-to-top capability for Home link. Removed unused Button import.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

Typescript Lang

Poem

🐰✨ Hop through sections, smooth and bright,
Anchors guide us left and right,
Navbar whispers, "Come this way,"
Features, About—hopping to play!
A journey sweet through UI's dance! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title is truncated and vague. It says 'resolved the navbar item link problem that leads to its respecti…' but doesn't clearly convey what was fixed or how. Use a complete, descriptive title such as 'fix: add smooth scrolling navigation to page sections' that clearly explains the fix without truncation.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR successfully addresses issue #22 by implementing navbar links that redirect to respective page sections using scroll-to functionality, adding anchor IDs, and supporting in-page navigation on desktop and mobile.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing navbar navigation: adding anchor IDs to sections, implementing scroll-to functionality, updating NavLink component, and restructuring mobile menu. No unrelated modifications detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.

Add a configuration file to your project to customize how CodeRabbit runs oxc.

@github-actions github-actions bot added bug Something isn't working configuration Configuration file changes frontend Changes to frontend code javascript JavaScript/TypeScript code changes size/M Medium PR (51-200 lines changed) first-time-contributor First PR of an external contributor pending-coderabbit-review labels Mar 14, 2026
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: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Pages/Landing` page/Navbar.tsx:
- Around line 153-156: The Navbar currently hardcodes user-visible labels in
NavLink components (e.g., the "Home", "Features", "About", "Download" strings
and similar labels later in the file at the other noted ranges); replace these
literals with i18n resource lookups (use the existing i18n pattern in the
project, e.g., obtain a t function via useTranslation or the app's i18n helper)
and reference new keys like navbar.home, navbar.features, navbar.about,
navbar.download; add corresponding entries to the i18n resource files and update
all NavLink occurrences and any other hardcoded labels in this component
(including the other ranges called out) to use t('...') instead of string
literals so localization is consistent.
- Around line 197-202: The mobile menu container currently only translates
offscreen (uses isOpen) which leaves links focusable; update the menu container
(the <div> using isOpen in Navbar) so that when isOpen is false it also sets
aria-hidden="true" and hidden (or applies the inert attribute/polyfill) to
remove it from accessibility tree, and when isOpen is true remove
aria-hidden/hidden and restore focusability; additionally ensure any focusable
children get tabIndex={isOpen ? 0 : -1} (or use an inert polyfill) so closed
menus are not keyboard-focusable; apply the same changes to the other
mobile-menu block referenced (the second menu block around the other menu
markup).
- Around line 212-217: The mobile close button currently uses an onClick handler
(onClick={() => setIsOpen(false)}) but lacks an explicit type, so add
type="button" to that <button> in the Navbar component to prevent it from
defaulting to submit when rendered inside a form; locate the button that
contains the class string with "text-gray-800 dark:text-gray-300" and the
onClick calling setIsOpen(false) and add the type attribute there.
- Around line 204-211: The Home logo Link ("PictoPy") doesn't close the mobile
nav when clicked; add an onClick handler to the Link that closes the mobile menu
(e.g., onClick={() => setIsOpen(false)} or call the existing closeMobileMenu() /
setMobileMenuOpen(false) function used elsewhere) so clicking the "PictoPy" Link
also collapses the mobile menu.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 099885f4-d966-427a-8692-320068b31676

📥 Commits

Reviewing files that changed from the base of the PR and between 1496367 and e1e9d26.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • src/Pages/HowItWorks/HowItWorks.tsx
  • src/Pages/Landing page/Navbar.tsx
  • src/components/ui/Bouncy Card Features.tsx

Comment on lines +153 to +156
<NavLink to="/" onClick={scrollToTop}>Home</NavLink>
<NavLink to="#features" isScrollLink={true}>Features</NavLink>
<NavLink to="#about" isScrollLink={true}>About</NavLink>
<NavLink to="#downloads-section" isScrollLink={true}>Download</NavLink>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Externalize newly added navbar labels into i18n resources.

The added user-visible strings are hardcoded in JSX; move them to resource keys to keep localization consistent.

As per coding guidelines, Internationalization: User-visible strings should be externalized to resource files (i18n).

Also applies to: 206-210, 224-238

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Pages/Landing` page/Navbar.tsx around lines 153 - 156, The Navbar
currently hardcodes user-visible labels in NavLink components (e.g., the "Home",
"Features", "About", "Download" strings and similar labels later in the file at
the other noted ranges); replace these literals with i18n resource lookups (use
the existing i18n pattern in the project, e.g., obtain a t function via
useTranslation or the app's i18n helper) and reference new keys like
navbar.home, navbar.features, navbar.about, navbar.download; add corresponding
entries to the i18n resource files and update all NavLink occurrences and any
other hardcoded labels in this component (including the other ranges called out)
to use t('...') instead of string literals so localization is consistent.

Comment on lines +197 to +202
<div
className={`md:hidden fixed inset-0 z-[60]
bg-white dark:bg-black
transform transition-transform duration-300 ease-in-out
${isOpen ? "translate-x-0" : "-translate-x-full"}`}
>
<div className="pt-16 pb-6 px-4 space-y-6">
<div className="space-y-4 flex flex-col items-start">
<NavLink to="/" onClick={() => setIsOpen(false)}>
Home
</NavLink>
<NavLink to="#features" isScrollLink={true} onClick={() => setIsOpen(false)}>
Feature
</NavLink>
<NavLink to="#about" isScrollLink={true} onClick={() => setIsOpen(false)}>
About
</NavLink>
<Button
className="w-full bg-gray-800 dark:bg-black
text-white
hover:bg-green-700 dark:hover:bg-green-800
transition-colors duration-300 mt-4"
onClick={() => setIsOpen(false)}
>
Download
</Button>
</div>
>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Hidden mobile menu remains focusable when closed.

Using only translate-offscreen keeps interactive links in the DOM flow for accessibility tools/keyboard navigation. Make the closed state non-interactive and hidden.

Suggested fix
-      <div
-        className={`md:hidden fixed inset-0 z-[60] 
+      <div
+        aria-hidden={!isOpen}
+        className={`md:hidden fixed inset-0 z-[60] 
           bg-white dark:bg-black
           transform transition-transform duration-300 ease-in-out 
-          ${isOpen ? "translate-x-0" : "-translate-x-full"}`}
+          ${isOpen ? "translate-x-0 visible" : "-translate-x-full invisible pointer-events-none"}`}
       >

Also applies to: 222-238

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Pages/Landing` page/Navbar.tsx around lines 197 - 202, The mobile menu
container currently only translates offscreen (uses isOpen) which leaves links
focusable; update the menu container (the <div> using isOpen in Navbar) so that
when isOpen is false it also sets aria-hidden="true" and hidden (or applies the
inert attribute/polyfill) to remove it from accessibility tree, and when isOpen
is true remove aria-hidden/hidden and restore focusability; additionally ensure
any focusable children get tabIndex={isOpen ? 0 : -1} (or use an inert polyfill)
so closed menus are not keyboard-focusable; apply the same changes to the other
mobile-menu block referenced (the second menu block around the other menu
markup).

Comment on lines +204 to +211
<Link
to="/"
className="text-2xl font-bold
bg-gradient-to-r from-yellow-500 to-green-500
bg-clip-text text-transparent"
>
PictoPy
</Link>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Home logo click should also close the mobile menu.

Currently the menu state stays open after clicking the logo link.

Suggested fix
           <Link
             to="/"
+            onClick={() => {
+              scrollToTop();
+              setIsOpen(false);
+            }}
             className="text-2xl font-bold 
               bg-gradient-to-r from-yellow-500 to-green-500 
               bg-clip-text text-transparent"
           >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Pages/Landing` page/Navbar.tsx around lines 204 - 211, The Home logo Link
("PictoPy") doesn't close the mobile nav when clicked; add an onClick handler to
the Link that closes the mobile menu (e.g., onClick={() => setIsOpen(false)} or
call the existing closeMobileMenu() / setMobileMenuOpen(false) function used
elsewhere) so clicking the "PictoPy" Link also collapses the mobile menu.

Comment on lines +212 to +217
<button
onClick={() => setIsOpen(false)}
className="text-gray-800 dark:text-gray-300
hover:text-black dark:hover:text-white
transition-colors duration-300"
>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add explicit button type on the mobile close button.

Without type="button", it defaults to submit, which is fragile if this component is ever rendered inside a form.

Suggested fix
-          <button
+          <button type="button"
             onClick={() => setIsOpen(false)}
             className="text-gray-800 dark:text-gray-300 
               hover:text-black dark:hover:text-white 
               transition-colors duration-300"
           >
📝 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
onClick={() => setIsOpen(false)}
className="text-gray-800 dark:text-gray-300
hover:text-black dark:hover:text-white
transition-colors duration-300"
>
<button type="button"
onClick={() => setIsOpen(false)}
className="text-gray-800 dark:text-gray-300
hover:text-black dark:hover:text-white
transition-colors duration-300"
>
🧰 Tools
🪛 Biome (2.4.6)

[error] 212-217: Provide an explicit type prop for the button element.

(lint/a11y/useButtonType)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Pages/Landing` page/Navbar.tsx around lines 212 - 217, The mobile close
button currently uses an onClick handler (onClick={() => setIsOpen(false)}) but
lacks an explicit type, so add type="button" to that <button> in the Navbar
component to prevent it from defaulting to submit when rendered inside a form;
locate the button that contains the class string with "text-gray-800
dark:text-gray-300" and the onClick calling setIsOpen(false) and add the type
attribute there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working configuration Configuration file changes first-time-contributor First PR of an external contributor frontend Changes to frontend code javascript JavaScript/TypeScript code changes pending-coderabbit-review size/M Medium PR (51-200 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: navbar menu options do not redirect to the respective sections when clicked on.

1 participant