camelmind 0.2.6 → 0.2.7

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": "camelmind",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Create and manage CamelMind documentation sites",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -102,11 +102,14 @@ export function MobileDrawer({
102
102
  <nav className="flex-1 px-3 py-4 space-y-1">
103
103
  {nav.map((item) => {
104
104
  if (isNavGroup(item)) {
105
- if ((item.noDropdown || !item.items) && item.slug) {
105
+ const visibleItems = (item.items ?? []).filter((i) => canSee(i.roles))
106
+ const directHref = item.slug ?? visibleItems[0]?.slug
107
+
108
+ if ((item.noDropdown || !item.items) && directHref) {
106
109
  return (
107
110
  <Link
108
111
  key={item.label}
109
- href={item.slug}
112
+ href={directHref}
110
113
  className="block px-3 py-2.5 text-sm font-medium text-gray-200 hover:text-white hover:bg-gray-800 rounded-lg"
111
114
  >
112
115
  {item.label}
@@ -114,7 +117,6 @@ export function MobileDrawer({
114
117
  )
115
118
  }
116
119
 
117
- const visibleItems = (item.items ?? []).filter((i) => canSee(i.roles))
118
120
  if (visibleItems.length === 0) return null
119
121
  const isExpanded = expandedGroup === item.label
120
122
 
@@ -60,15 +60,17 @@ export function TopNav({ nav, userRoles, userName, authEnabled = false, versions
60
60
  <div className="hidden md:flex items-center gap-6 flex-1">
61
61
  {nav.map((item) => {
62
62
  if (isNavGroup(item)) {
63
- if ((item.noDropdown || !item.items) && item.slug) {
63
+ const visibleItems = (item.items ?? []).filter((i) => canSee(i.roles))
64
+ const directHref = item.slug ?? visibleItems[0]?.slug
65
+
66
+ if ((item.noDropdown || !item.items) && directHref) {
64
67
  return (
65
- <Link key={item.label} href={item.slug} className="text-sm font-medium hover:text-gray-300">
68
+ <Link key={item.label} href={directHref} className="text-sm font-medium hover:text-gray-300">
66
69
  {item.label}
67
70
  </Link>
68
71
  )
69
72
  }
70
73
 
71
- const visibleItems = (item.items ?? []).filter((i) => canSee(i.roles))
72
74
  if (visibleItems.length === 0) return null
73
75
 
74
76
  return (
@@ -19,7 +19,7 @@ export type NavGroup = {
19
19
  label: string
20
20
  dropdown: boolean
21
21
  noDropdown?: boolean // show as direct link in top nav, not a dropdown button
22
- slug?: string // href for the direct link when noDropdown is true
22
+ slug?: string // optional direct-link href; falls back to the first visible item
23
23
  items: NavEntry[]
24
24
  }
25
25