diff --git a/changelog.d/changed-remove-legacy-sidebar-group.md b/changelog.d/changed-remove-legacy-sidebar-group.md new file mode 100644 index 0000000..9c9c116 --- /dev/null +++ b/changelog.d/changed-remove-legacy-sidebar-group.md @@ -0,0 +1 @@ +- Remove the unreachable Legacy Components group from DocsSidebar (empty project list, uncalled renderer, dangling /docs/legacy-components link). diff --git a/src/components/docs/DocsSidebar.tsx b/src/components/docs/DocsSidebar.tsx index 0d40050..6550b82 100644 --- a/src/components/docs/DocsSidebar.tsx +++ b/src/components/docs/DocsSidebar.tsx @@ -40,14 +40,8 @@ const PRIMARY_PROJECTS = [ { id: 'spektacular', label: 'Spektacular', href: '/docs/spektacular/overview/introduction' }, ] as const; -// No legacy projects on the Hive Commons docs site. -const LEGACY_PROJECTS: ReadonlyArray<{ id: string; label: string; href: string }> = []; - -const ALL_PROJECTS = [...PRIMARY_PROJECTS, ...LEGACY_PROJECTS] as const; - // Key prefix for project-level collapse state (avoids collision with nav item keys) const PROJECT_KEY_PREFIX = '__project_'; -const LEGACY_GROUP_KEY = '__legacy'; const GENERAL_SECTION_PATH_REGEX = new RegExp( `^/docs/(${GENERAL_SECTION_SLUGS.join('|')})(/|$)`, ); @@ -77,8 +71,6 @@ function getFirstChildRoute(item: MenuItem): string | undefined { return undefined; } -const LEGACY_OVERVIEW_HREF = '/docs/legacy-components'; - export function DocsSidebar({ pageMap, className, projectId }: DocsSidebarProps) { const pathname = usePathname(); const sidebarRef = useRef(null); @@ -152,19 +144,13 @@ export function DocsSidebar({ pageMap, className, projectId }: DocsSidebarProps) const activeProjectId = projectId || 'hive'; // Keep non-active project sections collapsed by default - for (const proj of ALL_PROJECTS) { + for (const proj of PRIMARY_PROJECTS) { const isProjectLink = currentPath === '/docs/introduction' || proj.id !== activeProjectId; if (isProjectLink) { initialCollapsed.add(`${PROJECT_KEY_PREFIX}${proj.id}`); } } - // Collapse legacy group if active project is not a legacy project - const legacyIds = LEGACY_PROJECTS.map(p => p.id) as readonly string[]; - if (!legacyIds.includes(activeProjectId)) { - initialCollapsed.add(LEGACY_GROUP_KEY); - } - // For the active project, find the path to the active page and collapse non-active folders const activeItems = getProjectItems(pageMap); const activeParentKey = `${PROJECT_KEY_PREFIX}${activeProjectId}`; @@ -226,18 +212,6 @@ export function DocsSidebar({ pageMap, className, projectId }: DocsSidebarProps) setCollapsed(initialCollapsed); }, [pageMap, projectId, navInitialized, setCollapsed]); - // Keep legacy group collapsed while browsing general sections - useEffect(() => { - if (!GENERAL_SECTION_PATH_REGEX.test(pathname)) return; - - setCollapsed(prev => { - if (prev.has(LEGACY_GROUP_KEY)) return prev; - const next = new Set(prev); - next.add(LEGACY_GROUP_KEY); - return next; - }); - }, [pathname, setCollapsed]); - const toggleCollapse = (itemKey: string) => { toggleNavCollapsed(itemKey); }; @@ -463,62 +437,6 @@ export function DocsSidebar({ pageMap, className, projectId }: DocsSidebarProps) return renderProjectLink(proj.id, proj.label, proj.href, depth); }; - // Render the Legacy group with sub-projects - const renderLegacyGroup = () => { - const isExpanded = !collapsed.has(LEGACY_GROUP_KEY); - // Don't highlight Legacy Components when viewing docs guide or general sections - const isGeneralSectionPath = GENERAL_SECTION_PATH_REGEX.test(pathname); - const isActiveLegacy = !isDocsGuide && !isGeneralSectionPath && LEGACY_PROJECTS.some(p => p.id === projectId); - - return ( -
-
- { if (!isExpanded) toggleCollapse(LEGACY_GROUP_KEY); }} - className="flex-1 truncate" - > - Legacy Components - - -
- -
- {LEGACY_PROJECTS.map(proj => renderProject(proj, 1))} -
-
- ); - }; - // Render full sidebar (expanded state) const renderFullSidebar = () => { // General sections (Contributing, Community, News) from current project's pageMap