From c0106bfed0d8dffd1851b56fd3a8f031551f132a Mon Sep 17 00:00:00 2001 From: DoodleBear Date: Fri, 23 Oct 2026 09:54:33 +0900 Subject: [PATCH] fix(mobile): show pinned chats as full conversation rows Issue: #2571 Agent-Task: codex/local/01a16587-3995-7b22-8c81-7c19caccddef --- .../verify-deepseekbot/features/README.md | 2 +- ...ne-pinned-grid.md => phone-pinned-list.md} | 16 +-- apps/mobile/DESIGN.md | 10 +- apps/mobile/app/(tabs)/(home)/index.tsx | 60 ++------ .../src/ui/chat/pinned-conversation-card.tsx | 132 ------------------ apps/mobile/src/ui/chat/pinned-grid.ts | 40 ------ apps/mobile/src/ui/design/tokens.ts | 7 - apps/mobile/test/home-search.test.tsx | 53 +++---- ...inned-grid.test.ts => pinned-list.test.ts} | 23 +-- changes/2571-phone-pinned-grid.md | 11 -- changes/2571-phone-pinned-list.md | 11 ++ docs/architecture/botharness-architecture.md | 4 +- scripts/verification-inventory.json | 8 +- 13 files changed, 69 insertions(+), 308 deletions(-) rename .agents/skills/verify-deepseekbot/features/{phone-pinned-grid.md => phone-pinned-list.md} (66%) delete mode 100644 apps/mobile/src/ui/chat/pinned-conversation-card.tsx delete mode 100644 apps/mobile/src/ui/chat/pinned-grid.ts rename apps/mobile/test/{pinned-grid.test.ts => pinned-list.test.ts} (51%) delete mode 100644 changes/2571-phone-pinned-grid.md create mode 100644 changes/2571-phone-pinned-list.md diff --git a/.agents/skills/verify-deepseekbot/features/README.md b/.agents/skills/verify-deepseekbot/features/README.md index e16fe962e9..81caa22c82 100644 --- a/.agents/skills/verify-deepseekbot/features/README.md +++ b/.agents/skills/verify-deepseekbot/features/README.md @@ -32,7 +32,7 @@ One file per user-facing feature. Each file has four sections: `Sub-features`, ` | Phone pairing, QR images, app variants and LAN/Tailscale guidance | no | `scripts/e2e-mobile-pairing-web.mjs`, `scripts/e2e-device-pairing.mjs`, `scripts/e2e-mobile-sim.mjs`, `scripts/e2e-mobile-pair-android.mjs` | [phone-pairing.md](phone-pairing.md) | | Phone Chats drawer views and Android Host accent | no | none (shared-device native path) | [phone-drawer-views.md](phone-drawer-views.md) | | Phone Chats swipe actions and Remote Host section creation | no | none (shared-device native path) | [phone-chat-row-actions.md](phone-chat-row-actions.md) | -| Phone Remote Host sections and responsive Pinned grid | no | shared-device queue; `scripts/e2e-mobile-sim.mjs` | [phone-pinned-grid.md](phone-pinned-grid.md) | +| Phone Remote Host sections and Pinned list | no | shared-device queue; `scripts/e2e-mobile-sim.mjs` | [phone-pinned-list.md](phone-pinned-list.md) | | Native mobile message composer | no (except Bot reply) | none (shared-device native path) | [phone-composer.md](phone-composer.md) | | Native mobile chat backgrounds | no (except live-reply regression) | none (shared-device native path) | [phone-chat-backgrounds.md](phone-chat-backgrounds.md) | | Android launch, sheets, shell and chat presentation | no | Launch: queued native check; interactions: `scripts/e2e-mobile-android-interactions.mjs` | [phone-android-interactions.md](phone-android-interactions.md) | diff --git a/.agents/skills/verify-deepseekbot/features/phone-pinned-grid.md b/.agents/skills/verify-deepseekbot/features/phone-pinned-list.md similarity index 66% rename from .agents/skills/verify-deepseekbot/features/phone-pinned-grid.md rename to .agents/skills/verify-deepseekbot/features/phone-pinned-list.md index 753bb575b6..eab1d5bb11 100644 --- a/.agents/skills/verify-deepseekbot/features/phone-pinned-grid.md +++ b/.agents/skills/verify-deepseekbot/features/phone-pinned-list.md @@ -1,11 +1,11 @@ -# Phone Remote Host sections and Pinned grid +# Phone Remote Host sections and Pinned list ## Sub-features - `organization`: selected Remote Host sections, pins, membership and order come from `rosterGet`; global/per-scope sorting comes from the same Host's native `settings/describe` namespace used by Web. A refresh reads both; there is no device-local arrangement. -- `pinned-grid`: non-sticky Pinned header and virtualized card bands precede ordinary rows. Cards show avatar/name/status/unread, without preview or time. Empty Pinned is hidden; empty custom sections remain visible. Column policy follows measured container width and system text scale. +- `pinned-list`: non-sticky Pinned header and individually virtualized conversation rows precede ordinary sections. Pinned uses the same avatar/name, preview, time, status and unread presentation as other rows. Empty Pinned is hidden; empty custom sections remain visible. - `collapse-search`: collapse is device-local per Host. Search presents full rows even for collapsed/pinned matches, title prefix before pins; clearing restores the Host arrangement without writes. All presents the current Host organization and separate Cloud rows. -- `operations`: ordinary rows retain swipe and iOS peek. Cards retain opening/peek and named native action menus/accessibility actions. Unpin only unpins and returns to retained membership. The inherited Add to section/create flow remains pin-preserving in this slice. +- `operations`: all rows, including Pinned, retain swipe, iOS peek and named native action menus/accessibility actions. Unpin only unpins and returns to retained membership. The inherited Add to section/create flow remains pin-preserving in this slice. ## How to get to it (user POV) @@ -15,17 +15,17 @@ Pair a Remote Host, open Chats and choose that Host in the drawer. Pin a convers Submit this journey to the centralized test center through [shared device QA](../../../../docs/agents/device-qa.md); the designated runner owns `scripts/e2e-mobile-sim.mjs`, Metro, builds and QA Hosts. No model is required. Do not reuse or mutate a frozen acceptance candidate. Record exact base/head, binary identity, OS, viewport, locale, system text size and appearance. -1. Seed one disposable Host with a DM and group, pins but no custom sections; compare base flat rows with candidate Pinned grid. Verify avatar/name, working and unread state, absent preview/time, no duplicate ordinary row, and the final row in a long list. Scroll: Pinned must leave the viewport normally. +1. Seed one disposable Host with a DM and group, pins but no custom sections; compare the base Pinned grid with the candidate Pinned list. Verify avatar/name, working and unread state, visible preview/time, no duplicate ordinary row, and the final row in a long list. Scroll: Pinned must leave the viewport normally. 2. Create Work and Empty through the existing mobile section sheet; assign ordinary chats and pin one Work chat. Read `deepseekbot roster` on the same Host. The pin must retain Work membership, be absent from Work display, and return there on Unpin. An empty custom section remains reachable; an empty Pinned header disappears. 3. Use Web or the existing CLI `settings botharness-client` / reviewed settings writes plus roster ordering commands to set global manual/updated and scope manual/updated/inherit. Place loose rows between section blocks. Refresh mobile and compare canonical order to Web, including a chat without messages (`updatedAt` fallback). New messages must not reorder a manual scope. A failed settings refresh must retain the last confirmed roster and sorting; recover by retrying the refresh. Settings-only Web changes currently require refresh/reconnect on mobile. 4. Collapse Pinned and Work. Search for pinned and sectioned names: full rows with previews appear, ordered by title match then pin. Clear search and recover collapse/order. Switch to a second disposable Host with matching section IDs; its collapse state must be independent. Switch back and confirm the original preference. Collapse/search must not write arrangement. -5. Choose All: current Host groups/grid remain; Cloud rows retain their own labels/routes and cannot become Host pin/section targets. Choose a Cloud workspace: no Host section header or grid remains. No claim of multi-Host aggregation is made. -6. On ordinary rows repeat [phone-chat-row-actions](phone-chat-row-actions.md), including edge swipe, menu, mark-read and section creation. On cards open the chat/commit iOS preview once, Unpin, Mute, Mark as read and Add to section through native menus and VoiceOver/TalkBack actions. Preserve the owning Host route. Add to section remains pin-preserving; move-as-unpin-and-assign is not delivered here. -7. Capture matched native before/after on iOS and Android at default/intermediate/maximum system text × light/dark. Use long English/CJK names, rotation and live default→maximum→default resizing. Check grid column changes, full name wrapping, all targets, status/unread legibility, native focus and search with the actual soft keyboard. Pure width/font-scale projection tests do not prove glyph geometry or native accessibility. +5. Choose All: current Host grouped lists remain; Cloud rows retain their own labels/routes and cannot become Host pin/section targets. Choose a Cloud workspace: no Host section header or pinned row remains. No claim of multi-Host aggregation is made. +6. On ordinary and pinned rows repeat [phone-chat-row-actions](phone-chat-row-actions.md), including edge swipe, menu, mark-read and section creation. On pinned rows open the chat/commit iOS preview once, Unpin, Mute, Mark as read and Add to section through native menus and VoiceOver/TalkBack actions. Preserve the owning Host route. Add to section remains pin-preserving; move-as-unpin-and-assign is not delivered here. +7. Capture matched native before/after on iOS and Android at default/intermediate/maximum system text × light/dark. Use long English/CJK names, rotation and live default→maximum→default resizing. Check row reflow, readable long names, all targets, status/unread legibility, native focus and search with the actual soft keyboard. Source/DOM tests do not prove glyph geometry or native accessibility. 8. Restore device settings; remove only task-owned fixtures. Keep sanitized screenshots, accessibility snapshots, console output and canonical reads with the test-center batch report. ## Gotchas - Native screenshots, keyboard, screen-reader interaction and Human visual acceptance remain unrun until the designated runner records them. Source/DOM fixtures isolate native boundaries and are not native geometry evidence. - No Organize/drag mode, local pin/order store, section rename/delete, or cross-Host aggregation in this slice. Obtain Human visual feedback before implementing the next slice. -- #2554 row layout and fixture follow-up are independently owned. Requalify the combined candidate when integrated; do not treat its frozen acceptance as evidence for this grid. +- #2554 row layout and fixture follow-up are independently owned. Requalify the combined candidate when integrated; do not treat its frozen acceptance as evidence for this list. diff --git a/apps/mobile/DESIGN.md b/apps/mobile/DESIGN.md index 89e6ccba61..4918725d9f 100644 --- a/apps/mobile/DESIGN.md +++ b/apps/mobile/DESIGN.md @@ -103,10 +103,10 @@ The shell is set by [ADR-0211](../../docs/adr/0211-the-mobile-app-has-two-tabs-w - Creation binds the chosen Host ID or cloud account scope plus Organization ID. Cloud rechecks current identity and ownership before opening/submitting; stale scope refuses. Computer creation is unavailable on the phone after full WebView removal; CloudClient idempotent mutations remain the cloud business owner. Dismissal never starts a background operation. - **Chats** shows the current Host: - - **Mobile organization target (Human-confirmed, 2026-10-22):** all choices below are accepted. Delivery is staged: #2571 implements Host section presentation and the Pinned grid first; Organize/drag and move-as-unpin-and-assign follow Human visual feedback. Native acceptance is a separate gate. These decisions supersede the older desktop-only organization restriction below. - - Only the built-in Pinned section uses a responsive avatar/name grid, with unread and working-state indicators and no message preview or timestamp. Columns adapt to available width and system text size. Ordinary Channel sections retain conversation rows with message previews. + - **Mobile organization target (Human-confirmed, 2026-10-22; presentation revised 2026-10-23):** all choices below are accepted. Delivery is staged: #2571 implements Host section presentation and the Pinned list first; Organize/drag and move-as-unpin-and-assign follow Human visual feedback. Native acceptance is a separate gate. These decisions supersede the older desktop-only organization restriction below. + - Pinned uses the same full-width conversation rows as ordinary sections, showing names, message previews, timestamps, unread counts and working state. Human screenshot feedback on 2026-10-23 supersedes the original grid choice: mobile names and message state need the same readable space in every section. - Pinned is first in the scroll content, scrolls normally, is hidden when empty in ordinary browsing, and cannot be reordered below ordinary sections. A pinned Channel appears there only, retaining its underlying section membership; ordinary unpin restores that placement. - - An explicit Organize Chats mode exposes drag handles for section order, pinned-card order and moving Channels between sections. Ordinary browsing preserves row swipe actions and iOS preview. Equivalent menu operations remain accessible without dragging. + - An explicit Organize Chats mode exposes drag handles for section order, pinned-row order and moving Channels between sections. Ordinary browsing preserves row swipe actions and iOS preview. Equivalent menu operations remain accessible without dragging. - Section membership, pins, ordering and sort modes use the corresponding Host's canonical data and match Web. Dragging rows within a scope changes only that scope to manual sorting; new messages do not displace manual order. The scope menu can restore newest-message sorting. - Dragging a Channel into Pinned pins it without changing its original section. Dragging a pinned Channel into an ordinary section unpins it and assigns that section. The Unpin menu action only removes the pin. - The Move to section menu action has the same result as dropping into a destination section: it unpins and assigns that section. Use Move to section wording instead of Add to section. This supersedes PR #2552's pin-preserving assignment behavior; that frozen candidate is not evidence for the new design. @@ -114,8 +114,8 @@ The shell is set by [ADR-0211](../../docs/adr/0211-the-mobile-app-has-two-tabs-w - Organization runs only in the complete list of one selected Host. Invoking it from All or search first selects the corresponding Host and clears the search. All still presents Host sections, but Cloud entries never become targets of Host organization operations. - Pinned is collapsible like ordinary sections. Collapse state is a device-local preference scoped to the Host. In Organize Chats mode, an empty Pinned section stays visible as a drop target; ordinary browsing hides it. - Each completed drag or move immediately saves to the owning Host; Done only leaves Organize Chats mode. On failure, return to the last Host-confirmed arrangement and show a retryable error. An uncertain response requires canonical readback before replaying a mutation; changing Host invalidates the pending interaction. - - Search temporarily presents a flat conversation list, including ordinary rows for pinned matches. Rank title matches first and pins next; omit empty section headers and disable organization. Clearing search restores the grouped/grid presentation without changing Host ordering or membership. - - The Human confirmed all twelve interview decisions and the delivery sequence on 2026-10-22. First deliver actual Host section presentation and the Pinned grid for Human feedback; then extend Organize Chats and drag operations. Frozen PRs #2551, #2552 and #2554 retain their existing scopes and evidence; a new candidate requires separate qualification. + - Search temporarily presents a flat conversation list, including ordinary rows for pinned matches. Rank title matches first and pins next; omit empty section headers and disable organization. Clearing search restores the grouped list presentation without changing Host ordering or membership. + - The Human confirmed all twelve interview decisions and the delivery sequence on 2026-10-22. The 2026-10-23 screenshot feedback replaces the first grid with a Pinned list; qualify that list before extending Organize Chats and drag operations. Frozen PRs #2551, #2552 and #2554 retain their existing scopes and evidence; a new candidate requires separate qualification. - Conversation rows keep the title and timestamp on one horizontal line at every system text size. The title takes the remaining width and truncates with tail ellipsis; the timestamp keeps its own single-line slot. Preview/status and count stay on a second line. A conversation without a timestamp does not reserve an empty metadata line. Preserve native font scaling and the complete accessible title/preview. - The header has a compact Host title on the left and a Settings gear on the right, on both iOS and Android. Search and Settings are `HeaderAction` buttons, native to each platform: on iOS 26 and later they are SwiftUI Liquid Glass circles (`buttonStyle('glass')`) with SF Symbols (`magnifyingglass`, `gearshape`), so the system supplies the press, Reduce Transparency and Increase Contrast looks. The symbol follows Dynamic Type only up to `xxxLarge`, as system toolbar symbols do, so at accessibility sizes it stays inside its fixed glass circle while the button keeps its label; earlier iOS keeps the opaque `raised` circles. Android uses Material 3 standard icon buttons: no container, a 40dp circular ripple (`materialIconButton.container`) inside the 48dp touch target, like the actions of a Material top app bar. The Android search back and clear buttons use the same icon button. This row stays horizontal at every system text size: the Host chip shrinks, its name occupies one line with tail ellipsis, and the Settings target stays at the trailing edge. Keep native font scaling and the full accessible Host name; both targets retain the platform minimum touch size. Other Host-name presentations may wrap. The Host picker stays mounted between visits; its translation follows a critically damped UI-thread spring and its scrim is clamped. Hidden contents leave the accessibility tree. - **+** is the circle beside the bottom navigation island. It opens the native **New PersonaBot** / **New Channel** menu and uses the app's create flow, or the full client where the app has none yet. diff --git a/apps/mobile/app/(tabs)/(home)/index.tsx b/apps/mobile/app/(tabs)/(home)/index.tsx index 19c4309528..e5d39f9cbb 100644 --- a/apps/mobile/app/(tabs)/(home)/index.tsx +++ b/apps/mobile/app/(tabs)/(home)/index.tsx @@ -1,7 +1,7 @@ import { renderKeyboardFormScroll } from '../../../src/ui/primitives/keyboard-form'; import { Redirect, Stack, useFocusEffect, useIsFocused, useRouter } from 'expo-router'; import { memo, useCallback, useMemo, useRef, useState } from 'react'; -import { View, useWindowDimensions } from 'react-native'; +import { View } from 'react-native'; import Animated from 'react-native-reanimated'; import { refreshQuietChannels, @@ -34,12 +34,10 @@ import { } from '../../../src/ui/chat/conversations'; import { sectionCollapse, useCollapsedSections } from '../../../src/host/native-section-collapse'; import { SectionHeader } from '../../../src/ui/chat/section-header'; -import { PinnedConversationCard } from '../../../src/ui/chat/pinned-conversation-card'; -import { pinnedColumns, withPinnedBands, type PinnedBand } from '../../../src/ui/chat/pinned-grid'; import { CloudConversationRow } from '../../../src/ui/chat/cloud-conversation-row'; import { useConversationFilter } from '../../../src/host/native-conversation-filter'; import { ConnectionBanner } from '../../../src/ui/connection-banner'; -import { pinnedGrid, space } from '../../../src/ui/design/tokens'; +import { space } from '../../../src/ui/design/tokens'; import { conversationEnvironments, computerEnvironmentKey, @@ -84,12 +82,6 @@ type ListRow = key: string; environment: string; section: Extract; - } - | { - type: 'pinned-band'; - key: string; - environment: string; - band: PinnedBand; }; export default function HomeScreen() { const focused = useIsFocused(); @@ -184,9 +176,6 @@ const HomeContent = memo(function HomeContent({ const effectiveFilter = environment.key; const quiet = useQuietChannels(saved?.hostId); const collapsed = useCollapsedSections(saved?.hostId); - const window = useWindowDimensions(); - const [listWidth, setListWidth] = useState(); - const columns = pinnedColumns(listWidth ?? window.width, window.fontScale); useFocusEffect( useCallback(() => { if (saved) refreshQuietChannels(saved); @@ -276,27 +265,22 @@ const HomeContent = memo(function HomeContent({ rows.filter((row) => row.type === 'computer').map((row) => [row.conversation.key, row]), ); const grouped: ListRow[] = saved - ? withPinnedBands( - chatList( - snapshot.roster, - list.status === 'ready' ? list.sections.action : [], - collapsed, - list.status === 'ready' ? list.unread : {}, - quiet, - ), - columns, + ? chatList( + snapshot.roster, + list.status === 'ready' ? list.sections.action : [], + collapsed, + list.status === 'ready' ? list.unread : {}, + quiet, ).flatMap((item): ListRow[] => { const key = JSON.stringify(['computer', saved.hostId, item.key]); if (item.kind === 'section') return [{ type: 'section', key, environment: hostEnvironment, section: item }]; - if (item.kind === 'pinned-band') - return [{ type: 'pinned-band', key, environment: hostEnvironment, band: item }]; const row = hostRows.get(item.row.key); return row ? [row] : []; }) : []; return [...grouped, ...rows.filter((row) => row.type === 'cloud')].filter(visible); - }, [rows, effectiveFilter, query, saved, snapshot.roster, list, collapsed, quiet, columns]); + }, [rows, effectiveFilter, query, saved, snapshot.roster, list, collapsed, quiet]); if (saved === undefined || (!cloud.ready && !cloud.error)) return ( @@ -378,10 +362,9 @@ const HomeContent = memo(function HomeContent({ setOpening(false); } }; - const renderHostConversation = (conversation: Conversation, pinned: boolean, card = false) => { - const Component = card ? PinnedConversationCard : ConversationRow; + const renderHostConversation = (conversation: Conversation, pinned: boolean) => { return ( - setListWidth(event.nativeEvent.layout.width)} data={displayed} keyExtractor={(r) => r.key} ListHeaderComponent={ @@ -529,26 +511,6 @@ const HomeContent = memo(function HomeContent({ if (saved) sectionCollapse.toggle(saved.hostId, item.section.id); }} /> - ) : item.type === 'pinned-band' ? ( - - {item.band.rows.map((conversation) => - renderHostConversation(conversation, true, true), - )} - {Array.from( - { length: item.band.columns - item.band.rows.length }, - (_, index) => ( - - ), - )} - ) : item.type === 'computer' ? ( renderHostConversation(item.conversation, item.pinned) ) : ( diff --git a/apps/mobile/src/ui/chat/pinned-conversation-card.tsx b/apps/mobile/src/ui/chat/pinned-conversation-card.tsx deleted file mode 100644 index b27a284826..0000000000 --- a/apps/mobile/src/ui/chat/pinned-conversation-card.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import type { ComponentProps, Ref } from 'react'; -import { Pressable, View, type ViewInstance } from 'react-native'; - -import { BotAvatar } from '../bot-avatar'; -import { useDesignTheme } from '../design/theme'; -import { pinnedGrid, radius, space } from '../design/tokens'; -import { ActionMenuButton, type MenuAction } from '../primitives/action-menu-button'; -import { showActionMenu } from '../primitives/app-dialog'; -import { CountBadge } from '../primitives/count-badge'; -import { Text } from '../primitives/text'; -import { ConversationPeek } from '../shell/conversation-peek'; -import { t } from '../strings'; -import type { ConversationRow } from './conversation-row'; -import { countBadge, rowLabel, rowStatus, titleOf } from './conversations'; -import { GroupMark } from './group-mark'; -import { RowStatusGlyph } from './row-status-glyph'; - -type Props = Omit, 'onPress'> & { - onPress?: (() => void) | undefined; -}; - -export function PinnedConversationCard(props: Props) { - const { row, actions = [], onAction, previewHref } = props; - const theme = useDesignTheme(); - const title = titleOf(row); - const menuActions: MenuAction[] = actions.map((action) => ({ - label: action.label, - icon: - action.key === 'section' - ? 'folder' - : action.key === 'read' - ? 'check' - : action.key === 'pin' || action.key === 'unpin' - ? 'pin' - : 'mute', - run: () => onAction?.(action.key), - })); - const face = ; - return ( - - {previewHref ? {face} : face} - {onAction && actions.length > 0 ? ( - - - showActionMenu( - title, - actions.map((action) => ({ - text: action.label, - onPress: () => onAction(action.key), - })), - ) - } - /> - - ) : null} - - ); -} - -function PinnedCardFace({ - row, - now, - actions = [], - onAction, - onPress, - ref, -}: Props & { ref?: Ref }) { - const theme = useDesignTheme(); - const title = titleOf(row); - const status = rowStatus(row, now); - const badge = countBadge(row); - return ( - ({ name: action.key, label: action.label }))} - onAccessibilityAction={(event) => { - const action = actions.find((entry) => entry.key === event.nativeEvent.actionName); - if (action) onAction?.(action.key); - }} - onPress={onPress} - android_ripple={{ color: theme.layer.canvas.pressed }} - style={({ pressed }) => ({ - minHeight: theme.touch, - alignItems: 'center', - gap: space.x2, - padding: space.x3, - borderRadius: radius.md, - backgroundColor: pressed ? theme.layer.canvas.pressed : theme.layer.canvas.fill, - })} - > - {row.kind === 'bot' ? ( - - ) : ( - - )} - - {title} - - - - {badge ? : null} - - - ); -} diff --git a/apps/mobile/src/ui/chat/pinned-grid.ts b/apps/mobile/src/ui/chat/pinned-grid.ts deleted file mode 100644 index 75182db0d7..0000000000 --- a/apps/mobile/src/ui/chat/pinned-grid.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { pinnedGrid } from '../design/tokens'; -import { PINNED_SECTION, type ChatListItem, type Conversation } from './conversations'; - -export type PinnedBand = { - kind: 'pinned-band'; - key: string; - rows: Conversation[]; - columns: number; -}; - -export function pinnedColumns(width: number, fontScale: number): number { - const scale = Number.isFinite(fontScale) ? Math.max(1, fontScale) : 1; - const available = Number.isFinite(width) ? Math.max(0, width - pinnedGrid.inset * 2) : 0; - return Math.max( - 1, - Math.floor((available + pinnedGrid.gap) / (pinnedGrid.minCardWidth * scale + pinnedGrid.gap)), - ); -} - -export function withPinnedBands( - items: readonly ChatListItem[], - columns: number, -): (ChatListItem | PinnedBand)[] { - const result: (ChatListItem | PinnedBand)[] = []; - const count = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1; - let band: PinnedBand | undefined; - for (const item of items) { - if (item.kind !== 'row' || item.sectionId !== PINNED_SECTION) { - band = undefined; - result.push(item); - continue; - } - if (band === undefined || band.rows.length === count) { - band = { kind: 'pinned-band', key: `pinned-band:${item.key}`, rows: [], columns: count }; - result.push(band); - } - band.rows.push(item.row); - } - return result; -} diff --git a/apps/mobile/src/ui/design/tokens.ts b/apps/mobile/src/ui/design/tokens.ts index 54c2035e7a..0fa9839d59 100644 --- a/apps/mobile/src/ui/design/tokens.ts +++ b/apps/mobile/src/ui/design/tokens.ts @@ -160,13 +160,6 @@ export const doubleTap = { window: 300, emoji: '👍' } as const; export const recentChats = { limit: 3 } as const; -export const pinnedGrid = { - minCardWidth: 104, - avatar: 48, - gap: space.x3, - inset: space.x5, -} as const; - export const markdownTable = { minColumnWidth: 96, maxColumnWidth: 280 } as const; export const drawerSpring = { duration: 280, dampingRatio: 1 } as const; diff --git a/apps/mobile/test/home-search.test.tsx b/apps/mobile/test/home-search.test.tsx index 910a94aa13..7b244cf433 100644 --- a/apps/mobile/test/home-search.test.tsx +++ b/apps/mobile/test/home-search.test.tsx @@ -435,7 +435,7 @@ describe('Search in the Chats header', () => { sections: [{ id: 'work', name: 'Work', channelIds: ['launch-team'] }], }; const view = await home(); - expect(view.querySelector('[data-testid="pinned-conversation-bot:ada"]')).not.toBeNull(); + expect(view.querySelector('[data-testid="conversation-row-bot:ada"]')).not.toBeNull(); expect(view.querySelector('[data-testid="chat-section-work"]')).not.toBeNull(); expect(view.querySelector('[role="tab"]')).toBeNull(); expect(view.querySelector('[data-testid="pager-next"]')).toBeNull(); @@ -468,7 +468,7 @@ describe('Search in the Chats header', () => { expect(view.textContent).toContain('Ada'); await act(async () => conversationFilter.set(cloudEnvironmentKey(scope, 'org_a'))); expect(view.querySelector('[data-testid="chat-section-work"]')).toBeNull(); - expect(view.querySelector('[data-testid="pinned-grid-band"]')).toBeNull(); + expect(view.querySelector('[data-testid="chat-section-pinned"]')).toBeNull(); expect(rows(view).join(' ')).not.toContain('Ada, Done'); expect(rows(view).join(' ')).toContain('Cloud general'); hostState.connecting = true; @@ -810,7 +810,6 @@ describe('Chats row actions share the Host path', () => { sectionOrder: [], }; const view = await home(); - await type(view, 'Ada'); for (const key of ['unpin', 'unmute'] as const) { await act(async () => view.querySelector('[aria-label="Swipe row"]')!.click(), @@ -838,12 +837,12 @@ describe('Remote Host section and Pinned presentation', () => { roster.arrangement = { pins: ['launch-team'], hidden: [], sections: [], sectionOrder: [] }; const view = await home(); expect( - view.querySelector('[data-testid="pinned-conversation-channel:launch-team"]'), + view.querySelector('[data-testid="conversation-row-channel:launch-team"]'), ).not.toBeNull(); await type(view, 'a'); expect(rows(view)[0]).toBe('Ada, Done'); expect(rows(view)[1]).toContain('Launch team'); - expect(view.querySelector('[data-testid="pinned-grid-band"]')).toBeNull(); + expect(view.querySelector('[data-testid="chat-section-pinned"]')).toBeNull(); }); const seed = () => { roster.arrangement = { @@ -865,31 +864,29 @@ describe('Remote Host section and Pinned presentation', () => { const ordered = (view: HTMLElement) => [...view.querySelectorAll('[data-testid]')] .map((node) => node.getAttribute('data-testid')) - .filter( - (id) => - id?.startsWith('chat-section-') || - id?.startsWith('conversation-row-') || - id?.startsWith('pinned-conversation-'), - ); + .filter((id) => id?.startsWith('chat-section-') || id?.startsWith('conversation-row-')); const toggle = async (view: HTMLElement, id: string) => act(async () => view.querySelector(`[data-testid="chat-section-${id}"]`)!.click(), ); - it('renders canonical sections, loose rows and one pinned card; search restores full rows and clearing restores arrangement', async () => { + it('renders pinned and section chats with the same full rows and restores arrangement after search', async () => { seed(); + hostState.unread = true; const view = await home(); expect(ordered(view)).toEqual([ 'chat-section-pinned', - 'pinned-conversation-bot:ada', + 'conversation-row-bot:ada', 'chat-section-work', 'conversation-row-channel:launch-team', 'conversation-row-bot:xiaoming', 'chat-section-empty', ]); - const card = view.querySelector('[data-testid="pinned-conversation-bot:ada"]')!; - expect(card.textContent).toContain('Ada'); - expect(card.textContent).not.toContain('Done'); + const pinned = view.querySelector('[data-testid="conversation-row-bot:ada"]')!; + expect(pinned.textContent).toContain('Ada'); + expect(pinned.textContent).toContain('Done'); + expect(pinned.textContent).toContain('2'); + expect(pinned.getAttribute('aria-label')).toContain(t.unreadCount(2)); await type(view, 'Ada'); expect(ordered(view)).toEqual(['conversation-row-bot:ada']); expect(view.textContent).toContain('Done'); @@ -904,50 +901,42 @@ describe('Remote Host section and Pinned presentation', () => { const view = await home(); await toggle(view, 'pinned'); await toggle(view, 'work'); - expect(ordered(view)).not.toContain('pinned-conversation-bot:ada'); + expect(ordered(view)).not.toContain('conversation-row-bot:ada'); expect(ordered(view)).not.toContain('conversation-row-channel:launch-team'); await type(view, 'Ada'); expect(ordered(view)).toEqual(['conversation-row-bot:ada']); await type(view, ''); - expect(ordered(view)).not.toContain('pinned-conversation-bot:ada'); + expect(ordered(view)).not.toContain('conversation-row-bot:ada'); hostState.hostId = 'h2'; await act(async () => root!.render()); - expect(ordered(view)).toContain('pinned-conversation-bot:ada'); + expect(ordered(view)).toContain('conversation-row-bot:ada'); expect(ordered(view)).toContain('conversation-row-channel:launch-team'); hostState.hostId = 'h1'; await act(async () => root!.render()); - expect(ordered(view)).not.toContain('pinned-conversation-bot:ada'); + expect(ordered(view)).not.toContain('conversation-row-bot:ada'); expect(call).not.toHaveBeenCalled(); }); it.each(['ios', 'android'] as const)( - 'keeps pinned card menu operations and native preview boundary on %s', + 'keeps pinned row menu operations and native preview boundary on %s', async (platform) => { seed(); hostState.actions = true; Platform.OS = platform; const view = await home(); - const menu = () => - view.querySelector(`[aria-label="${t.conversationActions('Ada')}"]`)!; - await act(async () => menu().click()); - await act(async () => - menus.at(-1)!.find((action) => action.text === t.rowActions.unpin)!.onPress!(), - ); + await rowMenuAction(view, 'unpin'); expect(call).toHaveBeenLastCalledWith('rosterBatch', { action: 'unpin', channelIds: ['dm-ada'], }); - await act(async () => menu().click()); - await act(async () => - menus.at(-1)!.find((action) => action.text === t.rowActions.section)!.onPress!(), - ); + await rowMenuAction(view, 'section'); expect(push).toHaveBeenLastCalledWith({ pathname: '/conversation-section', params: { hostId: 'h1', channelId: 'dm-ada' }, }); expect( view - .querySelector('[data-testid="pinned-conversation-bot:ada"]') + .querySelector('[data-testid="conversation-row-bot:ada"]') ?.parentElement?.querySelector('[data-testid="native-preview"]') != null, ).toBe(platform === 'ios'); roster.arrangement = { ...roster.arrangement!, pins: [] }; diff --git a/apps/mobile/test/pinned-grid.test.ts b/apps/mobile/test/pinned-list.test.ts similarity index 51% rename from apps/mobile/test/pinned-grid.test.ts rename to apps/mobile/test/pinned-list.test.ts index cd6631d674..e3755d0c9d 100644 --- a/apps/mobile/test/pinned-grid.test.ts +++ b/apps/mobile/test/pinned-list.test.ts @@ -1,19 +1,9 @@ import { describe, expect, it } from 'vitest'; -import { pinnedColumns, withPinnedBands } from '../src/ui/chat/pinned-grid'; import { chatList } from '../src/ui/chat/conversations'; import type { RosterView } from '../src/host/client'; describe('Pinned virtual list projection (not native geometry evidence)', () => { - it('adapts the column policy to container width and live system font scale', () => { - expect(pinnedColumns(390, 1)).toBe(3); - expect(pinnedColumns(800, 1)).toBe(6); - expect(pinnedColumns(390, 1.5)).toBe(2); - expect(pinnedColumns(390, 2)).toBe(1); - expect(pinnedColumns(800, 2)).toBe(3); - expect(pinnedColumns(0, 1)).toBe(1); - expect(pinnedColumns(390, 3.12)).toBe(1); - }); - it('virtualizes pinned bands alongside ordinary rows and keeps collapse counts', () => { + it('projects one flat-list item per pin alongside ordinary rows and keeps collapse counts', () => { const roster: RosterView = { bots: [], channels: Array.from({ length: 101 }, (_, i) => ({ @@ -30,16 +20,15 @@ describe('Pinned virtual list projection (not native geometry evidence)', () => }, sorting: { sortMode: 'manual', sortModes: {} }, }; - const items = withPinnedBands(chatList(roster, []), 3); - const bands = items.filter((item) => item.kind === 'pinned-band'); - expect(bands).toHaveLength(34); - expect(bands.flatMap((band) => band.rows.map((row) => row.key))).toEqual( + const items = chatList(roster, []); + const pins = items.filter((item) => item.kind === 'row' && item.sectionId === 'pinned'); + expect(pins).toHaveLength(100); + expect(pins.map((item) => item.key)).toEqual( roster.arrangement!.pins.map((id) => `channel:${id}`), ); - expect(bands.every((band) => band.rows.length <= 3)).toBe(true); expect(new Set(items.map((item) => item.key)).size).toBe(items.length); expect(items.at(-1)).toMatchObject({ kind: 'row', key: 'channel:c100' }); - expect(withPinnedBands(chatList(roster, [], new Set(['pinned'])), 3)).toMatchObject([ + expect(chatList(roster, [], new Set(['pinned']))).toMatchObject([ { kind: 'section', count: 100, collapsed: true }, { kind: 'row', key: 'channel:c100' }, ]); diff --git a/changes/2571-phone-pinned-grid.md b/changes/2571-phone-pinned-grid.md deleted file mode 100644 index 96ecab3c3f..0000000000 --- a/changes/2571-phone-pinned-grid.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -section: Added ---- - -## en - -- Phone Chats shows the Remote Host's sections and ordering, with a collapsible Pinned grid that adapts to width and system text size. Search uses full conversation rows; unpinning restores original section placement. Organize and drag operations remain a later slice ([#2571](https://github.com/BotHarness/DeepSeekBot/issues/2571)). - -## zh - -- 手机聊天页展示远程 Host 的分区和顺序,置顶网格可折叠,并随宽度和系统字号调整列数。搜索使用完整聊天行;取消置顶后恢复原分区位置。整理模式与拖动操作留待后续切片([#2571](https://github.com/BotHarness/DeepSeekBot/issues/2571))。 diff --git a/changes/2571-phone-pinned-list.md b/changes/2571-phone-pinned-list.md new file mode 100644 index 0000000000..82f281ceaa --- /dev/null +++ b/changes/2571-phone-pinned-list.md @@ -0,0 +1,11 @@ +--- +section: Added +--- + +## en + +- Phone Chats shows the Remote Host's sections and ordering, with a collapsible Pinned list using the same full conversation rows, message previews and unread/status indicators as other sections. Search flattens the list; unpinning restores original section placement. Organize and drag operations remain a later slice ([#2571](https://github.com/BotHarness/DeepSeekBot/issues/2571)). + +## zh + +- 手机聊天页展示远程 Host 的分区和顺序,置顶分区可折叠,使用与其他分区相同的完整聊天行,展示消息摘要、未读及状态。搜索临时平铺列表;取消置顶后恢复原分区位置。整理模式与拖动操作留待后续切片([#2571](https://github.com/BotHarness/DeepSeekBot/issues/2571))。 diff --git a/docs/architecture/botharness-architecture.md b/docs/architecture/botharness-architecture.md index f583df5b38..f34cbb7eb7 100644 --- a/docs/architecture/botharness-architecture.md +++ b/docs/architecture/botharness-architecture.md @@ -1074,9 +1074,9 @@ The mobile app uses its existing Expo Router tab and root Stack owners for an ad ### Mobile presentation (#2028) -Phone Chats projects the current Remote Host's canonical `rosterGet` arrangement into section headers, virtualized Pinned card bands and ordinary conversation rows (#2571). The shared Host client also reads the DSH-native `settings/describe` response and retains only the `botharness-client` global/per-scope sorting fields used by Web; the existing `deepseekbot settings botharness-client` command reads that same authority. A successful refresh publishes roster and sorting together; a failed read keeps the last confirmed snapshot. Settings-only Web changes become visible after refresh/reconnect. No Host method, write path or second arrangement store is introduced. Pinned display excludes the same Channel from its retained ordinary membership; unpin returns it there. Top-level ordering retains loose rows between section blocks. Per-Host collapse remains device-local. Search temporarily uses full rows, and All keeps Cloud rows outside Host organization. Native grid geometry, gestures and accessibility require separate test-center evidence. +Phone Chats projects the current Remote Host's canonical `rosterGet` arrangement into section headers and individually virtualized conversation rows, including Pinned (#2571). The shared Host client also reads the DSH-native `settings/describe` response and retains only the `botharness-client` global/per-scope sorting fields used by Web; the existing `deepseekbot settings botharness-client` command reads that same authority. A successful refresh publishes roster and sorting together; a failed read keeps the last confirmed snapshot. Settings-only Web changes become visible after refresh/reconnect. No Host method, write path or second arrangement store is introduced. Pinned display excludes the same Channel from its retained ordinary membership; unpin returns it there. Top-level ordering retains loose rows between section blocks. Per-Host collapse remains device-local. Pinned uses the same conversation row, message preview, timestamp, unread/status indicators and actions as other sections, following Human screenshot feedback. Search temporarily flattens the grouped list, and All keeps Cloud rows outside Host organization. Native row geometry, gestures and accessibility require separate test-center evidence. -手机聊天页将当前远程 Host 的 `rosterGet` 排列投影为分区标题、虚拟化置顶网格行和普通聊天行(#2571)。共享 Host client 同时读取 DSH 原生 `settings/describe`,仅保留 Web 使用的 `botharness-client` 全局及各分区排序字段;既有 `deepseekbot settings botharness-client` 读取同一权威。刷新成功后一起发布排列与排序,读取失败保留上次确认快照。仅在 Web 修改排序设置后,手机通过刷新或重连获取变化。不新增 Host 方法、写入路径或排列存储。置顶保留原分区归属但不重复展示,取消后恢复;顶层顺序保留分区之间的独立聊天行。折叠是按 Host 隔离的设备偏好。搜索暂用完整行,All 中 Cloud 行保持独立范围。原生网格、手势和无障碍证据仍由测试中心提供。 +手机聊天页将当前远程 Host 的 `rosterGet` 排列投影为分区标题和逐项虚拟化的聊天行,置顶分区使用同一行组件(#2571)。共享 Host client 同时读取 DSH 原生 `settings/describe`,仅保留 Web 使用的 `botharness-client` 全局及各分区排序字段;既有 `deepseekbot settings botharness-client` 读取同一权威。刷新成功后一起发布排列与排序,读取失败保留上次确认快照。仅在 Web 修改排序设置后,手机通过刷新或重连获取变化。不新增 Host 方法、写入路径或排列存储。置顶保留原分区归属但不重复展示,取消后恢复;顶层顺序保留分区之间的独立聊天行。折叠是按 Host 隔离的设备偏好。根据 Human 截图反馈,置顶与其他分区统一展示名称、消息摘要、时间、未读和状态,并使用相同操作入口。搜索暂时平铺列表,All 中 Cloud 行保持独立范围。原生行布局、手势和无障碍证据仍由测试中心提供。 The Human-confirmed full mobile organization target lives in `apps/mobile/DESIGN.md`: explicit single-Host Organize mode, accessible ordering/moves, immediate Host saves and readback recovery follow the first presentation slice and Human visual feedback. The inherited section picker still uses pin-preserving `channelAssign` in slice one; target Move to section (unpin plus assign) is a later change. These target decisions do not claim current implementation or native acceptance. diff --git a/scripts/verification-inventory.json b/scripts/verification-inventory.json index 9ea127fbd5..304ef1cfee 100644 --- a/scripts/verification-inventory.json +++ b/scripts/verification-inventory.json @@ -4,10 +4,10 @@ "boundary": "All scripts/e2e-*.mjs files and all current feature-map documents, augmented by implemented Client/CLI/mobile source entry points. Behavior rows group related acceptance paths; they are not an exhaustive product behavior denominator. Planned unmerged #1954 work and packaged/restart identity promises are excluded.", "behaviors": [ { - "id": "phone.pinned-grid", - "label": "Browse Remote Host sections and responsive Pinned cards, collapse and search without changing arrangement", - "source": "apps/mobile/src/ui/chat/pinned-conversation-card.tsx", - "guide": ".agents/skills/verify-deepseekbot/features/phone-pinned-grid.md", + "id": "phone.pinned-list", + "label": "Browse Remote Host sections and full Pinned conversation rows, collapse and search without changing arrangement", + "source": "apps/mobile/app/(tabs)/(home)/index.tsx", + "guide": ".agents/skills/verify-deepseekbot/features/phone-pinned-list.md", "task": 2571, "gap": "Centralized test center owns native iOS/Android width/text/appearance, interaction and screenshot qualification; Human visual feedback gates Organize/drag siblings." },