refactor: 练习场四贴签组件提取入 components 成通用件 #48

Merged
arnold.cui merged 1 commits from refactor/extract-playground-components into main 2026-11-15 02:38:44 +00:00
Owner

背景

练习场的四个贴签/侧栏组件——tips、验收清单、playground 侧栏、陪练 agent——都困在 pages/practice/ 里,其中 agent 贴签甚至内联在 PracticeWorkspace 中没有成件。这四件后续要在其他页面大量复用,先提取为 src/components/ 通用组件。

变更内容

  • 新增 src/components/{TipsDock,ChecklistDock,PlaygroundDock,AgentDock,ChatPanel}.tsx,practice 下四个旧文件移除(git 识别为 rename)
  • TipsDock / ChecklistDock:包 Dropdown 的预设壳;label 改必填 prop,practice 专属文案由调用方显式传入
  • PlaygroundDock:解除对 playground context 的直接 import,runSeq 改为可选 prop(缺省 0 不触发自动切页签);practice 侧新增文件局部 PracticeDock 在 Provider 内接线
  • AgentDock:收拢原内联 DockPop 配置(accent / 面板尺寸 / fill 固化为默认值),children 即面板体
  • ChatPanel 原样随迁(本就零 practice 依赖,ChatItem 类型随文件走);KeyModal 属 LLM 配置,留守 practice
  • DOM 输出与提取前逐字节等价:全部 data-comp / aria / 文案零变化

自测结果

  • yarn workspace @stack/tutorial build 通过(24 页 SSG 预渲染);strip-comments 0 注释、biome format 干净
  • e2e:127 passed / 2 failed;两例失败(learn.spec 新手引导、page-flip-visual 快照)在 main 基线 ae18ea2 上同样失败,为存量问题与本 PR 无关;practice / playground-* / learning-kit 相关 spec 全绿
  • 视觉对照(口径同 e2e:stack preview + VITE_STACK_RUNTIME_ORIGIN,playwright chromium,1280×900 / 390×844,fonts.ready 后视口截图):桌面默认 / tips 展开 / 清单展开 / 编辑器拉开 / agent 展开+移动默认 / 编辑器共 7 组状态,与 main 基线 cmp 逐字节一致;前后对照贴图见下

桌面 1280×900 · 默认(before / after)

before
after

桌面 1280×900 · tips 展开(before / after)

before
after

桌面 1280×900 · playground 编辑器拉开(before / after)

before
after

## 背景 练习场的四个贴签/侧栏组件——tips、验收清单、playground 侧栏、陪练 agent——都困在 `pages/practice/` 里,其中 agent 贴签甚至内联在 PracticeWorkspace 中没有成件。这四件后续要在其他页面大量复用,先提取为 `src/components/` 通用组件。 ## 变更内容 - 新增 `src/components/{TipsDock,ChecklistDock,PlaygroundDock,AgentDock,ChatPanel}.tsx`,practice 下四个旧文件移除(git 识别为 rename) - TipsDock / ChecklistDock:包 Dropdown 的预设壳;label 改必填 prop,practice 专属文案由调用方显式传入 - PlaygroundDock:解除对 playground context 的直接 import,runSeq 改为可选 prop(缺省 0 不触发自动切页签);practice 侧新增文件局部 PracticeDock 在 Provider 内接线 - AgentDock:收拢原内联 DockPop 配置(accent / 面板尺寸 / fill 固化为默认值),children 即面板体 - ChatPanel 原样随迁(本就零 practice 依赖,ChatItem 类型随文件走);KeyModal 属 LLM 配置,留守 practice - DOM 输出与提取前逐字节等价:全部 data-comp / aria / 文案零变化 ## 自测结果 - `yarn workspace @stack/tutorial build` 通过(24 页 SSG 预渲染);strip-comments 0 注释、biome format 干净 - e2e:127 passed / 2 failed;两例失败(learn.spec 新手引导、page-flip-visual 快照)在 main 基线 ae18ea2 上同样失败,为存量问题与本 PR 无关;practice / playground-* / learning-kit 相关 spec 全绿 - 视觉对照(口径同 e2e:stack preview + VITE_STACK_RUNTIME_ORIGIN,playwright chromium,1280×900 / 390×844,fonts.ready 后视口截图):桌面默认 / tips 展开 / 清单展开 / 编辑器拉开 / agent 展开+移动默认 / 编辑器共 7 组状态,与 main 基线 cmp 逐字节一致;前后对照贴图见下 ### 桌面 1280×900 · 默认(before / after) ![before](https://gitea.idealjs.com/attachments/a9a7d59d-4ad5-4e29-b4e4-eaff82abc856) ![after](https://gitea.idealjs.com/attachments/44209327-c174-4b02-a596-e13ca7697173) ### 桌面 1280×900 · tips 展开(before / after) ![before](https://gitea.idealjs.com/attachments/0d1bdaf5-6cfc-4786-b023-b3eead8bba16) ![after](https://gitea.idealjs.com/attachments/cfc5eadb-38c2-4dcd-bbcc-eb4851650125) ### 桌面 1280×900 · playground 编辑器拉开(before / after) ![before](https://gitea.idealjs.com/attachments/e1d38f2e-ce5e-4b4d-b2c0-3e1b990f0ec5) ![after](https://gitea.idealjs.com/attachments/d1883849-0b66-4649-83fb-6bb765113951)
arnold.cui added 1 commit 2026-11-15 02:24:37 +00:00
TipsDock / ChecklistDock / PlaygroundDock / AgentDock 四件从 practice 页提为
src/components/ 通用组件,供其他页面复用:

- TipsDock、ChecklistDock:包 Dropdown 的预设壳,label 改必填 prop,
  practice 专属文案(tips · 喂给陪练 / 验收清单)由调用方显式传入;
- PlaygroundDock:解除对 playground context 的直接 import,runSeq 改为
  可选 prop(缺省 0 不触发自动切页签),practice 侧在 Provider 内以文件
  局部组件接线,通用件不再绑定 playground;
- AgentDock:收拢 PracticeWorkspace 内联的 DockPop 配置(accent/面板尺寸
  /fill 固化为默认值),children 即面板体;
- ChatPanel 原样随迁(本就零 practice 依赖),ChatItem 类型随文件走;
- KeyModal 属 LLM 配置,留守 practice。

DOM 输出与提取前逐字节等价:data-comp、aria、文案零变化,7 组视口截图
(桌面默认/tips/清单/编辑器/agent+移动默认/编辑器)与 main 基线 cmp 一致。
arnold.cui merged commit 99d6552ef2 into main 2026-11-15 02:38:44 +00:00
arnold.cui deleted branch refactor/extract-playground-components 2026-11-15 02:38:44 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: idealjs/stack#48