@orsetra/shared-ui 1.5.8 → 1.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41,7 +41,8 @@ export function MainSidebar({
|
|
|
41
41
|
if (!isOpen) setExpandedMenu(null)
|
|
42
42
|
}, [isOpen])
|
|
43
43
|
|
|
44
|
-
const handleMenuClick = (
|
|
44
|
+
const handleMenuClick = (item: MainMenuItem) => {
|
|
45
|
+
const menuId = item.id
|
|
45
46
|
const hasSubMenu = (sidebarMenus[menuId]?.length ?? 0) > 0
|
|
46
47
|
|
|
47
48
|
// Accordion: expand/collapse inline for any non-minimized mode
|
|
@@ -55,10 +56,10 @@ export function MainSidebar({
|
|
|
55
56
|
onSecondarySidebarOpen()
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
const
|
|
59
|
-
const path =
|
|
60
|
-
? new URL(
|
|
61
|
-
:
|
|
59
|
+
const rawUrl = item.href ?? `${main_base_url}/${menuId}`
|
|
60
|
+
const path = rawUrl.startsWith('http://') || rawUrl.startsWith('https://')
|
|
61
|
+
? new URL(rawUrl).pathname
|
|
62
|
+
: rawUrl
|
|
62
63
|
window.location.href = path
|
|
63
64
|
|
|
64
65
|
if (!isMinimized) {
|
|
@@ -128,7 +129,7 @@ export function MainSidebar({
|
|
|
128
129
|
return (
|
|
129
130
|
<div key={item.id}>
|
|
130
131
|
<button
|
|
131
|
-
onClick={() => handleMenuClick(item
|
|
132
|
+
onClick={() => handleMenuClick(item)}
|
|
132
133
|
className={cn(
|
|
133
134
|
"w-full flex items-center text-left transition-all duration-150 font-medium",
|
|
134
135
|
isMinimized ? "justify-center p-3" : "gap-3 px-3 py-2",
|