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(mobile): compact title-only session rows (#571)

Kmny46eec85492c0
diff --git a/apps/mobile/app/devices/index.tsx b/apps/mobile/app/devices/index.tsx
index 85ec3d797e..50d68f2390 100644
--- a/apps/mobile/app/devices/index.tsx
+++ b/apps/mobile/app/devices/index.tsx
@@ -145,6 +145,7 @@ const DEVICE_LIST_TIMEOUT_MS = 12_000;
// 项目组与自动化组展开后的子列表共用同一个预览限量(设备详情页也 import 复用,避免两处漂移)。
export const PROJECT_PREVIEW_LIMIT = 5;
const HOME_SESSION_ROW_HEIGHT = 78;
+const HOME_SESSION_SINGLE_LINE_ROW_HEIGHT = 60;
const CINDY_LIST_GUTTER = 20;
const CINDY_LIST_ROW_HEIGHT = 60;
const CINDY_LIST_ROW_GAP = 10;
@@ -2192,6 +2193,9 @@ function HomeSessionRowInner({
const preview = group
? automationGroupPreview(item, group.sessionCount, t)
: buildRemoteSessionCardPreview(item, { running });
+ // 零消息会话没有摘要。此时不要保留双行列表的空白第二行;但定时任务与置顶
+ // 标记仍占用右下状态槽,因此继续使用双行布局。
+ const showPreviewLine = !!preview?.trim() || showSchedule || showPinned;
// 组行点击语义对齐桌面版侧边栏:收起且有需关注内容(未读运行 / 待处理)时,点行直接打开
// 该看的那条会话(共享层 primary:运行中 > 有未读 > 最新);想展开点行首箭头(独立热区)。
// 无需关注内容或已展开时,点行仍是展开 / 收起。
@@ -2224,6 +2228,7 @@ function HomeSessionRowInner({
style={({ pressed }) => [
styles.sessionListRow,
cindyList && styles.sessionListRowCindy,
+ !showPreviewLine && styles.sessionListRowSingleLine,
cindyList && inOutlinedGroup && styles.sessionListRowOutlinedGroup,
cindyList && inOutlinedGroup && groupEnd && styles.sessionListRowOutlinedGroupEnd,
standaloneCindyCard && styles.sessionListRowCindyCard,
@@ -2258,7 +2263,11 @@ function HomeSessionRowInner({
)}
</Pressable>
) : null}
- <View style={[styles.sessionIconCell, cindyList && styles.sessionIconCellCindy]}>
+ <View style={[
+ styles.sessionIconCell,
+ cindyList && styles.sessionIconCellCindy,
+ !showPreviewLine && styles.sessionIconCellSingleLine,
+ ]}>
<SessionStatusMark
active={running || attention}
item={item}
@@ -2310,30 +2319,32 @@ function HomeSessionRowInner({
</View>
)}
</View>
- <View style={[styles.sessionPreviewRow, cindyList && styles.sessionPreviewRowCindy]}>
- <Text
- ellipsizeMode="tail"
- numberOfLines={1}
- style={[styles.sessionPreview, cindyList && styles.sessionPreviewCindy]}
- testID={`home.sessionRowPreview.${item.session.id}`}
- >
- {preview}
- </Text>
- {showSchedule || showPinned ? (
- // 组行与单次自动化会话行同款标记:Timer 放右下(时间下方的尾部图标位),
- // 行首保留正常的会话状态图标(primary 运行的 vendor / 运行态)。
- <View style={[styles.sessionTrailingIcons, cindyList && styles.sessionTrailingIconsCindy]}>
- {showSchedule ? (
- <AutomationTimerIcon
- paused={scheduleStopped}
- size={cindyList ? iconSize.xs : iconSize.lg}
- testID={`home.sessionAutomationTimer.${item.session.id}`}
- />
- ) : null}
- {showPinned ? <Pin color={colors.textTertiary} size={cindyList ? iconSize.xs : iconSize.lg} strokeWidth={iconStroke.thin} /> : null}
- </View>
- ) : null}
- </View>
+ {showPreviewLine ? (
+ <View style={[styles.sessionPreviewRow, cindyList && styles.sessionPreviewRowCindy]}>
+ <Text
+ ellipsizeMode="tail"
+ numberOfLines={1}
+ style={[styles.sessionPreview, cindyList && styles.sessionPreviewCindy]}
+ testID={`home.sessionRowPreview.${item.session.id}`}
+ >
+ {preview}
+ </Text>
+ {showSchedule || showPinned ? (
+ // 组行与单次自动化会话行同款标记:Timer 放右下(时间下方的尾部图标位),
+ // 行首保留正常的会话状态图标(primary 运行的 vendor / 运行态)。
+ <View style={[styles.sessionTrailingIcons, cindyList && styles.sessionTrailingIconsCindy]}>
+ {showSchedule ? (
+ <AutomationTimerIcon
+ paused={scheduleStopped}
+ size={cindyList ? iconSize.xs : iconSize.lg}
+ testID={`home.sessionAutomationTimer.${item.session.id}`}
+ />
+ ) : null}
+ {showPinned ? <Pin color={colors.textTertiary} size={cindyList ? iconSize.xs : iconSize.lg} strokeWidth={iconStroke.thin} /> : null}
+ </View>
+ ) : null}
+ </View>
+ ) : null}
</View>
</Pressable>
{group && groupExpanded ? (
@@ -3023,6 +3034,9 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
height: CINDY_LIST_ROW_HEIGHT,
paddingLeft: 18,
},
+ sessionListRowSingleLine: {
+ height: HOME_SESSION_SINGLE_LINE_ROW_HEIGHT,
+ },
sessionListRowCindyCard: {
borderColor: colors.border,
borderRadius: radius.container,
@@ -3123,6 +3137,10 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
paddingTop: 14,
width: iconSize.md,
},
+ sessionIconCellSingleLine: {
+ justifyContent: 'center',
+ paddingTop: 0,
+ },
sessionGroupChevronCell: {
// 自动化组行行首的展开箭头列:与项目组行首 chevron 对齐(尺寸 22、次级色),
// 垂直对齐标题行(与 sessionIconCell 同一基线)。
diff --git a/apps/mobile/src/__tests__/homeDesktopFirst.test.ts b/apps/mobile/src/__tests__/homeDesktopFirst.test.ts
index b976607f01..c7911f3b6f 100644
--- a/apps/mobile/src/__tests__/homeDesktopFirst.test.ts
+++ b/apps/mobile/src/__tests__/homeDesktopFirst.test.ts
@@ -284,6 +284,10 @@ describe('mobile home desktop-first surface', () => {
expect(sessionRowSource).toContain('numberOfLines={1}');
expect(sessionRowSource).toContain('buildRemoteSessionCardPreview(item, { running })');
expect(sessionRowSource).toContain('testID={`home.sessionRowPreview.${item.session.id}`}');
+ expect(sessionRowSource).toContain('const showPreviewLine = !!preview?.trim() || showSchedule || showPinned;');
+ expect(sessionRowSource).toContain('!showPreviewLine && styles.sessionListRowSingleLine');
+ expect(sessionRowSource).toContain('!showPreviewLine && styles.sessionIconCellSingleLine');
+ expect(sessionRowSource).toContain('{showPreviewLine ? (');
expect(sessionRowSource).not.toContain('numberOfLines={2}');
// 相对时间下沉到独家订阅分钟心跳的叶子组件(行主体 memo 化后由它单独保鲜,风暴修复)
expect(sessionRowSource).toContain('<SessionRelativeTime lastActivityAt={item.lastActivityAt}');
@@ -305,12 +309,14 @@ describe('mobile home desktop-first surface', () => {
expect(automationTimerSource).toContain('borderColor: colors.border');
expect(sessionRowSource).not.toContain('SessionBadge');
expect(source).toContain('const HOME_SESSION_ROW_HEIGHT = 78;');
+ expect(source).toContain('const HOME_SESSION_SINGLE_LINE_ROW_HEIGHT = 60;');
expect(source).toContain('const CINDY_LIST_ROW_HEIGHT = 60;');
// 用户改稿 2026-07-21:列表首页回退 XD-MAKER 通栏样式(legacy 变体),色彩体系沿用 07-20 定稿。
expect(source).toContain('variant="legacy"');
expect(source).not.toContain('variant="cindyList"');
expect(source).toContain("type HomeSessionRowVariant = 'legacy' | 'cindyList';");
expect(stylesSource).toContain('height: HOME_SESSION_ROW_HEIGHT');
+ expect(stylesSource).toContain('height: HOME_SESSION_SINGLE_LINE_ROW_HEIGHT');
expect(stylesSource).toContain('height: CINDY_LIST_ROW_HEIGHT');
expect(stylesSource).toContain('height: lineHeight.micro');
// 通栏回退:项目子行回 surface 全宽底(用户改稿 2026-07-21)。