Skip to content

Commit 028930b

Browse files
authored
Merge pull request #59 from No-Country-simulation/PA-161-implementar-sidebar-plataforma-de-usuario
Update sidebar items
2 parents 2a7dbef + 02a69b7 commit 028930b

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

frontend/platform/shared/layout/sidebar/components/SidebarMobile.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export default function SidebarMobile() {
5858
// Orden de los items principales
5959
const mainItems = [
6060
{ name: 'Panel de control', icon: LayoutDashboard, path: '/dashboard' },
61-
{ name: 'Actividades', icon: PenTool, path: '/activities' },
61+
/* { name: 'Actividades', icon: PenTool, path: '/activities' }, */
6262
{ name: 'Soporte', icon: MessageCircle, path: '/support' },
63-
{ name: 'Configuración', icon: Settings, path: '/settings' }
63+
/* { name: 'Configuración', icon: Settings, path: '/settings' } */
6464
];
6565

6666
// Items de contenido que se mostrarán/ocultarán

frontend/platform/shared/layout/sidebar/sidebar.jsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@ import {
1818
BookOpen,
1919
PenTool,
2020
MessageCircle,
21-
Settings,
2221
ChevronDown,
2322
ChevronUp,
2423
} from "lucide-react";
2524
import Link from "next/link";
2625
import Image from "next/image";
2726
import { UserMenu } from "@/features/auth";
27+
import { usePathname } from "next/navigation";
2828

2929
export function SidebarApp() {
3030
const [showContentItems, setShowContentItems] = useState(false);
31+
const pathname = usePathname();
3132

3233
// Orden de los items principales
3334
const mainItems = [
3435
{ name: "Panel de control", icon: LayoutDashboard, path: "/dashboard" },
35-
{ name: "Actividades", icon: PenTool, path: "/activities" },
36+
/* { name: "Actividades", icon: PenTool, path: "/activities" }, */
3637
{ name: "Soporte", icon: MessageCircle, path: "/support" },
3738
];
3839

@@ -48,6 +49,9 @@ export function SidebarApp() {
4849
{ name: "Videos de demostración", icon: Video, path: "/demo-videos" },
4950
];
5051

52+
const isActive = (path) =>
53+
pathname === path || pathname.startsWith(`${path}/`);
54+
5155
return (
5256
<Sidebar variant="default" className="text-xl">
5357
<SidebarHeader className="flex justify-start items-start">
@@ -65,7 +69,10 @@ export function SidebarApp() {
6569
{/* 1. Panel de control (siempre visible) */}
6670
<SidebarMenuItem>
6771
<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+
>
6976
<LayoutDashboard className="w-5 h-5 mr-3" />
7077
<span>Panel de control</span>
7178
</SidebarMenuButton>
@@ -97,7 +104,10 @@ export function SidebarApp() {
97104
contentItems.map((item, index) => (
98105
<SidebarMenuItem key={`content-${index}`}>
99106
<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+
>
101111
<item.icon className="w-5 h-5 mr-3" />
102112
<span>{item.name}</span>
103113
</SidebarMenuButton>
@@ -109,7 +119,10 @@ export function SidebarApp() {
109119
{mainItems.slice(1).map((item, index) => (
110120
<SidebarMenuItem key={`main-${index}`}>
111121
<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+
>
113126
<item.icon className="w-5 h-5 mr-3" />
114127
<span>{item.name}</span>
115128
</SidebarMenuButton>

0 commit comments

Comments
 (0)