@djangocfg/layouts 2.1.22 → 2.1.23

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/layouts",
3
- "version": "2.1.22",
3
+ "version": "2.1.23",
4
4
  "description": "Simple, straightforward layout components for Next.js - import and use with props",
5
5
  "keywords": [
6
6
  "layouts",
@@ -92,9 +92,9 @@
92
92
  "check": "tsc --noEmit"
93
93
  },
94
94
  "peerDependencies": {
95
- "@djangocfg/api": "^2.1.22",
96
- "@djangocfg/centrifugo": "^2.1.22",
97
- "@djangocfg/ui-nextjs": "^2.1.22",
95
+ "@djangocfg/api": "^2.1.23",
96
+ "@djangocfg/centrifugo": "^2.1.23",
97
+ "@djangocfg/ui-nextjs": "^2.1.23",
98
98
  "@hookform/resolvers": "^5.2.0",
99
99
  "consola": "^3.4.2",
100
100
  "lucide-react": "^0.545.0",
@@ -114,7 +114,7 @@
114
114
  "uuid": "^11.1.0"
115
115
  },
116
116
  "devDependencies": {
117
- "@djangocfg/typescript-config": "^2.1.22",
117
+ "@djangocfg/typescript-config": "^2.1.23",
118
118
  "@types/node": "^24.7.2",
119
119
  "@types/react": "^19.1.0",
120
120
  "@types/react-dom": "^19.1.0",
@@ -42,6 +42,7 @@ import { SidebarProvider, SidebarInset, Preloader, ButtonLink } from '@djangocfg
42
42
  import { useAuth } from '@djangocfg/api/auth';
43
43
  import { PrivateSidebar, PrivateHeader, PrivateContent } from './components';
44
44
  import type { LucideIcon as LucideIconType } from 'lucide-react';
45
+ import { UserMenuConfig } from '../shared/types';
45
46
 
46
47
  export interface SidebarItem {
47
48
  label: string;
@@ -59,6 +60,7 @@ export interface HeaderConfig {
59
60
  title?: string;
60
61
  /** Profile path (optional, defaults to '/profile') */
61
62
  profilePath?: string;
63
+ groups?: UserMenuConfig['groups'];
62
64
  }
63
65
 
64
66
  export interface PrivateLayoutProps {
@@ -24,7 +24,6 @@ interface PrivateHeaderProps {
24
24
 
25
25
  export function PrivateHeader({ header }: PrivateHeaderProps) {
26
26
  const { user, logout } = useAuth();
27
- const profilePath = header?.profilePath || '/private/profile';
28
27
 
29
28
  return (
30
29
  <header
@@ -51,7 +50,8 @@ export function PrivateHeader({ header }: PrivateHeaderProps) {
51
50
  {/* User Menu */}
52
51
  <UserMenu
53
52
  variant="desktop"
54
- profilePath={profilePath}
53
+ groups={header?.groups}
54
+ authPath={header?.profilePath}
55
55
  />
56
56
  </div>
57
57
  </header>
@@ -80,8 +80,6 @@ export function PublicMobileDrawer({
80
80
  <UserMenu
81
81
  variant="mobile"
82
82
  groups={userMenu?.groups}
83
- profilePath={userMenu?.profilePath}
84
- dashboardPath={userMenu?.dashboardPath}
85
83
  authPath={userMenu?.authPath}
86
84
  />
87
85
 
@@ -71,8 +71,6 @@ export function PublicNavigation({
71
71
  <UserMenu
72
72
  variant="desktop"
73
73
  groups={userMenu?.groups}
74
- profilePath={userMenu?.profilePath}
75
- dashboardPath={userMenu?.dashboardPath}
76
74
  authPath={userMenu?.authPath}
77
75
  />
78
76
  </>
@@ -32,7 +32,7 @@
32
32
 
33
33
  import React from 'react';
34
34
  import Link from 'next/link';
35
- import { LogOut, Settings } from 'lucide-react';
35
+ import { LogOut } from 'lucide-react';
36
36
  import {
37
37
  DropdownMenu,
38
38
  DropdownMenuContent,
@@ -56,17 +56,11 @@ export interface UserMenuProps {
56
56
  groups?: UserMenuGroup[];
57
57
  /** Auth page path (for sign in button) */
58
58
  authPath?: string;
59
- /** @deprecated Use groups instead - Profile page path (backward compatibility) */
60
- profilePath?: string;
61
- /** @deprecated Use groups instead - Dashboard page path (backward compatibility) */
62
- dashboardPath?: string;
63
59
  }
64
60
 
65
61
  export function UserMenu({
66
62
  variant = 'desktop',
67
63
  groups,
68
- profilePath = '/private/profile',
69
- dashboardPath = '/private',
70
64
  authPath = '/auth',
71
65
  }: UserMenuProps) {
72
66
  const { user, isAuthenticated, logout } = useAuth();
@@ -76,29 +70,18 @@ export function UserMenu({
76
70
  setMounted(true);
77
71
  }, []);
78
72
 
79
- // Prepare menu groups (new groups prop or fallback to legacy props)
73
+ // Prepare menu groups
80
74
  // Must be before early return to maintain hook order
81
75
  const menuGroups: UserMenuGroup[] = React.useMemo(() => {
82
- if (groups && groups.length > 0) {
83
- return groups;
84
- }
76
+ const allGroups: UserMenuGroup[] = [];
85
77
 
86
- // Fallback to legacy behavior for backward compatibility
87
- const legacyGroups: UserMenuGroup[] = [];
88
-
89
- if (profilePath) {
90
- legacyGroups.push({
91
- items: [
92
- {
93
- label: 'Profile',
94
- href: profilePath,
95
- icon: Settings,
96
- },
97
- ],
98
- });
78
+ // Add custom groups if provided
79
+ if (groups && groups.length > 0) {
80
+ allGroups.push(...groups);
99
81
  }
100
82
 
101
- legacyGroups.push({
83
+ // Always add Sign Out at the end
84
+ allGroups.push({
102
85
  items: [
103
86
  {
104
87
  label: 'Sign Out',
@@ -109,8 +92,8 @@ export function UserMenu({
109
92
  ],
110
93
  });
111
94
 
112
- return legacyGroups;
113
- }, [groups, profilePath, logout]);
95
+ return allGroups;
96
+ }, [groups, logout]);
114
97
 
115
98
  if (!mounted) {
116
99
  return null;
@@ -206,10 +206,6 @@ export interface UserMenuGroup {
206
206
  export interface UserMenuConfig {
207
207
  /** Menu groups for authenticated users */
208
208
  groups?: UserMenuGroup[];
209
- /** Profile page path (used when no groups provided - backward compatibility) */
210
- profilePath?: string;
211
- /** Dashboard page path (used when no groups provided - backward compatibility) */
212
- dashboardPath?: string;
213
209
  /** Auth page path (for sign in button) */
214
210
  authPath?: string;
215
211
  }