From 430dcd209b7d45171da1b31800e15e2d6cf0ec6e Mon Sep 17 00:00:00 2001 From: Christopher Mayor Date: Sat, 7 Mar 2026 13:23:27 -0800 Subject: [PATCH] [taskboard] fix active navigation state --- app/layout.tsx | 6 +----- components/app-shell.tsx | 10 +++++++--- middleware.ts | 17 ----------------- 3 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 middleware.ts diff --git a/app/layout.tsx b/app/layout.tsx index e28ade7..18bcc19 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,5 +1,4 @@ import type { Metadata } from "next"; -import { headers } from "next/headers"; import "@/app/globals.css"; import { AppShell } from "@/components/app-shell"; @@ -14,9 +13,6 @@ export default async function RootLayout({ }: Readonly<{ children: React.ReactNode; }>) { - const headerList = await headers(); - const pathname = headerList.get("x-pathname") || "/tasks"; - return ( @@ -28,7 +24,7 @@ export default async function RootLayout({ /> - {children} + {children} ); diff --git a/components/app-shell.tsx b/components/app-shell.tsx index e35fa88..2464a35 100644 --- a/components/app-shell.tsx +++ b/components/app-shell.tsx @@ -1,4 +1,7 @@ +"use client"; + import Link from "next/link"; +import { usePathname } from "next/navigation"; import { Network, NotebookTabs, PanelsTopLeft, ScrollText, Send, Settings2, ShieldEllipsis, UsersRound } from "lucide-react"; import { cn } from "@/lib/utils"; @@ -16,12 +19,12 @@ const navItems = [ ]; export function AppShell({ - pathname, children, }: { - pathname: string; children: React.ReactNode; }) { + const pathname = usePathname(); + return (
@@ -44,7 +47,8 @@ export function AppShell({