Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(sidebar): 统一导航箭头、层级缩进与分组间距

Dash443caec2a342
diff --git a/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx b/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx
index b1bc82a054..70924e35db 100644
--- a/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx
+++ b/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx
@@ -483,7 +483,7 @@ export function TeammatesSection() {
type="button"
onClick={toggleCollapsed}
aria-expanded={!collapsed}
- className="text-sm font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]"
+ className="text-sm leading-5 font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]"
>
{t('bots.title')}
</button>
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
index 1559ec98e0..77fba8f276 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
@@ -86,7 +86,7 @@ import { MENU_ITEM_CLASS, MENU_ROW_CLASS } from './menuStyles';
/** 段头标题共用样式:与原「全部任务」标题一致(淡灰、hover 加深)。 */
const SCOPE_TITLE_CLASS =
- 'text-sm font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]';
+ 'text-sm leading-5 font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]';
export function MachineSwitcherMenu({
onOpenDisplaySettings,
@@ -200,7 +200,7 @@ export function MachineSwitcherMenu({
'data-[state=open]:text-[var(--sidebar-nav-text)]',
)}
>
- <span className="truncate leading-none">{triggerText}</span>
+ <span className="truncate">{triggerText}</span>
<ChevronDown size={13} strokeWidth={2} className="shrink-0" />
{remoteSessionBootstrapLoading && (
<span
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
index ee5cbd6fe6..a45155f324 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
@@ -24,8 +24,7 @@ import { Button } from '@/components/ui/button';
* - 选中态 bg-sidebar-item-active + font-semibold
*
* 关于 indented prop(缩进控制):
- * - indented=true(ProjectNode 内子 session):`pl-[22px]`(2026-07 用户定稿,
- * tech_spec ADR 原 18px 基础上 +4px 加深层级)。
+ * - indented=true(分组内子 session):`pl-5`,在普通行 12px 内边距上增加 8px 层级缩进。
* - indented=false(Pinned / Unclassified / Dialogue 顶层 session):`pl-3`。
* 2026-07 用户定稿的文字列对齐:状态图标包在 15px 定宽槽内;普通会话行使用
* gap-2.5(10px),与顶部导航行 / 项目行同构。自动任务行因中间还有 Timer,
@@ -969,11 +968,10 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
!isEditing && hasAutomationMeta ? 'gap-1.5' : 'gap-2.5',
'select-none',
// 缩进 + padding(见文件头注释的文字列对齐口径):
- // indented=true → 左 22px(Project Sessions 缩进,比顶层深一档;
- // 2026-07 用户定稿在 18px 基础上再 +4px 加深层级)
+ // indented=true → 左 20px(普通行 12px + 子层级缩进 8px)
// indented=false → 左 12px(Pinned / Unclassified / Dialogue 段)
// 右侧信息槽按内容收缩;hover 时 archive 快捷按钮覆盖同一槽位。
- indented ? 'pl-[22px] pr-2' : 'pl-3 pr-2',
+ indented ? 'pl-5 pr-2' : 'pl-3 pr-2',
// 注意:不加 transition-colors —— 行 bg 的 hover/active 变化要瞬时,
// 否则归档/取消归档后 DOM 列表重排,原 hover bg 在前一个屏幕位置上要
// 跑完 150ms 渐变才褪掉,视觉上像是"旧行仍然选中,延迟才切到新行"。
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx
index d71d8c5871..f9e5c0cf06 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx
@@ -189,8 +189,6 @@ export function PinnedSection({
const { mode, setMode } = useSidebarCardMode();
// 段头 trigger 的图标 = 当前选中的显示模式(用户一眼看出现在是哪种)。
const ViewStyleTriggerIcon = viewStyleIcon(mode);
- // 卡片视觉(card 瀑布流 / list 单列满宽)统称"卡片态";text 为紧凑行。
- const isCardLike = mode !== 'text';
const [collapsed, setCollapsed] = useState(false);
const visibleEntries = entries;
@@ -298,7 +296,7 @@ export function PinnedSection({
if (visibleEntries.length === 0) return null;
return (
- <div className="flex flex-col gap-0.5 w-full">
+ <div className="flex flex-col w-full">
{/* Section Title — height 24, padding [0,12,0,24]
颜色规格(2026-04-20 二次确认对标设计稿 ZVIpx/WazkW):
Light #262626 / Dark #f5f0e8(深色文本,非 Stone 灰)
@@ -315,7 +313,7 @@ export function PinnedSection({
type="button"
onClick={() => setCollapsed((value) => !value)}
aria-expanded={!collapsed}
- className="text-sm font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]"
+ className="text-sm leading-5 font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]"
>
{t('ccAgent.sidebar.pinned')}
</button>
@@ -366,7 +364,13 @@ export function PinnedSection({
导致右留白(~23px)明显宽于左(11px)——改为 pr-0 后两侧都≈12px 且更窄。 */}
{/* 段级收起走 SectionCollapse 高度动画,播完卸载子树。 */}
<SectionCollapse collapsed={collapsed}>
- <div className={cn('flex flex-col gap-0.5', isCardLike ? 'pr-0 pl-3' : 'pt-1 pr-0 pl-3')}>
+ {/* 留白放进折叠内容,收起后不残留;列表和卡片按自身内边距补偿。 */}
+ <div
+ className={cn(
+ 'flex flex-col gap-0.5 pr-0 pl-3',
+ mode === 'text' ? 'pt-1.5' : mode === 'list' ? 'pt-1' : 'pt-0.5',
+ )}
+ >
{/* 三种显示模式:
- card:CardMasonry 响应式分栏(侧栏 ~258px 起 2 列、~424px 起 3 列,错落瀑布);
- list:卡片视觉但**单列满宽**(不分栏、铺满左侧,类灵动岛),走单列 SortableList;
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx
index 2bd3c1ae8b..4942a44a6a 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx
@@ -8,7 +8,7 @@ import { MountedMenuContent } from '../MountedMenuContent';
* · displayName Inter 14 / 500 #262626 (Light) / #f5f5f5 (Dark)
* · 整行 hover 高亮 sidebar-item-hover
* - Project Sessions:padding [2, 0, 0, 0] / gap 2 vertical
- * 缩进 18px 由 SessionItem 自身(indented=true → pl-[18px])承担,本容器不重复加 pl
+ * 子层级缩进 8px:文字行由 SessionItem 的 indented padding 承担,卡片由本容器承担。
* 折叠时不渲染该容器
*
* 交互:
@@ -207,12 +207,11 @@ export const ProjectNode = memo(function ProjectNode({
被父层 ProjectsSection SortableList 当成"拖动整个 ProjectNode"的起点。
SessionItem 的 root 是 role="button" 而非 <button> 标签,默认 filter 拦不下来。 */}
<SectionCollapse collapsed={isCollapsed} data-no-drag>
- {/* pb-1.5:展开块与下一个项目标题之间的间距(4px 树 gap + 6px = 10px),
- 大于会话行间距(gap-0.5),让项目块之间有分组呼吸(参考 Codex,2026-07 定稿)。 */}
+ {/* 组间留白由外层树的 4px gap 承担,组内任务保持 2px 间隔。 */}
<div
className={cn(
- 'flex flex-col gap-0.5 pt-0.5 pb-1.5 pr-0',
- sessionVariant === 'list' ? 'pl-3' : 'pl-0',
+ 'flex flex-col gap-0.5 pt-0.5 pr-0',
+ sessionVariant === 'list' ? 'pl-2' : 'pl-0',
)}
>
<SessionEntryList
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
index 8791df5370..b52e69d702 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
@@ -1160,7 +1160,7 @@ export function ProjectsSection({
// 仅收起时显示运行态与未读点,展开后由下层内容提示。
const sectionLamp = lampAgg(section.entries.flatMap(entrySessions));
return (
- <div key={key} className="flex flex-col gap-1">
+ <div key={key} className="flex flex-col">
{/* 设备分组头:可折叠。在线设备不画状态点;离线设备保留灰点与文字提示。 */}
<DeviceSectionHeader deviceId={section.deviceId} name={name}>
<button
@@ -1173,15 +1173,10 @@ export function ProjectsSection({
: t('ccAgent.sidebar.deviceGroup.collapse')
}
className={cn(
- 'flex h-6 min-w-0 flex-1 items-center gap-1.5 rounded-full px-1.5',
+ 'flex h-6 min-w-0 flex-1 items-center gap-1.5 rounded-full px-2',
'text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]',
)}
>
- {sectionCollapsed ? (
- <ChevronRight size={12} strokeWidth={2} className="shrink-0" />
- ) : (
- <ChevronDown size={12} strokeWidth={2} className="shrink-0" />
- )}
{/* 设备段收起时才用图标呼吸提示内部运行态,展开后由下层内容提示。 */}
<span
className={cn(
@@ -1194,6 +1189,16 @@ export function ProjectsSection({
<MonitorSmartphone size={13} strokeWidth={2} aria-hidden />
</span>
<span className="min-w-0 truncate text-xs font-medium">{name}</span>
+ {sectionCollapsed ? (
+ <ChevronRight
+ size={12}
+ strokeWidth={2}
+ className="shrink-0"
+ aria-hidden
+ />
+ ) : (
+ <ChevronDown size={12} strokeWidth={2} className="shrink-0" aria-hidden />
+ )}
{!online && (
<span
aria-hidden
@@ -1217,7 +1222,12 @@ export function ProjectsSection({
</button>
</DeviceSectionHeader>
<SectionCollapse collapsed={sectionCollapsed}>
- <div className="flex flex-col gap-1 pl-2">
+ <div
+ className={cn(
+ 'flex flex-col gap-1 pl-2',
+ section.entries.length > 0 && 'pt-1',
+ )}
+ >
{/* 折叠上限每段独立应用(切段在前,见 deviceSections 注释);
「显示全部」的作用域同样是段内(expandedDeviceSections)。 */}
{(() => {
@@ -1494,13 +1504,13 @@ export function SessionGroupNode({
</div>
)}
</div>
- {/* 组内会话:与 ProjectNode 的会话区同款容器(gap / pt / pb 呼吸、list 缩进)
+ {/* 组内会话:与 ProjectNode 的会话区同款容器(gap / pt、list 缩进)
与同一份折叠上限(getProjectSessionCollapseLimit)。 */}
<SectionCollapse collapsed={collapsed} data-no-drag>
<div
className={cn(
- 'flex flex-col gap-0.5 pt-0.5 pb-1.5 pr-0',
- sessionVariant === 'list' ? 'pl-3' : 'pl-0',
+ 'flex flex-col gap-0.5 pt-0.5 pr-0',
+ sessionVariant === 'list' ? 'pl-2' : 'pl-0',
)}
>
<SessionEntryList