Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/components/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@ import { CheckSquare, Home } from "lucide-react";
import Link from "next/link";
import { Button } from "@/components/ui/button";
import LogoutButton from "../modules/auth/components/logout-button";
import dashboardRoutes from "@/modules/dashboard/dashboard.route";
import todosRoutes from "@/modules/todos/todos.route";

export function Navigation() {
return (
<nav className="border-b bg-white sticky top-0 z-50">
<nav className="border-b bg-card sticky top-0 z-50">
<div className="container mx-auto px-4 py-3">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-6">
<Link
href="/"
className="text-xl font-bold text-gray-900"
href={dashboardRoutes.dashboard}
className="text-xl font-bold"
>
TodoApp
</Link>
<div className="items-center space-x-4 hidden md:flex">
<Link href="/">
<Link href={dashboardRoutes.dashboard}>
<Button variant="ghost" size="sm">
<Home className="mr-2 h-4 w-4" />
Home
</Button>
</Link>
<Link href="/todos">
<Link href={todosRoutes.list}>
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

🧩 Analysis chain

LGTM! Core fix for the 404 navigation issue.

Using todosRoutes.list resolves the original problem where the link pointed to /todos instead of the correct route. This type-safe approach prevents similar issues in the future.

Run the following script to verify the route value and check for any remaining hardcoded todo routes:


🏁 Script executed:

#!/bin/bash
# Description: Verify todosRoutes.list value and find any hardcoded todo paths

echo "=== Checking todosRoutes.list value ==="
rg -A 5 "export.*todosRoutes|const todosRoutes" --type ts --type tsx

echo -e "\n=== Searching for hardcoded /todos or /dashboard/todos paths ==="
rg -n 'href=["'"'"'](/todos|/dashboard/todos)["'"'"']' --type tsx --type ts -g '!*.route.ts'

Length of output: 161


🏁 Script executed:

#!/bin/bash
# Description: Verify todosRoutes.list value and find any hardcoded todo paths

echo "=== Checking todosRoutes.list definition ==="
rg -n "export.*todosRoutes|const todosRoutes" -g '*.ts' -g '*.tsx' -A 5

echo -e "\n=== Searching for hardcoded /todos paths in components ==="
rg -n "href.*['\"].*todos" -g '*.ts' -g '*.tsx' -g '!*.test.*' -g '!*.spec.*'

echo -e "\n=== Checking navigation.tsx around line 27 ==="
rg -n -A 3 -B 3 "todosRoutes\.list" -g '*.tsx'

Length of output: 2483


Correct fix, but inconsistent route usage elsewhere in codebase.

The change at line 27 correctly uses todosRoutes.list (resolves to /dashboard/todos), which fixes the original 404 navigation issue and maintains type safety.

However, src/modules/dashboard/dashboard.page.tsx still contains hardcoded routes that should be refactored for consistency:

  • Line 37: href="/dashboard/todos" → should use todosRoutes.list
  • Line 57: href="/dashboard/todos/new" → should use todosRoutes.new
🤖 Prompt for AI Agents
In src/components/navigation.tsx around line 27 and in
src/modules/dashboard/dashboard.page.tsx at lines 37 and 57, replace the
remaining hardcoded dashboard todo routes with the route constants: change
href="/dashboard/todos" to use todosRoutes.list and href="/dashboard/todos/new"
to use todosRoutes.new; ensure the file imports todosRoutes from its module (add
the import if missing) and keep the Link usage consistent and type-safe across
the codebase.

<Button variant="ghost" size="sm">
<CheckSquare className="mr-2 h-4 w-4" />
Todos
Expand Down