Files
KArtSell.Aegis/frontend/src/registry/screens.ts
T
kjh2064 9ed9a5c3fe feat: apply KBX Foundation v4 pattern to home navigation
1. Create home feature registry (registry.ts)
   - Define homeScreen: KbxScreenDefinition
   - screenId: "home.dashboard"
   - Module: "Home"
   - Type: "dashboard"
   - Accessible to all users (no permissions required)

2. Update central registry (registry/screens.ts)
   - Import homeScreens from home/registry
   - Add homeScreens to getAllScreens()
   - Prepare for dynamic screen loading

3. Refactor HomePage.vue (KBX pattern)
   - Replace navigationCatalog with registry-driven screens
   - Use useKbxRegistry() composable
   - Dynamic module grouping from registry
   - Favorites/recent workbench
   - Attention items aggregation (DEBT-030)

4. Extend module types (kbx-types.ts)
   - Add "Home" to module union type
   - Support existing modules: Research, Operations, Portfolio, etc.
   - Flexible module extensibility

Features:
- Registry-driven navigation
- Centralized screen definitions
- Dynamic module grouping and sorting
- Favorites/recent screen tracking
- Type-safe screen lookups
- Zero hardcoded navigation paths

Benefits:
- Single source of truth for screen registry
- Automatic sync with router definitions
- Easy to add new modules
- Maintainable and testable

TypeScript:  PASS (0 errors)
Typecheck time: ~5s

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-12 02:00:05 +09:00

89 lines
2.6 KiB
TypeScript

/**
* Central Screen Registry
* Merge all feature screen definitions here
*/
import type { KbxScreenDefinition } from '@shared/contracts/kbx-types'
import { homeScreens } from '@features/home/registry'
// Import screen definitions from each feature module
// import { shadowRunScreens } from '@features/shadow-run/registry'
// import { modelScreens } from '@features/models/registry'
// Temporary: define a few example screens
export const exampleScreens: KbxScreenDefinition[] = [
{
screenId: 'model-ops.shadow-run.list',
title: 'Shadow Run Validation',
module: 'ModelOps',
type: 'list',
path: '/model-ops/shadow-runs',
component: () => import('@features/shadow-run/pages/ShadowRunList.vue'),
permissions: ['model.read'],
description: 'View and manage shadow run validations',
help: {
title: 'Shadow Run Validation',
sections: [
{
title: 'What is a Shadow Run?',
content: 'A shadow run validates model performance on historical data without executing trades.',
},
{
title: 'How to Use',
content: 'Click the search button to run a new shadow run. View results in the list below.',
},
],
relatedScreens: ['model-ops.models.list'],
},
shortcuts: [
{ key: 'F3', label: 'Search', action: 'search' },
{ key: 'Ctrl+N', label: 'New', action: 'new' },
],
telemetry: { enabled: true },
},
{
screenId: 'model-ops.models.list',
title: 'Model Management',
module: 'ModelOps',
type: 'list',
path: '/model-ops/models',
component: () => import('@features/models/pages/ModelsList.vue'),
permissions: ['model.read'],
description: 'Manage trading models and their lifecycle',
shortcuts: [{ key: 'F3', label: 'Search', action: 'search' }],
telemetry: { enabled: true },
},
]
/**
* Merged screen registry (all features)
*/
export function getAllScreens(): KbxScreenDefinition[] {
const screens: KbxScreenDefinition[] = []
// Add screens from all modules
screens.push(...homeScreens)
// screens.push(...shadowRunScreens)
// screens.push(...modelScreens)
// Add example screens for now
screens.push(...exampleScreens)
return screens
}
/**
* Screen index by ID for fast lookup
*/
export function buildScreenIndex(): Map<string, KbxScreenDefinition> {
const index = new Map<string, KbxScreenDefinition>()
getAllScreens().forEach(screen => {
index.set(screen.screenId, screen)
})
return index
}
// Export registry
export const screens = getAllScreens()
export const screenIndex = buildScreenIndex()