1- import type { Meta , StoryObj } from '@storybook/react-vite' ;
2- import DesignSystemStoryFrame from '../../design-system/DesignSystemStoryFrame' ;
3- import SessionPluginConsolePanel from './SessionPluginConsolePanel' ;
1+ import type { ReactNode } from 'react' ;
2+ import SessionPluginConsolePanel from '../session-management/components/SessionPluginConsolePanel' ;
43import type {
54 SessionPluginConsoleMode ,
65 SessionPluginConsolePanelProps ,
7- } from './SessionPluginConsolePanel' ;
6+ } from '../session-management/components/SessionPluginConsolePanel' ;
7+ import {
8+ businessDesignSystemPreviewCatalog ,
9+ type BusinessDesignSystemPreviewCatalogEntry ,
10+ } from './businessComponentPreviewCatalog' ;
811
9- const meta = {
10- title : 'Design System/业务组件/会话插件控制台' ,
11- parameters : {
12- layout : 'fullscreen' ,
13- } ,
14- } satisfies Meta ;
15-
16- export default meta ;
17- type Story = StoryObj ;
12+ export interface BusinessDesignSystemPreview extends BusinessDesignSystemPreviewCatalogEntry {
13+ render : ( ) => ReactNode ;
14+ }
1815
19- const commonConsoleProps : Omit < SessionPluginConsolePanelProps , 'mode' | 'execution' > = {
16+ const sessionPluginConsoleCommonProps : Omit < SessionPluginConsolePanelProps , 'mode' | 'execution' > = {
2017 pluginHostTitle : '会话插件' ,
2118 pluginHostSubtitle : 'CODEX / SESSION MANAGEMENT / 426 sessions / 19 projects' ,
2219 pluginHint : '会话深度分析作为第一个内置插件,后续复盘、对比和导出复用同一宿主协议。' ,
@@ -66,22 +63,9 @@ const commonConsoleProps: Omit<SessionPluginConsolePanelProps, 'mode' | 'executi
6663 } ,
6764 ] ,
6865 scopes : [
69- {
70- id : 'project' ,
71- title : '当前项目' ,
72- subtitle : 'GetTokens / 86 sessions' ,
73- active : true ,
74- } ,
75- {
76- id : 'recent' ,
77- title : '最近 20 条' ,
78- subtitle : 'visible sessions slice' ,
79- } ,
80- {
81- id : 'all' ,
82- title : '全部会话' ,
83- subtitle : '426 sessions, async batch' ,
84- } ,
66+ { id : 'project' , title : '当前项目' , subtitle : 'GetTokens / 86 sessions' , active : true } ,
67+ { id : 'recent' , title : '最近 20 条' , subtitle : 'visible sessions slice' } ,
68+ { id : 'all' , title : '全部会话' , subtitle : '426 sessions, async batch' } ,
8569 ] ,
8670 sessions : [
8771 {
@@ -163,7 +147,7 @@ const commonConsoleProps: Omit<SessionPluginConsolePanelProps, 'mode' | 'executi
163147 ] ,
164148} ;
165149
166- const executions : Record < SessionPluginConsoleMode , SessionPluginConsolePanelProps [ 'execution' ] > = {
150+ const sessionPluginConsoleExecutions : Record < SessionPluginConsoleMode , SessionPluginConsolePanelProps [ 'execution' ] > = {
167151 ready : {
168152 dialLabel : '0%' ,
169153 progress : 0 ,
@@ -188,53 +172,33 @@ const executions: Record<SessionPluginConsoleMode, SessionPluginConsolePanelProp
188172 } ,
189173} ;
190174
191- function buildConsoleProps ( mode : SessionPluginConsoleMode ) : SessionPluginConsolePanelProps {
175+ function buildSessionPluginConsoleProps ( mode : SessionPluginConsoleMode ) : SessionPluginConsolePanelProps {
192176 return {
193- ...commonConsoleProps ,
177+ ...sessionPluginConsoleCommonProps ,
194178 mode,
195- execution : executions [ mode ] ,
179+ execution : sessionPluginConsoleExecutions [ mode ] ,
196180 actionStatusLabel : mode ,
197181 } ;
198182}
199183
200- function ConsoleSample ( { label, mode } : { label : string ; mode : SessionPluginConsoleMode } ) {
201- return (
202- < DesignSystemStoryFrame label = { label } >
203- < div className = "min-w-0 bg-[var(--bg-surface)] p-5" >
204- < SessionPluginConsolePanel { ...buildConsoleProps ( mode ) } />
205- </ div >
206- </ DesignSystemStoryFrame >
207- ) ;
208- }
209-
210- function SessionPluginConsoleOverview ( ) {
184+ function SessionPluginConsolePreview ( ) {
211185 return (
212- < div className = "grid gap-6 bg-[var(--bg-surface)] p-6" >
213- < div >
214- < h2 className = "text-2xl font-black uppercase italic tracking-normal" > 会话插件控制台</ h2 >
215- < p className = "mt-2 max-w-4xl text-[length:var(--font-size-ui-md)] font-bold leading-relaxed text-[var(--text-muted)]" >
216- 会话插件控制台把插件注册表、分析作用域、执行状态、会话选择、队列和结果输出收敛到一个业务组件,用于后续替换 session-management 的临时分析面板。
217- </ p >
218- </ div >
219- < ConsoleSample label = "DS-SESSION-PLUGIN-CONSOLE-READY" mode = "ready" />
220- < ConsoleSample label = "DS-SESSION-PLUGIN-CONSOLE-RUNNING" mode = "running" />
221- < ConsoleSample label = "DS-SESSION-PLUGIN-CONSOLE-DONE" mode = "done" />
186+ < div className = "grid gap-5" >
187+ { ( [ 'ready' , 'running' , 'done' ] as const ) . map ( ( mode ) => (
188+ < section key = { mode } className = "grid gap-3" >
189+ < div className = "text-[length:var(--font-size-ui-xs)] font-black uppercase tracking-[0.18em] text-[var(--text-muted)]" >
190+ DS-SESSION-PLUGIN-CONSOLE-{ mode . toUpperCase ( ) }
191+ </ div >
192+ < SessionPluginConsolePanel { ...buildSessionPluginConsoleProps ( mode ) } />
193+ </ section >
194+ ) ) }
222195 </ div >
223196 ) ;
224197}
225198
226- export const Overview : Story = {
227- render : ( ) => < SessionPluginConsoleOverview /> ,
228- } ;
229-
230- export const Ready : Story = {
231- render : ( ) => < ConsoleSample label = "DS-SESSION-PLUGIN-CONSOLE-READY" mode = "ready" /> ,
232- } ;
233-
234- export const Running : Story = {
235- render : ( ) => < ConsoleSample label = "DS-SESSION-PLUGIN-CONSOLE-RUNNING" mode = "running" /> ,
236- } ;
237-
238- export const Done : Story = {
239- render : ( ) => < ConsoleSample label = "DS-SESSION-PLUGIN-CONSOLE-DONE" mode = "done" /> ,
240- } ;
199+ export const businessDesignSystemPreviews = [
200+ {
201+ ...businessDesignSystemPreviewCatalog [ 0 ] ,
202+ render : ( ) => < SessionPluginConsolePreview /> ,
203+ } ,
204+ ] as const satisfies readonly BusinessDesignSystemPreview [ ] ;
0 commit comments