Skip to content

Conversation

@DJJones66
Copy link
Contributor

🚀 Feature: Hierarchical Sidebar Navigation System

This PR introduces a full-stack implementation of a hierarchical sidebar navigation system that replaces the previous flat navigation model. It includes backend schema and API updates, frontend tree rendering with collapsible groups, and dynamic route management.


✨ Key Features

🧠 Backend Enhancements

  • Model Changes (NavigationRoute)

    • Added support for:

      • parent_id (for nesting)
      • display_order (sibling sorting)
      • is_collapsible, is_expanded (UI state)
    • Defined recursive relationships (parent, children)

    • Added utility methods:

      • get_tree_structure()
      • move_to_parent()
      • validate_hierarchy()
      • get_max_display_order()
  • New API Endpoints

    • GET /navigation-routes/tree: returns full navigation tree per user
    • PUT /navigation-routes/{id}/move: move route under a new parent or position
    • POST /navigation-routes/batch-update: update multiple routes (expanded, display order, etc.)
  • Schema Updates

    • Extended Pydantic models to support tree, move, and batch operations
    • Enabled forward references in NavigationRouteTree
  • Navigation Initializer

    • Two-pass logic to initialize:

      1. Top-level routes like "Your BrainDrive"
      2. Child routes like "Settings", "Personas", etc.
    • Modularized SQL insert logic via _create_route()

  • Alembic Migration

    • New migration: add_hierarchical_navigation_support
    • Adds necessary columns, foreign keys, indexes
    • Creates "Your BrainDrive" and "Your Pages" root nodes
    • Migrates existing routes under proper parents

🖥️ Frontend Enhancements

  • Sidebar Navigation Overhaul (PageNavigation.tsx)

    • Replaced flat route list with a tree structure
    • Routes support nesting, expansion toggles, and dynamic linking
    • Backward-compatible fallback if tree API fails
  • Route Display Improvements

    • Preserves legacy logic for pages associated with routes
    • Consolidates system routes and custom pages under expandable nodes
  • New UX Behavior

    • Automatic expansion of routes based on is_expanded
    • Persistent toggling of expanded/collapsed state
    • Improved handling for default page routing

🛠 Dev Environment

  • Vite Config & Debugging

    • Forced dependency optimization for consistent hot reload
    • Updated VSCode launch config to reflect these options

✅ Benefits

  • Organized Navigation: Users can group pages under meaningful parent nodes
  • Better UX: Collapsible groups improve clarity, especially for power users
  • Future-Proof: Lays foundation for drag-and-drop, custom nav editors
  • Clean Migration: No breaking changes for existing users

@DJJones66 DJJones66 merged commit 30068ea into main Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants