* Process a single sidebar item for legacy sidebar display.
(item: SidebarItem)
| 359 | * Process a single sidebar item for legacy sidebar display. |
| 360 | */ |
| 361 | function processSidebarItem(item: SidebarItem): NavLinkProps | null { |
| 362 | if (!item.icon) { |
| 363 | return null; |
| 364 | } |
| 365 | |
| 366 | const visibility = item.visibilityCheck?.() ?? { visible: true, disabledReasons: [] }; |
| 367 | if (!visibility.visible) { |
| 368 | return null; |
| 369 | } |
| 370 | |
| 371 | const isEnabled = visibility.disabledReasons.length === 0; |
| 372 | const disabledText = getDisabledText(visibility.disabledReasons); |
| 373 | |
| 374 | return { |
| 375 | title: String(item.title), |
| 376 | to: item.path, |
| 377 | icon: item.icon, |
| 378 | isDisabled: !isEnabled, |
| 379 | disabledText: disabledText || undefined, |
| 380 | }; |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Get disabled text from disabled reasons. |
no test coverage detected
searching dependent graphs…