feat(sidebar): improve thread preview limit and empty project UX#3
Merged
jwangkun merged 1 commit intoJun 9, 2026
Merged
Conversation
- Extract SIDEBAR_THREAD_PREVIEW_LIMIT constant for consistency - Add helpful empty state UI with folder picker button - Add i18n messages for empty state and folder picker - Improve macOS icon generation error handling with fallback Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
aa9030b to
5385b14
Compare
jwangkun
approved these changes
Jun 9, 2026
jwangkun
left a comment
Collaborator
There was a problem hiding this comment.
PR 审查报告
结论:通过 ✅ 可以合并
审查摘要
| 维度 | 结果 | 说明 |
|---|---|---|
| 问题修复 | ✅ | 提取 SIDEBAR_THREAD_PREVIEW_LIMIT 常量,修复旧代码中 THREAD_PREVIEW_LIMIT=5 与 TODO 要求 10 的不一致 |
| 代码规范 | ✅ 通过 | typecheck / lint / fmt 全部通过 |
| 与项目方向对齐 | ✅ | 简化 Sidebar 添加项目流程符合"performance first"和UI简化方向;i18n 支持符合项目多语言需求 |
详细分析
1. Sidebar.logic.ts / Sidebar.tsx — 常量提取 ✅
- 将本地
THREAD_PREVIEW_LIMIT = 5替换为导出的SIDEBAR_THREAD_PREVIEW_LIMIT = 10 - 与 TODO.md "Only show last 10 threads" 保持一致,方向正确
2. Sidebar.tsx — 移除手动输入路径 + 统一使用文件夹选择器 ✅
- 简化了添加项目 UI,统一使用文件夹选择器
- Empty state 增加 "选择项目文件夹" 按钮,提升新用户引导体验
- 注意:非 Electron 环境(dev 模式)失去手动输入路径能力,但项目为 Electron-first,可接受
3. Sidebar.logic.test.ts — 新增测试 ✅
- 验证
SIDEBAR_THREAD_PREVIEW_LIMIT === 10
4. i18n/messages.ts — 国际化 ✅
- 新增 4 个 key,中英文完整覆盖
5. scripts/build-desktop-artifact.ts — macOS 图标容错 ✅
- 使用 Effect.catch 优雅处理 iconset 生成失败场景
改进建议(非阻塞)
- 后续如支持非 Electron 环境,可考虑加回"手动输入路径"作为 fallback
- CONTRIBUTING.md 的表格格式调整建议与主功能拆分为独立 PR,减少审查噪音
按 AGENTS.md 要求,已运行:
bun fmt:check✅bun typecheck✅bun lint✅bun run test✅(ChatMarkdown.test.tsx 的 KaTeX 失败为已有 pre-existing 问题,与 PR 无关)
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.
Summary
改进 Sidebar 的线程预览限制和空项目状态的用户体验。
Changes
SIDEBAR_THREAD_PREVIEW_LIMIT常量以保持一致性Files changed
Sidebar.logic.ts- 导出线程预览限制常量Sidebar.logic.test.ts- 添加相关测试Sidebar.tsx- 空状态 UI 优化,移除手动输入 UImessages.ts- i18n 消息build-desktop-artifact.ts- 图标生成容错🤖 Generated with Claude Code