Skip to content

refactor(ui): replace modal implementation with Dialog component in R… - #448

Draft
Loosand wants to merge 4 commits into
mainfrom
bugfix/dialog
Draft

refactor(ui): replace modal implementation with Dialog component in R…#448
Loosand wants to merge 4 commits into
mainfrom
bugfix/dialog

Conversation

@Loosand

@Loosand Loosand commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

关联 Issue

概要

RemotePathPickerModalGitBranchSelector 中手写的模态框实现替换为基于 Base UI 的共享 shadcn 风格 Dialog 组件。

原实现通过 createPortalfixed 和手动设置 z-index 管理弹层。当用户在“新建 Worktree”模态框中继续打开远程目录选择器时,会形成两层相互独立的手写模态框,容易出现遮罩层、焦点锁定、Escape 键响应和层级顺序冲突。

本次改动:

  • 新增基于 @base-ui/react/dialog 的共享 Dialog 组件;
  • 将“新建 Worktree”模态框迁移到共享 Dialog;
  • 将 WebUI 远程路径选择器迁移到同一套 Dialog;
  • 保持路径选择器位于 Worktree Dialog 的嵌套上下文中,由 Base UI 统一管理焦点、Escape、遮罩和弹层顺序;
  • 保留原有表单字段、校验逻辑、操作流程和视觉布局。

变更范围

  • 模块:agent-uiagent-gateway/web
  • 关键路径:
    • crates/agent-ui/src/components/ui/dialog.tsx
    • crates/agent-ui/src/components/git/GitBranchSelector.tsx
    • crates/agent-gateway/web/src/components/RemotePathPickerModal.tsx
    • crates/agent-ui/src/styles/base.css

截图 / 运行预览

修改前

修改后

嵌套目录选择器

运行时检查步骤:

  1. 打开分支选择菜单,点击“新建 Worktree”;
  2. 点击“保存位置”旁的“选择…”;
  3. 确认目录选择器正确显示在 Worktree 模态框上方;
  4. 按下 Escape,确认只关闭最上层的目录选择器;
  5. 确认焦点返回到 Worktree 模态框;
  6. 关闭 Worktree 模态框,确认焦点返回原触发入口。

验证

已执行:

  • cd crates/agent-gui && node_modules/.bin/tsc --noEmit
  • cd crates/agent-gateway/web && node_modules/.bin/tsc --noEmit
  • cd crates/agent-gui && node_modules/.bin/vite build
  • cd crates/agent-gateway/web && node_modules/.bin/vite build
  • node scripts/check-ui-boundaries.mjs
  • git diff --check

GUI 和 WebUI 的 TypeScript 检查、生产构建及 UI 边界检查均通过。

本次改动仅替换模态框基础组件,Worktree 创建与路径选择的业务逻辑保持不变,因此未新增专项业务测试;嵌套 Dialog 的交互通过上述运行流程验证。

提交前检查

  • 已关联需求 Issue。
  • 已同步目标分支,且不存在合并冲突。
  • 改动范围集中,不包含无关修改。
  • 未包含密钥、Token 或个人数据。
  • 用户行为及配置方式未发生变化,无需更新文档。

@StackCairn
StackCairn marked this pull request as draft August 13, 2026 03:47
@github-actions

Copy link
Copy Markdown
Contributor

PR governance checks failed — this PR has been converted to draft.

  • No linked issue: the PR body must contain Closes #123 / Fixes #123 / Resolves #123. This project requires an issue before a PR — see the contribution guidelines.
  • UI change without screenshots: this PR modifies frontend code. Please add before/after screenshots or a recording under "Screenshots / preview" in the PR body.

Fix the items above, then click Ready for review to re-run the checks.

…oss various components for consistency and improved user experience
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant