@@ -18,21 +18,22 @@ import {
18
18
BookOpen ,
19
19
PenTool ,
20
20
MessageCircle ,
21
- Settings ,
22
21
ChevronDown ,
23
22
ChevronUp ,
24
23
} from "lucide-react" ;
25
24
import Link from "next/link" ;
26
25
import Image from "next/image" ;
27
26
import { UserMenu } from "@/features/auth" ;
27
+ import { usePathname } from "next/navigation" ;
28
28
29
29
export function SidebarApp ( ) {
30
30
const [ showContentItems , setShowContentItems ] = useState ( false ) ;
31
+ const pathname = usePathname ( ) ;
31
32
32
33
// Orden de los items principales
33
34
const mainItems = [
34
35
{ name : "Panel de control" , icon : LayoutDashboard , path : "/dashboard" } ,
35
- { name : "Actividades" , icon : PenTool , path : "/activities" } ,
36
+ /* { name: "Actividades", icon: PenTool, path: "/activities" }, */
36
37
{ name : "Soporte" , icon : MessageCircle , path : "/support" } ,
37
38
] ;
38
39
@@ -48,6 +49,9 @@ export function SidebarApp() {
48
49
{ name : "Videos de demostración" , icon : Video , path : "/demo-videos" } ,
49
50
] ;
50
51
52
+ const isActive = ( path ) =>
53
+ pathname === path || pathname . startsWith ( `${ path } /` ) ;
54
+
51
55
return (
52
56
< Sidebar variant = "default" className = "text-xl" >
53
57
< SidebarHeader className = "flex justify-start items-start" >
@@ -65,7 +69,10 @@ export function SidebarApp() {
65
69
{ /* 1. Panel de control (siempre visible) */ }
66
70
< SidebarMenuItem >
67
71
< Link href = "/dashboard" className = "w-full" >
68
- < SidebarMenuButton className = "px-4 h-11 w-full justify-start" >
72
+ < SidebarMenuButton
73
+ className = "px-4 h-11 w-full justify-start"
74
+ isActive = { isActive ( mainItems [ 0 ] . path ) }
75
+ >
69
76
< LayoutDashboard className = "w-5 h-5 mr-3" />
70
77
< span > Panel de control</ span >
71
78
</ SidebarMenuButton >
@@ -97,7 +104,10 @@ export function SidebarApp() {
97
104
contentItems . map ( ( item , index ) => (
98
105
< SidebarMenuItem key = { `content-${ index } ` } >
99
106
< Link href = { item . path } className = "w-full" >
100
- < SidebarMenuButton className = "px-4 h-11 w-full justify-start" >
107
+ < SidebarMenuButton
108
+ className = "px-4 h-11 w-full justify-start"
109
+ isActive = { isActive ( item . path ) }
110
+ >
101
111
< item . icon className = "w-5 h-5 mr-3" />
102
112
< span > { item . name } </ span >
103
113
</ SidebarMenuButton >
@@ -109,7 +119,10 @@ export function SidebarApp() {
109
119
{ mainItems . slice ( 1 ) . map ( ( item , index ) => (
110
120
< SidebarMenuItem key = { `main-${ index } ` } >
111
121
< Link href = { item . path } className = "w-full" >
112
- < SidebarMenuButton className = "px-4 h-11 w-full justify-start" >
122
+ < SidebarMenuButton
123
+ className = "px-4 h-11 w-full justify-start"
124
+ isActive = { isActive ( item . path ) }
125
+ >
113
126
< item . icon className = "w-5 h-5 mr-3" />
114
127
< span > { item . name } </ span >
115
128
</ SidebarMenuButton >
0 commit comments