Skip to content

feat(desktop): allow hiding project source labels on pinned tasks - #3268

Open
nothingyuancando wants to merge 3 commits into
makecindy:mainfrom
nothingyuancando:feat/2931-toggle-pinned-source-label
Open

feat(desktop): allow hiding project source labels on pinned tasks#3268
nothingyuancando wants to merge 3 commits into
makecindy:mainfrom
nothingyuancando:feat/2931-toggle-pinned-source-label

Conversation

@nothingyuancando

@nothingyuancando nothingyuancando commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

为置顶任务增加“显示项目来源”外观设置。用户关闭后,置顶任务继续保留原有标题、状态和操作,但不再显示项目来源标签,从而释放横向空间给任务标题;默认开启,保持现有用户的展示不变。

根据 review 补充“恢复默认”:恢复操作会删除 sidebar.pinnedSourceLabelVisible override,重新跟随当前默认值,并同步同窗口和其他窗口的订阅者。

变更类型

  • feat 新功能
  • fix 缺陷修复
  • refactor / perf 重构或性能优化
  • docs / test / chore 文档、测试或工程维护
  • 其他:

范围

  • 关联 Issue / 需求:Closes 功能建议:置顶对话列表支持隐藏工作区名称,避免挤占对话标题空间 #2931
  • 本 PR 包含:Appearance 设置开关与恢复默认操作、localStorage override 持久化和跨窗口同步、置顶区域的标签渲染门控、五语文案和回归测试。
  • 明确不包含:不修改非置顶任务、聊天引用、模型来源或项目归属;不改变默认展示。
  • 用户可见变化:可在外观设置中关闭置顶任务的项目来源标签,且在修改后可恢复跟随默认值。
  • 是否存在 breaking change:无。

UI 变化

  • 平台:Desktop,Light / Dark。
  • 引用的设计规范:docs/design-rules/DESIGN.md 的 Settings 行密度、语义颜色和双模式交付要求;复用现有 Switch、图标恢复按钮和设置行样式。
  • 未附实机截图:本机 Desktop Electron 运行时未准备完成,未启动应用;以下为改动后界面的 HTML 结构与 token 预览,组件实现位于 AppearanceSection.tsx

改动后界面(HTML)

<section style="width:560px;padding:20px;border:1px solid var(--settings-theme-card-border);border-radius:12px;background:var(--settings-theme-card-bg);color:var(--settings-section-sublabel);font-family:Inter,sans-serif">
  <div style="display:flex;align-items:center;justify-content:space-between;gap:12px">
    <div>
      <p style="margin:0;font-size:13px;font-weight:500">Show project source for pinned tasks</p>
      <p style="margin:4px 0 0;font-size:12px;line-height:1.4;opacity:.7">Turn this off to give task titles more horizontal space.</p>
    </div>
    <div style="display:flex;align-items:center;gap:8px">
      <button aria-label="Reset to default" disabled style="width:32px;height:32px;border:1px solid var(--settings-input-border);border-radius:12px;background:var(--settings-input-bg);color:var(--settings-input-text);opacity:.4"></button>
      <button role="switch" aria-checked="true" aria-label="Toggle project source for pinned tasks" style="width:36px;height:20px;border:0;border-radius:9999px;background:var(--switch-checked-bg)"><span style="display:block;width:16px;height:16px;margin-left:18px;border-radius:50%;background:var(--switch-thumb-bg)"></span></button>
    </div>
  </div>
</section>

恢复默认按钮只在用户已有显式 override 时可用;点击后删除 override 并恢复当前版本的默认显示。所有颜色继续使用既有语义 token,因此同一结构同时适用于 Light / Dark。

怎么验证的

自动验证

pnpm --filter desktop exec vitest run src/renderer/hooks/__tests__/useSidebarCardMode.test.ts src/renderer/components/settings/__tests__/AppearanceSection.accessibility.test.tsx src/renderer/__tests__/pinnedSidebarSection.test.ts
结果:9/9 通过。

pnpm --filter desktop exec eslint <touched files>
结果:通过。

pnpm --filter desktop run typecheck
结果:通过。

pnpm check:i18n && pnpm check:i18n-glossary
结果:通过;仅有既有的非阻断空字符串、未翻译和 4 条 proposed Lead 术语提示。

git diff --check
结果:通过。

pnpm check:dco
结果:通过,2 个 commit 均带 DCO 签名。

pnpm test:unit:related
结果:已完整执行;Desktop 收集阶段因本地 worktree 缺少 Electron 二进制失败(46 个 suite 未收集),已执行的 5,574 个测试通过。本机重新下载 Electron 时用户要求直接推送,因此未重跑。

手工验证

未执行:本轮未启动 Desktop,因此未做 Light/Dark 实机检查。

未执行的验证

Electron 补齐后需重跑完整 related unit gate;需在 Light/Dark 下确认恢复默认、窄侧边栏标题空间和跨窗口同步。

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容
  • 权限 / 安全 / 用户数据
  • 存量插件兼容(批准状态 / 指纹 / manifest 校验 / 安装布局 / 包格式)
  • 原生层 / fingerprint / OTA
  • 跨平台差异
  • 其他:Desktop 外观偏好。

影响与回滚

  • 影响范围:仅 Desktop renderer 的置顶任务来源标签显示。
  • 回滚 / 降级方式:回滚本 PR 即恢复始终显示标签的既有行为;无数据迁移。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(git commit -s,见 DCO
  • UI 改动已在「UI 变化」注明引用的设计规范章节
  • 未提交凭证、令牌或授权文件
  • 已补充必要文档(不需要新增文档)
  • 已确认测试结果或说明未执行原因

Signed-off-by: nothingyuancando <1579035512@qq.com>
@nothingyuancando
nothingyuancando requested a review from a team as a code owner August 23, 2026 01:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6913874638

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/renderer/hooks/useSidebarCardMode.ts Outdated
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Greptile Summary

此 PR 为桌面端置顶任务增加项目来源标签显示偏好,并提供恢复默认、持久化及跨窗口同步能力。

  • 在外观设置中新增显示开关和恢复默认按钮
  • 根据偏好控制置顶卡片及文本行的来源标签
  • 为五种语言补充文案,并增加偏好、渲染门控和可访问性测试

Confidence Score: 5/5

当前没有仍需阻止合并的具体故障,PR 看起来可以安全合并。

当前没有仍然存在的阻断性故障。

Important Files Changed

Filename Overview
apps/desktop/src/renderer/hooks/useSidebarCardMode.ts 新增默认开启、支持显式覆盖及恢复默认的置顶来源标签偏好,并同步同窗口订阅者和其他窗口。
apps/desktop/src/renderer/components/settings/AppearanceSection.tsx 新增置顶任务来源标签开关及带可访问名称的恢复默认控件。
apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx 在卡片和文本两种置顶任务展示路径中按偏好传递项目来源标签。
apps/desktop/src/renderer/hooks/tests/useSidebarCardMode.test.ts 覆盖默认值、显式关闭、持久化、恢复默认和同窗口订阅同步。
apps/desktop/src/renderer/components/settings/tests/AppearanceSection.accessibility.test.tsx 验证恢复默认按钮具有可访问名称并正确表达不可用状态。

Reviews (3): Last reviewed commit: "fix(desktop): clarify pinned source labe..." | Re-trigger Greptile

@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) labels Aug 23, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

这条 PR 需要维护者确认(产品 / UI:固定任务是否显示项目来源标签)。请维护者在本 PR 上 Approve;若要修改请 Request Changes,作者改完后再 Approve。讨论 issue:#3273

@MagicLizi

Copy link
Copy Markdown
Contributor

命中 UI 路径(apps/desktop/src/renderer/components/settings/AppearanceSection.tsx / apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx / apps/desktop/src/renderer/hooks/useSidebarCardMode.ts)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范

@MagicLizi

Copy link
Copy Markdown
Contributor

@nothingyuancando 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/hooks/useSidebarCardMode.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

Signed-off-by: nothingyuancando <1579035512@qq.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34fbf2040c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/settings/AppearanceSection.tsx Outdated
Comment thread apps/desktop/src/renderer/i18n/locales/en/common.json Outdated
Signed-off-by: nothingyuancando <1579035512@qq.com>

@dashhuang dashhuang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前不建议把「项目来源」做成仅针对置顶任务的独立开关。请收敛为统一的侧边栏任务信息设置:在侧边栏显示设置中新增「任务信息」分组,分别控制项目来源、远程连接来源、是否挂载自动任务等信息是否显示,并让同一套规则作用于所有任务,而不是只作用于置顶区。完成统一方案后再复核。

@dashhuang

Copy link
Copy Markdown
Member

补充一下:如果这个统一的「任务信息」设置超出当前 PR 的范围,或者你不打算继续扩展,也可以留给我来做。我会把它作为后续需求记下来并另行处理,不需要为了保留这次提交而勉强扩大范围。

@nothingyuancando

Copy link
Copy Markdown
Contributor Author

感谢补充。这个 PR 会保持当前范围,暂不继续扩展统一的「任务信息」设置;后续如需推进,我会新开 issue 跟踪。

@MagicLizi MagicLizi added status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) and removed awaiting-discussion 等待维护者讨论(review-pr) labels Aug 23, 2026

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查通过:置顶任务隐藏项目来源标签的设置项、默认恢复、跨窗口同步和五语 i18n 与 diff 一致,定向测试/typecheck/DCO 复核通过。无 P0/P1。本轮不合并:仍有其他 reviewer 的 Request Changes。

@nothingyuancando

Copy link
Copy Markdown
Contributor Author

感谢补充。确认本 PR 继续保持当前范围,不扩展统一的「任务信息」设置;现有改动仅覆盖置顶任务的项目来源标签显示。统一任务信息(项目来源、远程来源、自动任务等)后续由你另行处理,我不会为了保留本次提交扩大范围。

@nothingyuancando

Copy link
Copy Markdown
Contributor Author

@dashhuang 根据你补充的说明,本 PR 将保持当前范围,统一「任务信息」设置留作后续需求处理。当前 review 状态仍为 Request changes,导致 PR 无法合并;麻烦 dismiss 此次 review,或提交新的 Approve 以解除合并阻塞。谢谢。

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查通过:没有 P0/P1。

外观开关默认开、关掉只藏置顶来源标签;恢复默认删除 override 而不是写死 true。五语文案与术语表一致。dashhuang 的 CHANGES_REQUESTED 未代 dismiss。

@dashhuang

Copy link
Copy Markdown
Member

这次 Request Changes 仍然有效,不需要 dismiss:产品结论是“不接受只针对置顶任务的独立开关”。如果不在本 PR 扩成统一的任务信息设置,就请保持本 PR 不合入;统一方案可另起需求由维护者后续实现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

功能建议:置顶对话列表支持隐藏工作区名称,避免挤占对话标题空间

3 participants