@orsetra/shared-ui 1.0.16 → 1.0.18

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.
@@ -20,23 +20,21 @@ export interface SubMenuItem {
20
20
  name: string
21
21
  href: string
22
22
  icon: LucideIcon
23
- /** Fonction optionnelle pour transformer le href avant navigation */
24
- hrefTransform?: (href: string) => string
25
23
  }
26
24
 
27
25
  export interface SidebarMenus {
28
26
  [key: string]: SubMenuItem[]
29
27
  }
30
28
 
31
- // Menu principal (centralisé) - Structure commune à toutes les apps
29
+
32
30
  export const menuItems: MainMenuItem[] = [
33
31
  {
34
- id: "assets",
32
+ id: "assets-manager",
35
33
  label: "Assets",
36
34
  icon: <Rocket className="h-6 w-6" />
37
35
  },
38
36
  {
39
- id: "applications",
37
+ id: "applications-manager",
40
38
  label: "Applications",
41
39
  icon: <Package className="h-6 w-6" />
42
40
  },
@@ -54,8 +52,8 @@ export const menuItems: MainMenuItem[] = [
54
52
 
55
53
  // Labels des menus principaux pour l'affichage
56
54
  export const menuLabels: Record<string, string> = {
57
- "assets": "Assets",
58
- "applications": "Applications",
55
+ "assets-manager": "Assets",
56
+ "applications-manager": "Applications",
59
57
  "api-manager": "API Manager",
60
58
  "access-manager": "Access Manager"
61
59
  }
@@ -178,10 +178,11 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {} }: SidebarPr
178
178
  const pathname = usePathname()
179
179
  const { state } = useSidebar()
180
180
 
181
- // Déterminer quelle navigation afficher à partir des menus fournis par l'app
182
- const currentNavigation: SubMenuItem[] = currentMenu && sidebarMenus[currentMenu]
183
- ? sidebarMenus[currentMenu]
184
- : []
181
+ // Micro apps: utilise 'items' comme clé standard
182
+ // Main app: utilise currentMenu pour sélectionner le bon groupe
183
+ const currentNavigation: SubMenuItem[] = sidebarMenus['items']
184
+ || (currentMenu && sidebarMenus[currentMenu])
185
+ || []
185
186
 
186
187
  return (
187
188
  <div className="h-screen sticky top-0 flex flex-col bg-white border-r border-ui-border min-w-[var(--sidebar-width-icon)] transition-[width] duration-200"
@@ -206,8 +207,8 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {} }: SidebarPr
206
207
  {currentMenu && menuLabels[currentMenu] && (
207
208
  <div className="px-4 py-3 border-b border-ui-border">
208
209
  <div className="flex items-center gap-2">
209
- {currentMenu === "assets" && <Rocket className="h-4 w-4 text-interactive" />}
210
- {currentMenu === "applications" && <Package className="h-4 w-4 text-interactive" />}
210
+ {currentMenu === "assets-manager" && <Rocket className="h-4 w-4 text-interactive" />}
211
+ {currentMenu === "applications-manager" && <Package className="h-4 w-4 text-interactive" />}
211
212
  {currentMenu === "api-manager" && <Settings className="h-4 w-4 text-interactive" />}
212
213
  {currentMenu === "access-manager" && <Shield className="h-4 w-4 text-interactive" />}
213
214
  <h2 className="text-sm font-semibold text-text-primary">
@@ -220,12 +221,11 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {} }: SidebarPr
220
221
  {/* Navigation principale avec espacements ajustés */}
221
222
  <nav className="flex-1 px-3 py-4 space-y-1 overflow-y-auto">
222
223
  {currentNavigation.map((item) => {
223
- const finalHref = item.hrefTransform ? item.hrefTransform(item.href) : item.href
224
- const isActive = pathname === finalHref || pathname.startsWith(`${finalHref}/`)
224
+ const isActive = pathname === item.href || pathname.startsWith(`${item.href}/`)
225
225
  return (
226
226
  <Link
227
227
  key={item.name}
228
- href={finalHref}
228
+ href={item.href}
229
229
  className={cn(
230
230
  "flex items-center px-3 py-2 text-sm rounded-md gap-x-3 transition-colors",
231
231
  isActive
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orsetra/shared-ui",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Shared UI components for Orsetra platform",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",