Intelligent Guide System
Comprehensive documentation system guides
π― Intelligent Guide System - isGuide Boolean Solution
β BRILLIANT USER-DRIVEN SOLUTION
This solution was suggested by the user and represents the perfect approach to guide detection - simple, explicit, and intelligent.
π§ How It Works
π― Simple Boolean Flag
Add isGuide: true to any navigation item that should show an auto-guide:
{
icon: 'πΊοΈ',
text: 'Space Map',
link: '/apps/space-map',
isGuide: true, // β
Explicit guide marker
order: 4
}
π Intelligent Detection Flow
- Step 1: Check if route has
isGuide: trueβ Show auto-guide immediately - Step 2: If no flag, check for children (fallback) β Show auto-guide if children exist
- Step 3: If no flag and no children β Load content
π‘ Why This Solution is Perfect
β Explicit Control
- Clear intent -
isGuide: trueexplicitly says "show auto-guide" - No guessing - System knows exactly what to do
- Predictable - Same flag always produces same result
β Zero 404 Errors
- No content loading - When
isGuide: true, skips content loading entirely - Clean console - No more 404 errors for guide routes
- Efficient - Eliminates unnecessary HTTP requests
β Super Easy to Use
- Add new guide - Just add
isGuide: trueto navigation item - Switch to content - Remove
isGuideflag and add content file - Developer friendly - Crystal clear what each route does
β Intelligent Fallback
- Backward compatible - Existing routes without flags still work
- Children detection - Fallback to old logic for unmarked routes
- Best of both worlds - Explicit control + automatic detection
π οΈ Implementation Details
π Navigation Interface
export interface NavigationItem {
text: string;
link?: string;
items?: NavigationItem[];
// ... other properties
isGuide?: boolean; // β
NEW: Explicitly marks auto-guide routes
}
π― Manual Override Configuration
readonly manualOverrides = signal<NavigationItem[]>([
{
icon: 'π',
text: 'Applications',
link: '/apps',
isGuide: true, // β
Main apps route shows auto-guide
items: [
{ icon: 'π', text: 'Singularity App', link: '/apps/singularity', isGuide: true },
{ icon: 'π', text: 'Editor Web', link: '/apps/editor-web', isGuide: true },
{ icon: 'πΊοΈ', text: 'Space Map', link: '/apps/space-map', isGuide: true },
{ icon: 'π§ͺ', text: 'UX Test', link: '/apps/ux-test', isGuide: true }
]
}
]);
π§ Smart Loading Logic
private smartLoadContent(path: string): void {
// β
STEP 1: Check explicit guide flag
if (this.isExplicitGuideRoute(cleanPath)) {
console.log(`π― Explicit guide route: ${cleanPath} - showing auto-guide immediately`);
this.showAutoGuide.set(true);
return;
}
// β
STEP 2: Check children (fallback)
const hasChildren = this.hasNavigationChildren(cleanPath);
if (hasChildren) {
this.showAutoGuide.set(true);
return;
}
// β
STEP 3: Load content
this.loadContent(cleanPath);
}
π Results
π Perfect User Experience
- πΊοΈ Space Map route β Beautiful auto-guide (no more content confusion)
- π§ͺ UX Test route β Beautiful auto-guide
- π Editor Web route β Beautiful auto-guide
- π Singularity route β Beautiful auto-guide
π§ Perfect Developer Experience
- Zero 404 errors - Clean console output
- Explicit control - Developers know exactly what happens
- Easy maintenance - Add/remove
isGuideflag as needed - Intelligent system - Falls back gracefully for other routes
π Clean Console Output
π Intelligent loading for path: "/apps/space-map"
π― Explicit guide route: /apps/space-map - showing auto-guide immediately
# No more:
# β GET http://localhost:5010/assets/docs/english/apps/space-map.md 404 (Not Found)
# β GET http://localhost:5010/assets/docs/english/apps/space-map.en.md 404 (Not Found)
π Usage Examples
π― Adding New Auto-Guide Section
// Just add isGuide: true to navigation
{
icon: 'π§',
text: 'My New Section',
link: '/my-section',
isGuide: true // β
Will show auto-guide with children
}
π Converting Guide to Content
// Remove isGuide flag and add content file
{
icon: 'π§',
text: 'My New Section',
link: '/my-section'
// isGuide: true β Remove this
}
// Create: /assets/docs/english/my-section.md with content
π Mixed Section (Some Guides, Some Content)
{
text: 'Documentation',
items: [
{ text: 'Overview', link: '/docs/overview', isGuide: true }, // Auto-guide
{ text: 'API Reference', link: '/docs/api' }, // Content
{ text: 'Examples', link: '/docs/examples', isGuide: true } // Auto-guide
]
}
π― Best Practices
β
When to Use isGuide: true
- Directory with children - Section that contains multiple sub-pages
- Navigation hub - Routes that serve as entry points to content areas
- Overview pages - Routes that should showcase available content
β
When NOT to Use isGuide: true
- Content pages - Routes with specific markdown content
- Detail pages - Routes showing specific information
- Leaf nodes - Routes with no children
π Naming Convention
// β
GOOD: Clear indication of purpose
{ text: 'Apps Overview', link: '/apps', isGuide: true }
{ text: 'Getting Started', link: '/guide/getting-started' } // content
// β
GOOD: Consistent pattern
{ text: 'Libraries', link: '/libs', isGuide: true } // guide
{ text: 'Core Library', link: '/libs/core' } // content
π Conclusion
The isGuide boolean solution is brilliant because it:
π― For Users
- Predictable behavior - Routes work consistently
- Beautiful guides - When intended, perfect auto-guides display
- No broken experiences - Zero 404 errors or confusion
π οΈ For Developers
- Crystal clear intent -
isGuide: truetells the whole story - Easy to use - Add/remove one boolean flag
- Maintainable - Simple logic that's easy to debug
π For System
- Performant - No unnecessary HTTP requests
- Clean - No 404 errors cluttering console
- Scalable - Pattern works for any number of routes
This user-suggested solution represents the perfect balance of simplicity, clarity, and intelligence! π