|
|
@@ -52,12 +52,18 @@ export default function SidebarNavigation({ onItemClick, isCollapsed = false }:
|
|
|
const currentPath = pathname
|
|
|
const sectionsToExpand: string[] = []
|
|
|
|
|
|
- if (isAdmin || isDoctor) {
|
|
|
+ if (isAdmin) {
|
|
|
if (currentPath === "/dashboard") {
|
|
|
sectionsToExpand.push("General")
|
|
|
} else if (currentPath.startsWith("/admin") || currentPath.startsWith("/records")) {
|
|
|
sectionsToExpand.push("Administración")
|
|
|
}
|
|
|
+ } else if (isDoctor) {
|
|
|
+ if (currentPath === "/dashboard") {
|
|
|
+ sectionsToExpand.push("General")
|
|
|
+ } else if (currentPath.startsWith("/patients") || currentPath.startsWith("/records") || currentPath.startsWith("/appointments")) {
|
|
|
+ sectionsToExpand.push("Pacientes")
|
|
|
+ }
|
|
|
} else {
|
|
|
if (currentPath === "/dashboard") {
|
|
|
sectionsToExpand.push("General")
|
|
|
@@ -68,7 +74,11 @@ export default function SidebarNavigation({ onItemClick, isCollapsed = false }:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- setExpandedSections(sectionsToExpand)
|
|
|
+ setExpandedSections(prev => {
|
|
|
+ const newSet = new Set(prev)
|
|
|
+ sectionsToExpand.forEach(section => newSet.add(section))
|
|
|
+ return Array.from(newSet)
|
|
|
+ })
|
|
|
}, [pathname, session])
|
|
|
|
|
|
if (!session) return null
|