Refactor navigation structure and API routes

- Centralize user menu, sidebar items, and breadcrumb logic.
- Map consistent API endpoints in `customerRoutes`.
- Replace inline route definitions with reusable constants.
- Refactor auth configuration file location.
- Improve `<Link>` usage to replace static `<a>` elements.
- Adjust sidebar and dropdown components to use dynamic navigation configurations.
This commit is contained in:
2025-07-07 19:49:58 +02:00
parent 7ba92dc66c
commit e42b352216
15 changed files with 127 additions and 88 deletions

View File

@@ -1,7 +1,6 @@
"use client";
import {useState, useEffect, useMemo} from "react";
import {useRouter} from "next/navigation";
import {Button} from "@/components/ui/button";
import {Input} from "@/components/ui/input";
import {Card, CardContent} from "@/components/ui/card";
@@ -25,9 +24,9 @@ import {ArrowRight} from "lucide-react";
import {NewCustomerModal} from "@/components/customers/modal/NewCustomerModal";
import axios from "axios";
import {Customer} from "@/services/customers/entities/customer";
import Link from "next/link";
export default function CustomersPage() {
const router = useRouter();
const [customers, setCustomers] = useState<Customer[]>([]);
const [search, setSearch] = useState("");
const [loading, setLoading] = useState(true);
@@ -50,7 +49,7 @@ export default function CustomersPage() {
}, []);
const filtered = useMemo(() => {
if(customers.length === 0) return [];
if (customers.length === 0) return [];
return customers.filter(
(c) =>
@@ -143,13 +142,11 @@ export default function CustomersPage() {
<TableCell>{customer.city}</TableCell>
<TableCell>{new Date(customer.createdAt).toLocaleString()}</TableCell>
<TableCell>
<Button
variant="ghost"
size="icon"
onClick={() => router.push(`/customers/${customer.id}`)}
>
<ArrowRight className="w-4 h-4"/>
</Button>
<Link href={`/customers/${customer.id}`}>
<Button variant="ghost" size="icon">
<ArrowRight className="w-4 h-4"/>
</Button>
</Link>
</TableCell>
</TableRow>
))}