Skip to content

Commit 2a0829f

Browse files
authored
feat: add cookbook feature module structure (#1433)
* feat: add cookbook feature module structure Create frontend/src/features/cookbook/ with: - TypeScript types for registry data (CookbookItem, PatternMeta, etc.) - useCookbook hook stub returning empty data - Page stubs for catalogue grid and pattern detail views - Barrel exports in index.ts - Routes in App.tsx (/cookbook, /cookbook/:name) - Sidebar nav entry in Configuration group * fix: export CookbookFile type from cookbook barrel --------- Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>
1 parent 1718c49 commit 2a0829f

8 files changed

Lines changed: 83 additions & 0 deletions

File tree

frontend/src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { DashboardPage } from '@/features/dashboard'
3030
import { ManifestsPage } from '@/features/manifests'
3131
import { McpConfigPage } from '@/features/mcp-config'
3232
import { TransactionsPage } from '@/features/transactions'
33+
import { CookbookPage, CookbookDetailPage } from '@/features/cookbook'
3334
import { ThemePreviewPanel } from '@/components/dev/theme-preview-panel'
3435

3536
// Placeholder page components - replaced as each page task is implemented
@@ -256,6 +257,8 @@ function AppShellLayout() {
256257
<Route path="/gateway-mappings/:mappingId" element={<FeatureGuard feature="mappings">{guarded(<MappingDetailPage />)}</FeatureGuard>} />
257258
<Route path="/manifests" element={<FeatureGuard feature="manifests">{guarded(<ManifestsPage />)}</FeatureGuard>} />
258259
<Route path="/mcp-config" element={<FeatureGuard feature="mcp-config">{guarded(<McpConfigPage />)}</FeatureGuard>} />
260+
<Route path="/cookbook" element={guarded(<CookbookPage />)} />
261+
<Route path="/cookbook/:name" element={guarded(<CookbookDetailPage />)} />
259262
<Route path="/audit-log" element={<FeatureGuard feature="audit">{guarded(<AuditLogPage />)}</FeatureGuard>} />
260263

261264
{/* Platform-only routes */}

frontend/src/components/layout/sidebar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
CheckSquare,
2020
FileJson,
2121
Bot,
22+
Library,
2223
} from 'lucide-react'
2324
import { cn } from '@/lib/utils'
2425
import { useTenantFeatures } from '@/hooks/use-tenant-features'
@@ -61,6 +62,7 @@ const TENANT_NAV_GROUPS: NavGroup[] = [
6162
{ label: 'Gateway Mappings', href: '/gateway-mappings', icon: Map, feature: 'mappings' },
6263
{ label: 'Manifests', href: '/manifests', icon: FileJson, feature: 'manifests' },
6364
{ label: 'MCP Config', href: '/mcp-config', icon: Bot, feature: 'mcp-config' },
65+
{ label: 'Cookbook', href: '/cookbook', icon: Library },
6466
],
6567
},
6668
{

frontend/src/features/cookbook/components/.gitkeep

Whitespace-only changes.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
export interface CookbookItem {
2+
name: string
3+
type: 'registry:pattern' | 'registry:ui'
4+
title: string
5+
description?: string
6+
categories?: string[]
7+
meta?: PatternMeta | ComponentMeta
8+
files?: CookbookFile[]
9+
}
10+
11+
export interface PatternMeta {
12+
complexity?: number
13+
design_pattern?: string
14+
industries?: string[]
15+
provides?: {
16+
instruments?: string[]
17+
account_types?: string[]
18+
sagas?: string[]
19+
valuation_rules?: string[]
20+
triggers?: string[]
21+
}
22+
requires?: {
23+
instruments?: string[]
24+
market_data?: string[]
25+
}
26+
composes_with?: string[]
27+
conflicts_with?: string[]
28+
extends?: string[]
29+
}
30+
31+
export interface ComponentMeta {
32+
feature_module?: string
33+
used_by?: string[]
34+
configurable?: boolean
35+
}
36+
37+
export interface CookbookFile {
38+
path: string
39+
type?: string
40+
content?: string
41+
}
42+
43+
export interface CookbookRegistry {
44+
name: string
45+
items: CookbookItem[]
46+
}
47+
48+
// Hook stub - returns empty data initially. Task 2 (Vite plugin) will provide real data.
49+
export function useCookbook(): { items: CookbookItem[]; isLoading: boolean } {
50+
// TODO: Replace with Vite plugin bundled data (Task 2)
51+
return { items: [], isLoading: false }
52+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export { CookbookPage } from './pages/index'
2+
export { CookbookDetailPage } from './pages/detail'
3+
export type { CookbookItem, CookbookFile, CookbookRegistry, PatternMeta, ComponentMeta } from './hooks/use-cookbook'
4+
export { useCookbook } from './hooks/use-cookbook'

frontend/src/features/cookbook/lib/.gitkeep

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useParams } from 'react-router-dom'
2+
3+
export function CookbookDetailPage() {
4+
const { name } = useParams<{ name: string }>()
5+
return (
6+
<div className="space-y-6">
7+
<h1 className="text-2xl font-semibold">{name}</h1>
8+
<p className="text-muted-foreground">Pattern detail placeholder</p>
9+
</div>
10+
)
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export function CookbookPage() {
2+
return (
3+
<div className="space-y-6">
4+
<div>
5+
<h1 className="text-2xl font-semibold">Cookbook</h1>
6+
<p className="text-muted-foreground">Browse economy patterns and UI components</p>
7+
</div>
8+
{/* Catalogue grid placeholder - Task 3 */}
9+
</div>
10+
)
11+
}

0 commit comments

Comments
 (0)