@orsetra/shared-ui 1.0.47 → 1.0.48

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) {
@@ -67,11 +65,10 @@ export function MainSidebar({
67
65
  }
68
66
 
69
67
  const handleSubMenuClick = (href: string) => {
70
- if (href.startsWith('http://') || href.startsWith('https://')) {
71
- window.location.href = href
72
- } else {
73
- router.push(href)
74
- }
68
+ const path = href.startsWith('http://') || href.startsWith('https://')
69
+ ? new URL(href).pathname
70
+ : href
71
+ window.location.href = path
75
72
  setHoveredMenu(null)
76
73
  }
77
74
 
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.48",
4
4
  "description": "Shared UI components for Orsetra platform",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",