feat: add route constant
This commit is contained in:
@@ -4,6 +4,8 @@ import { useRouter, usePathname } from "next/navigation"
|
||||
import { LayoutDashboard, Plus, User, FolderPlus, Package, MapPin } from "lucide-react"
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from "@/components/ui/tooltip"
|
||||
|
||||
import { ROUTES } from "@/utils/routes"
|
||||
|
||||
interface NavItem {
|
||||
title: string
|
||||
href: string
|
||||
@@ -15,31 +17,31 @@ interface NavItem {
|
||||
const navItems: NavItem[] = [
|
||||
{
|
||||
title: "Dashboard",
|
||||
href: "/dashboard",
|
||||
href: ROUTES.DASHBOARD,
|
||||
icon: LayoutDashboard,
|
||||
gradient: "from-blue-400 to-indigo-500"
|
||||
},
|
||||
{
|
||||
title: "Project",
|
||||
href: "/project",
|
||||
href: ROUTES.PROJECT,
|
||||
icon: FolderPlus,
|
||||
gradient: "from-blue-400 to-blue-600"
|
||||
},
|
||||
{
|
||||
title: "Package",
|
||||
href: "/package",
|
||||
href: ROUTES.PACKAGE,
|
||||
icon: Package,
|
||||
gradient: "from-violet-400 to-purple-500"
|
||||
},
|
||||
{
|
||||
title: "Location",
|
||||
href: "/location",
|
||||
href: ROUTES.LOCATION,
|
||||
icon: MapPin,
|
||||
gradient: "from-amber-400 to-orange-500"
|
||||
},
|
||||
{
|
||||
title: "Account",
|
||||
href: "/account",
|
||||
href: ROUTES.ACCOUNT,
|
||||
icon: User,
|
||||
gradient: "from-purple-400 to-pink-500",
|
||||
disabled: true
|
||||
@@ -55,7 +57,7 @@ export function SidebarNavigation() {
|
||||
router.push(item.href)
|
||||
}
|
||||
|
||||
const isNewAnalysisActive = pathname === "/new-analysis"
|
||||
const isNewAnalysisActive = pathname === ROUTES.NEW_ANALYSIS
|
||||
|
||||
return (
|
||||
<aside className="fixed left-0 top-0 h-screen w-20 bg-white/40 backdrop-blur-xl border-r border-slate-200/50 z-50 flex flex-col items-center py-8">
|
||||
@@ -96,7 +98,7 @@ export function SidebarNavigation() {
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
onClick={() => router.push("/new-analysis")}
|
||||
onClick={() => router.push(ROUTES.NEW_ANALYSIS)}
|
||||
className={`
|
||||
relative w-12 h-12 rounded-md flex items-center justify-center
|
||||
${isNewAnalysisActive ? 'bg-linear-to-b from-[#3895FF] to-[#86B8F1]' : 'bg-[#f0fafd]/60 border border-slate-100/50'}
|
||||
|
||||
Reference in New Issue
Block a user