@orsetra/shared-ui 1.0.46 → 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.
@@ -40,36 +40,40 @@ export function MainSidebar({
40
40
  const handleMenuClick = (menuId: string) => {
41
41
  onMenuSelect(menuId)
42
42
 
43
- // En mode minimized, ne pas ouvrir le sidebar secondaire
44
43
  if (!isMinimized && onSecondarySidebarOpen) {
45
44
  onSecondarySidebarOpen()
46
45
  }
47
46
 
48
- // Rediriger vers le premier sous-menu ou vers l'app directement
49
47
  const subMenus = sidebarMenus[menuId]
50
48
  if (subMenus && subMenus.length > 0) {
51
- console.log("subMenus:", subMenus[0].href)
52
- router.push(subMenus[0].href)
53
-
49
+ const targetUrl = subMenus[0].href
50
+ const path = targetUrl.startsWith('http://') || targetUrl.startsWith('https://')
51
+ ? new URL(targetUrl).pathname
52
+ : targetUrl
53
+ window.location.href = path
54
54
  } else {
55
- // Fallback: naviguer vers /{menuId} (ex: /assets-manager)
56
- console.log("main_base_url:", `${main_base_url}/${menuId}`)
57
- router.push(`${main_base_url}/${menuId}`)
55
+ const targetUrl = `${main_base_url}/${menuId}`
56
+ const path = targetUrl.startsWith('http://') || targetUrl.startsWith('https://')
57
+ ? new URL(targetUrl).pathname
58
+ : targetUrl
59
+ window.location.href = path
58
60
  }
59
61
 
60
62
  if (!isMinimized) {
61
- onToggle() // Fermer le menu principal après sélection (seulement en mode expanded)
63
+ onToggle()
62
64
  }
63
65
  }
64
66
 
65
67
  const handleSubMenuClick = (href: string) => {
66
- router.push(href)
68
+ const path = href.startsWith('http://') || href.startsWith('https://')
69
+ ? new URL(href).pathname
70
+ : href
71
+ window.location.href = path
67
72
  setHoveredMenu(null)
68
73
  }
69
74
 
70
75
  return (
71
76
  <>
72
- {/* Overlay - seulement en mode expanded */}
73
77
  {isOpen && !isMinimized && (
74
78
  <div
75
79
  className="fixed inset-0 bg-black/50 z-40"
@@ -77,7 +81,6 @@ export function MainSidebar({
77
81
  />
78
82
  )}
79
83
 
80
- {/* Main Sidebar */}
81
84
  <div className={cn(
82
85
  "fixed left-0 top-0 h-full bg-white border-r border-ui-border z-50 transform transition-all duration-300 ease-in-out",
83
86
  isMinimized ? "w-16" : "w-64 shadow-xl",
@@ -85,7 +88,6 @@ export function MainSidebar({
85
88
  ? "translate-x-0"
86
89
  : (isOpen ? "translate-x-0" : "-translate-x-full")
87
90
  )}>
88
- {/* Header avec logo Orchestra */}
89
91
  <div className={cn(
90
92
  "flex items-center h-16 border-b border-ui-border bg-white",
91
93
  isMinimized ? "justify-center px-2" : "justify-between px-4"
@@ -105,7 +107,6 @@ export function MainSidebar({
105
107
  )}
106
108
  </div>
107
109
 
108
- {/* Menu Items */}
109
110
  <div className={cn(
110
111
  "overflow-y-auto h-full",
111
112
  isMinimized ? "p-2" : "p-3"
@@ -142,7 +143,6 @@ export function MainSidebar({
142
143
  {!isMinimized && <span className="text-base">{item.label}</span>}
143
144
  </button>
144
145
 
145
- {/* Submenu au survol en mode minimized */}
146
146
  {isMinimized && hoveredMenu === item.id && sidebarMenus[item.id] && sidebarMenus[item.id].length > 0 && (
147
147
  <div className="absolute left-full top-0 ml-2 bg-white border border-ui-border rounded-lg shadow-xl z-50 min-w-[200px] py-2">
148
148
  <div className="px-4 py-2 border-b border-ui-border">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orsetra/shared-ui",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "Shared UI components for Orsetra platform",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -93,4 +93,4 @@
93
93
  "next": "^16.0.7",
94
94
  "typescript": "^5"
95
95
  }
96
- }
96
+ }