Skip to content

feat(ui): 优化项目树左侧栏视觉样式#4589

Merged
SivanCola merged 6 commits into
esengine:main-v2from
ttmouse:pr/new-feature
Jun 16, 2026
Merged

feat(ui): 优化项目树左侧栏视觉样式#4589
SivanCola merged 6 commits into
esengine:main-v2from
ttmouse:pr/new-feature

Conversation

@ttmouse

@ttmouse ttmouse commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

改动内容

优化了左侧项目树导航栏的视觉样式

功能变更

  • 图标栈:折叠箭头与文件夹图标在同一位置互斥切换(默认显示文件夹,hover 显示箭头)
  • 文件夹图标:展开时显示 FolderOpen,折叠时显示 Folder
  • 无子节点项目也支持展开/折叠操作
  • 新建会话图标从 SquarePen 改为 + 号
  • 一级菜单右侧操作图标默认隐藏,悬停时显示

视觉调整

  • 项目名称分层弱化:有子节点使用 fg-dim/fg-faint 混合,空项目使用 fg-faint
  • 二级菜单整行宽展示,选中前后文字样式不变
  • 右侧时间展示字号缩小,颜色更淡
  • 展开的项目与下一项目之间增加 6px 间距(仅限有子节点时)
  • 一级菜单 hover 加 60% 弱背景,二级菜单保持 100% 背景
  • 置顶/归档图标按钮去除背景和边框
  • 移除右侧位移动画

问题修复

  • 二级菜单高度固定,有无时间信息保持一致
  • 移除了 children grid-template-rows 过渡动画,避免展开时后续项目抖动
  • aria-expanded 改为跟随 isExpanded,空项目也能正确展示状态
  • 时间筛选器和搜索栏固定在顶部,不随列表滚动

文件变更

  • desktop/frontend/src/components/ProjectTree.tsx — 结构优化,header 移出列表
  • desktop/frontend/src/styles.css — 新增 200+ 行视觉样式规则

ttmouse added 2 commits June 16, 2026 15:48
- 图标栈:折叠箭头与文件夹图标同一位置互斥切换(hover 显示箭头)
- 文件夹图标:展开时用 FolderOpen,折叠时用 Folder
- 项目名称:有/无子节点分层次弱化(fg-dim 混合 / fg-faint)
- 二级菜单:整行宽、无选中文字变化、时间展示缩小
- 间距:展开的项目与下一项之间增加 6px 间距
- 悬停:一级菜单弱背景 60%,二级菜单正常强度
- 动画:移除了 children grid-template-rows 过渡避免抖动
- 操作图标:置顶/归档按钮无背景无边框
- 右侧位移动画移除
- 菜单右侧操作图标默认隐藏,悬停显示
- 新建会话图标改为 + 号
- 二级菜单固定高度,有无时间信息一致
- 时间筛选器和搜索栏固定不滚动
- 展开间距精确匹配有子节点的项目
@github-actions github-actions Bot added desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 16, 2026
@ttmouse

ttmouse commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author
image image

@ttmouse

ttmouse commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author
2026-06-16.16.15.00.mov

@dovewi

dovewi commented Jun 16, 2026

Copy link
Copy Markdown

可以可以,这个简洁清晰

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this is directionally right and the visual cleanup is nicely scoped. Before merging, please address:

  • desktop/frontend/src/styles.css: .project-tree__folder-action-slot is hidden with opacity: 0 and pointer-events: none, but it only becomes visible on .project-tree__folder:hover. The menu/create buttons remain tabbable, so keyboard users can focus invisible controls. Please also reveal the slot on :focus-within or while the menu/create action is active/open.
  • desktop/frontend/src/styles.css: the expanded-project spacing adds both margin-bottom: 6px on the expanded wrapper and margin-top: 6px on the following wrapper. Since these wrappers are flex items, the margins do not collapse, so the intended 6px gap becomes 12px. Please keep the spacing on only one side.

I checked the PR against the current main-v2 head. The diff is UI-only, with no cache/provider-prefix risk and no security-sensitive surface. git diff --check passed, pnpm --dir desktop/frontend check:css passed, and GitHub CI is green.

Once these are addressed and CI stays green, I will consider merging it into main-v2.

- 添加 :focus-within 状态显示文件夹操作图标,键盘用户可访问
- 移除 margin-top 重复规则,间距统一由 margin-bottom 控制

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the follow-up. The two earlier review items are addressed now:

  • .project-tree__folder-action-slot is revealed on :focus-within, so keyboard focus no longer lands on invisible folder action buttons.
  • The expanded-project spacing is now one-sided (margin-bottom: 6px only), so the 6px gap no longer doubles.

One regression still needs fixing before merge:

  • desktop/frontend/src/components/ProjectTree.tsx: the folder button now calls toggleExpand(key) unconditionally and sets aria-expanded from isExpanded alone. For a project with no children, clicking the row can put a non-collapsible item into an expanded state, switch the icon to FolderOpen, and expose aria-expanded="true" even though no child list is rendered. Please keep the new icon stack, but gate the expand toggle, aria-expanded, and open-folder state on hasChildren so empty projects remain non-expandable.

I also checked the broader risk surface: this PR is UI-only, with no cache/provider-prefix risk and no security-sensitive behavior. #4567 is related UI work and may need merge-order attention, but it does not change this ProjectTree.tsx expand logic.

Verified:

  • git diff --check origin/main-v2...HEAD passed
  • pnpm --dir desktop/frontend check:css passed
  • wails generate module followed by pnpm --dir desktop/frontend build passed
  • GitHub CI is green on the latest head

Once the empty-project expand behavior is fixed and CI stays green, I will consider merging it into main-v2.

Keep folder disclosure semantics gated on child presence so empty projects do not toggle expansion, expose aria-expanded, or show an open-folder state.

Add focused runtime coverage for expandable and non-expandable project folder states.

Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved. I pushed 85fcffd to this PR branch to address the remaining empty-project disclosure regression.

What changed:

  • Kept the new project-tree icon stack, but now gates the expand toggle, aria-expanded, and open-folder state on hasChildren.
  • Scoped the hover chevron CSS to expandable icon stacks so empty projects keep their folder icon on hover instead of looking like disclosure rows.
  • Added focused runtime coverage for expandable and non-expandable project folder states.

Authorship note: @ttmouse remains the primary author of this PR. @SivanCola contributed as a collaborator by fixing the follow-up issue found during review and verifying the final state.

Verified:

  • pnpm --dir desktop/frontend exec tsx src/__tests__/project-tree-runtime.test.ts passed
  • pnpm --dir desktop/frontend check:css passed
  • git diff --check origin/main-v2...HEAD passed
  • wails generate module followed by pnpm --dir desktop/frontend build passed
  • GitHub CI passed on 85fcffd

Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
@SivanCola

Copy link
Copy Markdown
Collaborator

@codex review

@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: 323715a133

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/frontend/src/components/ContextPanel.tsx
@SivanCola SivanCola merged commit 8f3ae36 into esengine:main-v2 Jun 16, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants