fix(nav): correctly highlight "Add Task" active state on task creation and edit routes
This commit is contained in:
parent
f18427c4ab
commit
76d239df7b
1 changed files with 4 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
|||
const navItems = [
|
||||
{ name: "Summary", href: "/summary", icon: FileText },
|
||||
{ name: "Dashboard", href: "/dashboard", icon: LayoutDashboard },
|
||||
{ name: "Add Task", href: "/tasks?task=new", icon: FilePenLine },
|
||||
{ name: "Add Task", href: "/tasks", icon: FilePenLine },
|
||||
{ name: "Trash", href: "/trash", icon: Trash2 },
|
||||
];
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ export default function Navbar() {
|
|||
|
||||
const trashCount = data?.count || 0;
|
||||
|
||||
// Shared function to render navigation links to avoid code duplication
|
||||
// Shared function to render navigation links
|
||||
const renderNavLinks = (isMobile = false) =>
|
||||
navItems.map((item) => {
|
||||
const Icon = item.icon;
|
||||
|
|
@ -50,7 +50,7 @@ export default function Navbar() {
|
|||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
href={item.href === "/tasks" ? "/tasks?task=new" : item.href}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
className={
|
||||
isMobile
|
||||
|
|
|
|||
Loading…
Reference in a new issue