@orsetra/shared-ui 1.0.47 → 1.0.49
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.
|
@@ -47,18 +47,16 @@ export function MainSidebar({
|
|
|
47
47
|
const subMenus = sidebarMenus[menuId]
|
|
48
48
|
if (subMenus && subMenus.length > 0) {
|
|
49
49
|
const targetUrl = subMenus[0].href
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
50
|
+
const path = targetUrl.startsWith('http://') || targetUrl.startsWith('https://')
|
|
51
|
+
? new URL(targetUrl).pathname
|
|
52
|
+
: targetUrl
|
|
53
|
+
window.location.href = path
|
|
55
54
|
} else {
|
|
56
55
|
const targetUrl = `${main_base_url}/${menuId}`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
56
|
+
const path = targetUrl.startsWith('http://') || targetUrl.startsWith('https://')
|
|
57
|
+
? new URL(targetUrl).pathname
|
|
58
|
+
: targetUrl
|
|
59
|
+
window.location.href = path
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
if (!isMinimized) {
|
|
@@ -66,12 +64,12 @@ export function MainSidebar({
|
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
const handleSubMenuClick = (href: string) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
const handleSubMenuClick = (e: React.MouseEvent, href: string) => {
|
|
68
|
+
e.preventDefault()
|
|
69
|
+
const path = href.startsWith('http://') || href.startsWith('https://')
|
|
70
|
+
? new URL(href).pathname
|
|
71
|
+
: href
|
|
72
|
+
window.location.href = path
|
|
75
73
|
setHoveredMenu(null)
|
|
76
74
|
}
|
|
77
75
|
|
|
@@ -156,7 +154,7 @@ export function MainSidebar({
|
|
|
156
154
|
<Link
|
|
157
155
|
key={subItem.id}
|
|
158
156
|
href={subItem.href}
|
|
159
|
-
onClick={() => handleSubMenuClick(subItem.href)}
|
|
157
|
+
onClick={(e) => handleSubMenuClick(e,subItem.href)}
|
|
160
158
|
className="flex items-center gap-3 px-4 py-2 text-sm text-text-secondary hover:bg-ui-background hover:text-text-primary transition-colors"
|
|
161
159
|
>
|
|
162
160
|
<subItem.icon className="h-4 w-4" />
|