Skip to content

feat: add responsive navbar and replace sidebar navigation - #316

Open
Sargam-Ghagre wants to merge 1 commit into
ionfwsrijan:mainfrom
Sargam-Ghagre:feat/responsive-navbar
Open

feat: add responsive navbar and replace sidebar navigation#316
Sargam-Ghagre wants to merge 1 commit into
ionfwsrijan:mainfrom
Sargam-Ghagre:feat/responsive-navbar

Conversation

@Sargam-Ghagre

@Sargam-Ghagre Sargam-Ghagre commented Jul 12, 2026

Copy link
Copy Markdown

Linked issue

Closes #313

What this PR does

This PR adds a responsive top navigation bar to improve navigation and accessibility across the application.

It replaces the previous sidebar-based navigation with a modern responsive navbar while preserving the existing routing and theme functionality.

Type of change

  • Bug fix
  • New feature
  • ML model / training pipeline
  • Refactor (no behaviour change)
  • Documentation
  • Tests only

ML tier (if applicable)

  • Tier 1 — Triage
  • Tier 2 — Predictive
  • Tier 3 — Autonomous
  • Not ML-related

Stack affected

  • Backend
  • Frontend
  • Both

Changes

Backend

  • No backend changes.

Frontend

  • Added a responsive AppNavbar component.
  • Replaced sidebar-based navigation with a top navbar.
  • Added navigation links for Dashboard, Findings, Fixes, Verify, and Leaderboard.
  • Integrated theme toggle into the navbar.
  • Updated the root layout.
  • Improved responsive navigation for desktop and mobile.

New dependencies

  • None

Database / schema changes

  • None

Testing

How did you test this?

  • Ran the application locally using npm run dev.
  • Verified navigation across all pages.
  • Tested responsiveness on desktop and mobile screen sizes.
  • Verified theme toggle functionality.
  • Confirmed routing works correctly after replacing the sidebar.

Checklist

  • Tested locally end-to-end
  • New ML model falls back gracefully when model file is absent (Not Applicable)
  • No new console.error or unhandled Python exceptions introduced
  • Added or updated tests where applicable
  • requirements.txt / package.json updated if new dependencies added (Not Applicable)
  • New model files (.pkl, .pt, etc.) are gitignored, not committed

Anything reviewers should focus on

Please review the responsive behavior, routing integration, and overall UI consistency of the new navigation bar.

Screenshot

Screenshot 2026-07-12 220217

@github-actions

Copy link
Copy Markdown

🎉 Thank you @Sargam-Ghagre for submitting a Pull Request!

We're excited to review your contribution.

Before Review

✅ Ensure all CI checks pass
✅ Complete the PR template
✅ Link the related issue

Want faster reviews and contributor support?

Join our Discord community:

🔗 https://discord.gg/FcXuyw2Rs

Maintainers and mentors are active there and can help resolve blockers quickly.

Happy Contributing! 🚀

@github-actions github-actions Bot added SSoC26 needs-work Work needed backend Backend issues feature New feature frontend Frontend issues and removed needs-work Work needed labels Jul 12, 2026
@github-actions
github-actions Bot requested a review from arpit2006 July 12, 2026 16:34
@github-actions

Copy link
Copy Markdown

PR template check passed!

@arpit2006 this PR is ready for your review. 🚀

@arpit2006 arpit2006 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR #316 Review — Responsive Top Navigation Bar

Verdict: 🔴 Changes Requested

Scope Check (Pass ✅)

Unlike many recent PRs in this repo, the actual commit is focused. The single commit 6bf5778 touches only 2 files:

  • frontend/src/app/components/AppNavbar.tsx (new, +100 lines)
  • frontend/src/app/pages/root.tsx (modified, +22/-25 lines)

The 3,189-line diff in the --stat output is entirely noise from the branch base — this branch was forked from a commit that included several already-merged PRs (#295, #266, #264, etc.). The contributor's own work is clean and tightly scoped. ✅


Critical Bugs 🔴

1. setMobileSidebarOpen is called but useState was removed — Runtime Crash

root.tsx calls AppTopBar with:

<AppTopBar onMenuClick={() => setMobileSidebarOpen(true)} />

But this commit also removed the line:

const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);

setMobileSidebarOpen is now undefined. This will throw a ReferenceError at runtime the moment the mobile hamburger button is tapped. The app will crash on mobile.

Fix: Either remove AppTopBar entirely (since AppNavbar now owns navigation), or restore the state and wire it to the sidebar it controls.

2. Broken HTML structure in root.tsx — Mismatched </div>

The refactored JSX has a structural error:

<div className="min-h-screen bg-background">
  <div className="min-h-screen md:pl-20">
    <AppTopBar ... />
    <AppNavbar />
    {/* degraded banner */}
    <main>...</main>
  </div>
</div >   {/* ← trailing space before '>' is harmless but sloppy */}

The <main> and the degraded banner are outside the inner <div className="md:pl-20"> — the closing </div> for the inner wrapper appears after <AppNavbar />, before the banner and <main>. This means the sidebar left-padding (md:pl-20) will only apply to the topbar and navbar, not the page content.

Important

Since AppSidebar was removed but md:pl-20 is still on the wrapper, the left padding now just creates 80px of dead space on desktop with nothing filling it.

3. Dead UI: AppTopBar serves no purpose post-refactor

AppSidebar is imported but never rendered (it was removed from the JSX). AppTopBar was part of the sidebar pattern — it rendered the hamburger menu that toggled AppSidebar. Now that AppSidebar is gone:

  • The hamburger button in AppTopBar does nothing (crashes due to bug #1).
  • The AppTopBar component renders "PatchPilot" centered in a <header> — this is now a second navigation bar sitting directly on top of AppNavbar.
  • Users see two stacked nav bars: the top bar (header) + the new AppNavbar.

Design / Functional Issues 🟡

4. No mobile navigation

The center nav (hidden md:flex) is hidden on mobile. The ThemeSwitch is the only visible element in the AppNavbar on small screens. No hamburger menu or drawer is wired (it was intentionally removed, but nothing replaced it).

The old <MobileNav /> bottom bar component was also removed from root.tsx. Mobile users now have no navigation whatsoever.

Fix: Add a mobile drawer or keep <MobileNav /> for mobile breakpoints. At minimum, a hamburger that opens a drawer.

5. Hardcoded top-16 offset breaks if AppTopBar is removed

AppNavbar has sticky top-16 — this offset assumes a 64px (h-16) element above it. If the contributor later removes AppTopBar, this will stick to the wrong position.

6. "Navigation" label is a placeholder

The "Left" section of the navbar renders the literal string "Navigation". This should be a logo, app name, or brand mark — not a generic word.

{/* Left */}
<div className="font-semibold text-sm tracking-wide">
  Navigation   {/* ← placeholder text */}
</div>

7. Duplicate lucide-react import in AppNavbar.tsx

import { Home, FileSearch, Wrench, ShieldCheck, Trophy } from "lucide-react";
import { useTheme } from "./theme-provider";
import { Moon, Sun } from "lucide-react";   // ← second import from same package

These two lucide-react imports should be merged into one. ESLint will flag this.

8. Missing aria-label on the theme toggle button

The ThemeSwitch button has no aria-label or <span className="sr-only"> — screen readers cannot identify it. The sidebar's ThemeSwitch correctly uses sr-only; this component doesn't.


Summary Table

# Severity Issue
1 🔴 Critical setMobileSidebarOpen is used but removed → runtime ReferenceError crash
2 🔴 Critical JSX structure broken: <main> and degraded banner fall outside md:pl-20 wrapper
3 🔴 Critical AppTopBar triggers crash + creates duplicate/redundant nav bar
4 🟡 Major No mobile navigation after removing MobileNav
5 🟡 Minor top-16 offset is fragile / dependent on AppTopBar presence
6 🟡 Minor Placeholder "Navigation" label should be a logo/brand name
7 🟢 Style Duplicate lucide-react import
8 🟢 A11y Missing aria-label / sr-only on theme toggle button

Recommended Changes

  1. Remove AppTopBar from root.tsx. Move the "PatchPilot" brand name directly into AppNavbar's left slot, replacing the "Navigation" placeholder. This collapses the double-header issue.
  2. Delete the setMobileSidebarOpen call or restore mobile state if a drawer is needed.
  3. Fix the JSX nesting — the inner div.md:pl-20 and the outer wrapper are no longer needed without a sidebar. A single layout div is sufficient.
  4. Restore mobile nav — either restore <MobileNav /> for md:hidden screens, or build a mobile drawer into AppNavbar.
  5. Merge the duplicate lucide-react import.
  6. Add <span className="sr-only">Toggle theme</span> inside ThemeSwitch.

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.

[Feature] : Add Responsive Navbar

2 participants