Skip to content

feat(guid): refresh sidebar actions and skills market entry#1945

Merged
piorpua merged 8 commits intomainfrom
feat/sidebar-skills-market-ui-pr
Mar 31, 2026
Merged

feat(guid): refresh sidebar actions and skills market entry#1945
piorpua merged 8 commits intomainfrom
feat/sidebar-skills-market-ui-pr

Conversation

@ringringlin
Copy link
Copy Markdown
Collaborator

Summary

  • Refresh sidebar top actions with a unified visual/interaction pattern for new chat, search, and batch mode.
  • Improve Guid page action area and skills market entry to make discovery and usage clearer.
  • Keep related UI states aligned across collapsed/expanded sidebar behavior.

Changes

  • Update Sider action layout and interaction styling.
  • Update ConversationSearchPopover trigger behavior and styles for full-width sidebar usage.
  • Refine Guid components and styles around skills market placement and related action flow.

Related Issue

Closes #1944

Test Plan

  • Verify sidebar action area in both collapsed and expanded states.
  • Verify search popover trigger styles and behavior from sidebar.
  • Verify Skills Market banner visibility and interaction on Guid page.
  • Verify no regressions in Guid send flow and agent selection interactions.

Made with Cursor

Unifies sidebar quick actions and updates the Guid skills market experience to be more discoverable and consistent with the new interaction flow.

Made-with: Cursor
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 30, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

CI 检查未通过

以下 job 在本次自动化 review 时未通过,请修复:

Job 结论
Code Quality ❌ FAILURE
Unit Tests (ubuntu-latest) ❌ FAILURE
Unit Tests (macos-14) ❌ FAILURE
Unit Tests (windows-2022) ❌ FAILURE

本次自动化 review 暂缓,待 CI 全部通过后将重新处理。

@piorpua piorpua added bot:ci-waiting CI failed and author notified — snoozed until new commits are pushed and removed bot:reviewing Review in progress (mutex) labels Mar 30, 2026
Updates stale assertions for ACP conversation creation and search selection flow, and includes required formatting-only changes so CI quality checks pass.

Made-with: Cursor
Hides the batch-manage icon in collapsed sidebar so the new chat plus button remains centered and visible.

Made-with: Cursor
Sider passes this key for the full-width search trigger; missing entries showed the key string in the UI.

Made-with: Cursor
Adds a GPU-friendly hover/press animation for the new chat plus icon and respects reduced-motion preferences without changing sidebar layout behavior.

Made-with: Cursor
@piorpua piorpua removed the bot:ci-waiting CI failed and author notified — snoozed until new commits are pushed label Mar 31, 2026
Adds a desktop-only drag handle to snap the sidebar between collapsed and expanded states with a small hysteresis zone to avoid flicker.

Made-with: Cursor
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 31, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

Code Review:feat(guid): refresh sidebar actions and skills market entry (#1945)

变更概述

本 PR 刷新了侧栏顶部操作区域(新会话、搜索、批量管理)在折叠/展开状态下的布局和交互,新增桌面端侧栏拖拽调整宽度功能,将助手详情编辑能力内嵌到 Guid 页面的 AssistantSelectionArea 中,同时精简了 Skills Market Banner 的交互形态。改动涉及 Layout、Sider、GuidPage、AssistantSelectionArea、ConversationSearchPopover、SkillsMarketBanner 等多个模块,并移除了 remote agent 独立路径(合并到 ACP 统一路径)和 warmup 预热调用。


方案评估

结论⚠️ 方案有缺陷

整体方案方向正确——侧栏拖拽、折叠/展开自适应、双击防抖等都是合理的 UX 改进。将 remote agent 路径合并到 ACP 统一路径也是好的简化。但 AssistantSelectionArea 从纯展示组件膨胀为包含完整编辑状态管理(5 个 modal/drawer)的重组件,且同一套 modal 树在两个分支中完整重复了约 180 行,存在明显的代码重复和职责过重问题。


问题清单

🟠 HIGH — AssistantSelectionArea 中 modal/drawer 树完整重复

文件src/renderer/pages/guid/components/AssistantSelectionArea.tsx,第 298–389 行 与 第 449–539 行

问题代码

// 第一处(isPresetAgent 分支,约第 298 行起)
<AssistantEditDrawer editVisible={editor.editVisible} ... />
<DeleteAssistantModal ... />
<AddSkillsModal ... />
<SkillConfirmModals ... />
<AddCustomPathModal ... />

// 第二处(列表视图分支,约第 449 行起)— 完全相同的 props
<AssistantEditDrawer editVisible={editor.editVisible} ... />
<DeleteAssistantModal ... />
<AddSkillsModal ... />
<SkillConfirmModals ... />
<AddCustomPathModal ... />

问题说明:两个 return 分支中完整复制了 ~180 行一模一样的 JSX(5 个 modal/drawer 及其所有 props)。这违反了 DRY 原则,任何 props 变更都需要在两处同步修改,极易引发不一致。

修复建议

将 modal 树提取到组件底部的一个公共片段中,两个分支共享同一份渲染:

const modalTree = (
  <>
    {agentMessageContext}
    <AssistantEditDrawer ... />
    <DeleteAssistantModal ... />
    <AddSkillsModal ... />
    <SkillConfirmModals ... />
    <AddCustomPathModal ... />
  </>
);

// 在两个 return 中:
return (
  <div className='mt-12px w-full'>
    {/* 各自的内容 */}
    {modalTree}
  </div>
);

🟠 HIGH — SkillsMarketBanner enabled 状态硬编码 light-mode 颜色

文件src/renderer/pages/guid/components/SkillsMarketBanner.tsx,第 93–94 行

问题代码

style={
  enabled
    ? {
        backgroundColor: 'rgba(255, 255, 255, 0.45)',
        borderColor: 'rgba(0, 0, 0, 0.08)',
      }
    : undefined
}

问题说明rgba(255,255,255,0.45)rgba(0,0,0,0.08) 是纯白底/纯黑边的硬编码值,在深色主题下背景会显示为不协调的白色半透明块。项目约定要求使用语义 token(var(--color-*)uno.config.ts 中的 token)。

修复建议

style={
  enabled
    ? {
        backgroundColor: 'color-mix(in srgb, var(--color-bg-2) 45%, transparent)',
        borderColor: 'var(--color-border-1)',
      }
    : undefined
}

🟡 MEDIUM — Layout.tsx 拖拽未清理 body style 的边界情况

文件src/renderer/components/layout/Layout.tsx,第 364–365 行

问题代码

document.body.style.cursor = 'col-resize';
document.body.style.userSelect = 'none';

问题说明:如果用户在拖拽过程中鼠标移出窗口(Electron BrowserWindow 之外)并释放鼠标,mouseup 事件可能不会被接收到(取决于 Electron 的 mouseleave 行为),导致 cursoruserSelect 永久停留在拖拽状态。

修复建议

在 effect 中增加 blur 事件监听作为安全清理:

const handleBlur = () => endDrag();
window.addEventListener('blur', handleBlur);
return () => {
  window.removeEventListener('mousemove', handleMouseMove);
  window.removeEventListener('mouseup', endDrag);
  window.removeEventListener('blur', handleBlur);
  endDrag();
};

🟡 MEDIUM — openAssistantDetails useCallback 依赖了未稳定化的 editor 对象

文件src/renderer/pages/guid/components/AssistantSelectionArea.tsx,第 193 行

问题代码

}, [agentMessage, assistants, customAgents, editor, selectedAgentInfo?.customAgentId, selectedAgentKey, t]);

问题说明editoruseAssistantEditor 返回的对象,如果该 hook 每次渲染都返回新的引用(未 useMemo),则 openAssistantDetails 会在每次渲染时重建,进而触发 useLayoutEffect 重新注册,导致不必要的重渲染。应只依赖 editor.handleEdit 而非整个 editor 对象。

修复建议

}, [agentMessage, assistants, customAgents, editor.handleEdit, selectedAgentInfo?.customAgentId, selectedAgentKey, t]);

汇总

# 严重级别 文件 问题
1 🟠 HIGH AssistantSelectionArea.tsx:298-539 modal/drawer 树完整重复 ~180 行
2 🟠 HIGH SkillsMarketBanner.tsx:93-94 硬编码 light-mode 颜色,暗色模式不兼容
3 🟡 MEDIUM Layout.tsx:364 拖拽 body style 在窗口失焦时可能未清理
4 🟡 MEDIUM AssistantSelectionArea.tsx:193 useCallback 依赖整个 editor 对象

结论

⚠️ 有条件批准 — 存在代码重复和暗色模式兼容性问题,修复后可合并。


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: CONDITIONAL
IS_CRITICAL_PATH: false
PR_NUMBER: 1945

@piorpua piorpua added bot:ready-to-fix CONDITIONAL review done, waiting for bot fix bot:fixing Fix in progress (mutex) and removed bot:reviewing Review in progress (mutex) bot:ready-to-fix CONDITIONAL review done, waiting for bot fix labels Mar 31, 2026
zynx added 2 commits March 31, 2026 17:31
- Extract duplicated modal/drawer tree (~180 lines) into shared variable
- Replace hardcoded light-mode colors with semantic tokens for dark mode compat
- Add window blur listener to clean up drag cursor/userSelect state
- Narrow useCallback dependency from entire editor object to editor.handleEdit

Review follow-up for #1945
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

PR Fix 验证报告

原始 PR: #1945
修复方式: 直接推送到 feat/sidebar-skills-market-ui-pr

# 严重级别 文件 问题 修复方式 状态
1 🟠 HIGH AssistantSelectionArea.tsx:298-539 modal/drawer 树完整重复 ~180 行 提取为共享 modalTree 变量,两个分支复用 ✅ 已修复
2 🟠 HIGH SkillsMarketBanner.tsx:93-94 硬编码 light-mode 颜色,暗色模式不兼容 替换为 color-mix(in srgb, var(--color-bg-2) 45%, transparent)var(--color-border-1) ✅ 已修复
3 🟡 MEDIUM Layout.tsx:364 拖拽 body style 在窗口失焦时可能未清理 增加 window blur 事件监听调用 endDrag() ✅ 已修复
4 🟡 MEDIUM AssistantSelectionArea.tsx:193 useCallback 依赖整个 editor 对象 缩窄依赖为 editor.handleEdit ✅ 已修复

总结: ✅ 已修复 4 个 | ❌ 未能修复 0 个

@piorpua piorpua enabled auto-merge (squash) March 31, 2026 09:33
@piorpua piorpua added bot:done Auto-merged by bot and removed bot:fixing Fix in progress (mutex) labels Mar 31, 2026
@piorpua piorpua merged commit 474d1a1 into main Mar 31, 2026
15 of 17 checks passed
@piorpua piorpua deleted the feat/sidebar-skills-market-ui-pr branch March 31, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(guid): improve sidebar actions and skills market discoverability

2 participants