Skip to content

Conversation

@tanvimahal
Copy link
Member

@tanvimahal tanvimahal commented Jan 24, 2026

  • updated the admin navbar to match figma
  • deleted the old admin homepage
  • login redirects directly to schedules instead of the admin home

invite tab on the navbar needs to be changed from a link to the dropdown modal from SANC-64

Summary by CodeRabbit

  • Style

    • Navigation links now display with improved active state indicators for better visual feedback.
  • Refactor

    • Admin users are now directed to the Schedule page upon login instead of the Home page.

@vercel
Copy link

vercel bot commented Jan 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
salvationarmy Ready Ready Preview, Comment Feb 9, 2026 1:39am

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

This PR refactors the navbar component by introducing styled navigation links with dynamic active state detection using Next.js path detection, replacing button-based admin navigation with NavLink items, and updates admin dashboard redirect endpoints from /admin/home to /admin/schedule.

Changes

Cohort / File(s) Summary
Navbar Styling
src/app/_components/common/navbar.module.scss
Added CSS module classes for navigation links (.navLink, .navLinkDefault, .navLinkActive) with base styling (no underline, inherited color) and state-specific styles (hover background, font-weight, padding, border-radius, transitions). Simplified navbar padding to fixed 1rem 2rem with bottom border, removing previous media query responsive logic.
Navbar Component
src/app/_components/common/navbar.tsx
Introduced internal NavLink component using usePathname to detect active routes and apply appropriate styling. Replaced admin action buttons with NavLink navigation items (View Agencies, Invite, Rider Logs, Vehicle Logs, View Schedule). Added Profile component integration and Surveys navigation for driver view. Simplified admin header to display agency name only.
Routing Updates
src/server/api/routers/organizations.ts, src/app/page.tsx
Changed admin redirect destination from /admin/home to /admin/schedule in both server-side API router and home page component.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • burtonjong
  • promatty
  • themaxboucher
  • Yemyam
  • JustinTan-1

Poem

🐰 New NavLinks hop into sight,
With active states shining bright,
Schedules take the spotlight's gleam,
Admin routes now flow like a dream,
Styled navigation—pure delight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references 'admin dashboard home page header', which aligns with the PR's primary objective of updating the admin navbar and changing navigation routing, but is somewhat vague about the specific changes made.

✏️ 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
  • Commit unit tests in branch SANC-55-Admin-Dashboard-Home-Page-header

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

@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 `@src/app/_components/common/navbar.tsx`:
- Around line 44-48: Navbar contains NavLink entries that point to non-existent
admin routes (/admin/agencies, /admin/invite, /admin/vehicle-logs) which cause
404s; either implement the missing pages or update the NavLink instances in
navbar.tsx: remove or replace the NavLink href="/admin/agencies" and
href="/admin/invite" with correct existing routes (or add new pages matching
those hrefs), and change href="/admin/vehicle-logs" to the existing route (e.g.,
href="/admin/driver-logs" or another correct path); update the NavLink elements’
text accordingly so links and targets match actual route components.
🧹 Nitpick comments (3)
src/app/_components/common/navbar.module.scss (1)

11-14: Duplicate style declaration for .navLinkDefault.

The font-weight: 400 property is declared twice for .navLinkDefault (lines 12 and 30). Additionally, the transition: color 0.2s ease on line 13 is overwritten by transition: background-color 0.2s ease on line 20 (since CSS transition shorthand replaces, not merges). Consider consolidating:

♻️ Suggested consolidation
 .navLinkDefault,
 .navLinkActive {
     font-size: 0.75rem;
     cursor: pointer;
-    transition: background-color 0.2s ease;
+    transition: background-color 0.2s ease, color 0.2s ease;
     padding: 0.5rem 0.75rem;
     border-radius: 4px;
 }
 
 .navLinkDefault:hover {
     background-color: `#f3f4f6`;
 }
 
-.navLinkDefault {
-    font-weight: 400;
-}
-
 .navLinkActive {
     font-weight: 600;
 }

Also applies to: 29-31

src/app/_components/common/navbar.tsx (2)

36-36: SCSS .navbar class is imported but not used; inline styles duplicate it.

The SCSS module defines .navbar with padding: 1rem 2rem; border-bottom: 1px solid #e5e7eb; but line 36 uses inline styles and the "border-bottom" className (likely a global/Tailwind class). Consider using the imported SCSS class for consistency:

♻️ Suggested change
-    <Group justify="space-between" className="border-bottom" style={{ padding: "1rem 2rem" }}>
+    <Group justify="space-between" className={styles.navbar}>

23-32: Consider startsWith for nested route highlighting.

The current exact match (pathname === href) won't mark a link as active when navigating to child routes (e.g., /admin/schedule/123 won't highlight "View Schedule"). If nested routes exist or are planned, consider:

const isActive = pathname === href || pathname.startsWith(`${href}/`);

This is optional depending on your route structure.

Comment on lines 44 to 76
<NavLink href="/admin/agencies">View Agencies</NavLink>
<NavLink href="/admin/invite">Invite</NavLink>
<NavLink href="/admin/rider-logs">Rider Logs</NavLink>
<NavLink href="/admin/vehicle-logs">Vehicle Log</NavLink>
<NavLink href="/admin/schedule">View Schedule</NavLink>
Copy link

@coderabbitai coderabbitai bot Jan 24, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for admin route pages/directories

echo "=== Checking admin app directory structure ==="
if [ -d "src/app/admin" ]; then
  echo "Admin directory found. Contents:"
  ls -la src/app/admin 2>/dev/null || echo "Cannot list admin directory"
  echo ""
  
  # Check for specific route directories
  routes=("agencies" "invite" "rider-logs" "vehicle-logs" "schedule")
  echo "=== Checking for expected route directories/pages ==="
  for route in "${routes[@]}"; do
    if [ -d "src/app/admin/$route" ]; then
      echo "$route: Directory found"
      # Check if it has a page.tsx or page.ts
      if [ -f "src/app/admin/$route/page.tsx" ] || [ -f "src/app/admin/$route/page.ts" ]; then
        echo "  └─ Has page component"
      fi
    elif [ -f "src/app/admin/$route.tsx" ] || [ -f "src/app/admin/$route.ts" ]; then
      echo "$route: File found"
    else
      echo "$route: NOT FOUND"
    fi
  done
else
  echo "Admin directory not found at src/app/admin"
fi

Repository: Code-the-Change-YYC/salvationarmy

Length of output: 809


Remove or create the missing admin routes.

The navbar links to /admin/agencies, /admin/invite, and /admin/vehicle-logs, but these pages do not exist in the codebase. Clicking these links will result in 404 errors. Either create these missing route pages or remove the broken links and replace with the routes that do exist (driver-logs, rider-logs, schedule).

🤖 Prompt for AI Agents
In `@src/app/_components/common/navbar.tsx` around lines 44 - 48, Navbar contains
NavLink entries that point to non-existent admin routes (/admin/agencies,
/admin/invite, /admin/vehicle-logs) which cause 404s; either implement the
missing pages or update the NavLink instances in navbar.tsx: remove or replace
the NavLink href="/admin/agencies" and href="/admin/invite" with correct
existing routes (or add new pages matching those hrefs), and change
href="/admin/vehicle-logs" to the existing route (e.g.,
href="/admin/driver-logs" or another correct path); update the NavLink elements’
text accordingly so links and targets match actual route components.

Copy link
Contributor

Choose a reason for hiding this comment

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

instead of admin/vehicle-logs the endpoint is admin/driver-logs

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the driver-logs route exists and check vehicle-logs
echo "=== Checking for driver-logs route ==="
if [ -d "src/app/admin/driver-logs" ]; then
  echo "✓ driver-logs directory exists"
  ls -la src/app/admin/driver-logs
elif [ -f "src/app/admin/driver-logs.tsx" ] || [ -f "src/app/admin/driver-logs.ts" ]; then
  echo "✓ driver-logs file exists"
fi

echo ""
echo "=== Checking for vehicle-logs route ==="
if [ -d "src/app/admin/vehicle-logs" ]; then
  echo "✓ vehicle-logs directory exists"
  ls -la src/app/admin/vehicle-logs
elif [ -f "src/app/admin/vehicle-logs.tsx" ] || [ -f "src/app/admin/vehicle-logs.ts" ]; then
  echo "✓ vehicle-logs file exists"
else
  echo "✗ vehicle-logs does NOT exist"
fi

echo ""
echo "=== Current navbar.tsx NavLink for vehicle/driver logs ==="
rg -n "vehicle-logs|driver-logs" src/app/_components/common/navbar.tsx

Length of output: 437


@promatty, thank you for the clarification! You're right—the navbar should link to /admin/driver-logs, not /admin/vehicle-logs.

Line 47 currently has:

<NavLink href="/admin/vehicle-logs">Vehicle Log</NavLink>

This should be updated to:

<NavLink href="/admin/driver-logs">Vehicle Log</NavLink>

The /admin/driver-logs route exists in the codebase, so this will fix the 404 for that link. However, /admin/agencies and /admin/invite still need to be addressed (either created or removed from the navbar).


🧬 Code Graph Analysis Results

[src/app/_components/common/navbar.tsx] (lines 1- end)

"use client";

import { Group, Text } from "@mantine/core";
import Link from "next/link";
import { usePathname } from "next/navigation";
import Bell from "@/assets/icons/bell";
import Home from "@/assets/icons/home";
import styles from "./navbar.module.scss";
import Profile from "./profile/profile";

type NavbarView = "admin" | "agency" | "driver";

interface NavbarProps {
  view: NavbarView;
  agencyName?: string; //only used in Agency View
}

interface NavLinkProps {
  href: string;
  children: React.ReactNode;
}

function NavLink({ href, children }: NavLinkProps) {
  const pathname = usePathname();
  const isActive = pathname === href;

  return (
    <Link href={href} className={styles.navLink}>
      <span className={isActive ? styles.navLinkActive : styles.navLinkDefault}>{children}</span>
    </Link>
  );
}

export default function Navbar({ view, agencyName }: NavbarProps) {
  return (
    <Group justify="space-between" className="border-bottom" style={{ padding: "1rem 2rem" }}>
      <Group>
        <Home />
        <Text>{view === "agency" ? `${agencyName ?? "[Agency name]"} Home` : ""}</Text>
      </Group>

      {view === "admin" && (
        <Group gap={30}>
          <NavLink href="/admin/agencies">View Agencies</NavLink>
          <NavLink href="/admin/invite">Invite</NavLink>
          <NavLink href="/admin/rider-logs">Rider Logs</NavLink>
          <NavLink href="/admin/vehicle-logs">Vehicle Log</NavLink>
          <NavLink href="/admin/schedule">View Schedule</NavLink>
          <Profile />
        </Group>
      )}

      {view === "agency" && (
        <Group gap={30}>
          <Bell />
          <Profile />
        </Group>
      )}

      {view === "driver" && (
        <Group>
          <Profile />
        </Group>
      )}
    </Group>
  );
}

✏️ Learnings added
Learnt from: promatty
Repo: Code-the-Change-YYC/salvationarmy PR: 48
File: src/app/_components/common/navbar.tsx:44-48
Timestamp: 2026-01-24T06:06:38.145Z
Learning: In the Salvation Army project, the correct admin route for vehicle/driver logs is `/admin/driver-logs`, not `/admin/vehicle-logs`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Contributor

@promatty promatty left a comment

Choose a reason for hiding this comment

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

also, in app/page.tsx can we redirect to the schedule page instead of admin/home

@@ -0,0 +1,35 @@
.navbar {
padding: 1rem 2rem;
border-bottom: 1px solid #e5e7eb;
Copy link
Contributor

Choose a reason for hiding this comment

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

i always forget, is it possible to import these from the global styles file instead of hardcoding colors?

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry I didn't realize the global ones were usable now, i changed it

}

.navLinkDefault:hover {
background-color: #f3f4f6;
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

</Link>
<Group gap={30}>
<NavLink href="/admin/agencies">View Agencies</NavLink>
<NavLink href="/admin/invite">Invite</NavLink>
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make this open the invite modal we currently have, instead of waiting for sanc-64

<NavLink href="/admin/agencies">View Agencies</NavLink>
<NavLink href="/admin/invite">Invite</NavLink>
<NavLink href="/admin/rider-logs">Rider Logs</NavLink>
<NavLink href="/admin/vehicle-logs">Vehicle Log</NavLink>
Copy link
Contributor

Choose a reason for hiding this comment

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

"Vehicle Logs" plural

Comment on lines 44 to 76
<NavLink href="/admin/agencies">View Agencies</NavLink>
<NavLink href="/admin/invite">Invite</NavLink>
<NavLink href="/admin/rider-logs">Rider Logs</NavLink>
<NavLink href="/admin/vehicle-logs">Vehicle Log</NavLink>
<NavLink href="/admin/schedule">View Schedule</NavLink>
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of admin/vehicle-logs the endpoint is admin/driver-logs

@burtonjong
Copy link
Contributor

@tanvimahal merge conflicts

@promatty
Copy link
Contributor

promatty commented Feb 9, 2026

@tanvimahal bump

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/_components/common/navbar.tsx (1)

39-61: 🛠️ Refactor suggestion | 🟠 Major

Remove dead code: navbarText() and homeLink() are unused.

Neither function is called in the returned JSX. Additionally, homeLink() still references the stale /admin/home path. These should be cleaned up.

Proposed fix
 export default function Navbar({ view, agencyName }: NavbarProps) {
-  const pathname = usePathname();
-
-  const section = pathname.split("/")[2] ?? "home";
-
-  const navbarText = () => {
-    switch (view) {
-      case "admin":
-        return `Admin ${section}`;
-      case "agency":
-        return `${agencyName ?? "[Agency name]"} ${section}`;
-      case "driver":
-        return `Driver ${section}`;
-      default:
-        return "";
-    }
-  };
-
-  const homeLink = () => {
-    switch (view) {
-      case "admin":
-        return `/admin/home`;
-      case "agency":
-        return `/agency/home`;
-      case "driver":
-        return `/driver/home`;
-    }
-  };
-
   return (
🧹 Nitpick comments (1)
src/app/_components/common/navbar.tsx (1)

18-32: NavLink component looks good overall.

Clean implementation with active state detection. One minor optimization: each NavLink instance independently calls usePathname(). Since the parent Navbar already calls it (line 35), consider passing pathname as a prop to avoid redundant hook calls across all NavLink instances.

@tanvimahal tanvimahal requested a review from promatty February 9, 2026 01:42
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.

3 participants