@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
- if (targetUrl.startsWith('http://') || targetUrl.startsWith('https://')) {
51
- window.location.href = targetUrl
52
- } else {
53
- router.push(targetUrl)
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
- if (targetUrl.startsWith('http://') || targetUrl.startsWith('https://')) {
58
- window.location.href = targetUrl
59
- } else {
60
- router.push(targetUrl)
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
- if (href.startsWith('http://') || href.startsWith('https://')) {
71
- window.location.href = href
72
- } else {
73
- router.push(href)
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" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orsetra/shared-ui",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "Shared UI components for Orsetra platform",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",