feat(web-ui): add branch switcher popover to chat input workspace strip - #1843
Open
ArrogHie wants to merge 2 commits into
Open
feat(web-ui): add branch switcher popover to chat input workspace strip#1843ArrogHie wants to merge 2 commits into
ArrogHie wants to merge 2 commits into
Conversation
Add clickable branch chip in ChatInputWorkspaceStrip that opens a BranchQuickSwitch popover for quick branch switching and creation. BranchQuickSwitch enhancements: - Add onCreateSuccess prop and branch creation capability - Show 'Create branch' option when search term does not match existing branches (calls gitService.createBranch, which runs git checkout -b) - Add isCreating/creatingBranch state with loading spinner - Update keyboard navigation: Enter triggers creation when search term is new, otherwise switches to selected branch - Add --create item variant with accent color styling ChatInputWorkspaceStrip integration: - Branch chip becomes clickable (role=button, onClick, Enter/Space keys) when repository is available - Render BranchQuickSwitch through createPortal to document.body to avoid disrupting the absolutely-positioned strip layout - Add --branch-clickable modifier with pointer cursor and hover styles - Update branch tooltip to 'Click to switch or create branch' i18n (en-US/zh-CN/zh-TW): - quickSwitch.searchPlaceholder: 'Search or create branch...' - quickSwitch.createBranchLabel: 'Create branch' / '创建分支' / '建立分支' - quickSwitch.errors.createFailed: 'Failed to create branch' / ... - workspaceStrip.branchTooltip: 'Click to switch or create branch' / ... Tests: - Mock BranchQuickSwitch, add click interaction test - Add non-repo guard test (chip not clickable when no repository) - Query document instead of container for portaled element
ArrogHie
force-pushed
the
feat/chat-branch-switcher
branch
from
July 30, 2026 03:13
3a65845 to
376c41f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
聊天输入框下方的工作区条显示
BitFun / main格式信息,其中分支部分此前是纯展示性的,无法交互。希望点击分支名后弹出面板,快速切换或创建分支。改动内容
1. BranchQuickSwitch 增强 — BranchQuickSwitch.tsx / BranchQuickSwitch.scss
onCreateSuccess回调 propcanCreateNewBranch逻辑:搜索词不匹配任何现有分支时显示"创建分支"选项handleCreateBranch方法:调用gitService.createBranch(执行git checkout -b,创建并切换)--create选项样式(Plus 图标、accent 高亮色)2. ChatInputWorkspaceStrip 集成 — ChatInputWorkspaceStrip.tsx / ChatInputWorkspaceStrip.scss
role=button、onClick、Enter/Space 键盘支持)createPortal(..., document.body)渲染弹窗,避免破坏 strip 的绝对定位布局--branch-clickable修饰类(pointer cursor、hover、focus-visible)3. i18n — 6 个 locale 文件(en-US / zh-CN / zh-TW)
quickSwitch.searchPlaceholderquickSwitch.createBranchLabelquickSwitch.errors.createFailedworkspaceStrip.branchTooltip4. 测试 — ChatInputWorkspaceStrip.test.tsx
BranchQuickSwitch组件document而非container验证结果
pnpm run type-check:web— 通过pnpm run i18n:audit— 0 warnings交互流程