Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions FORK.md

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion apps/mobile/src/features/threads/thread-list-v2-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
import { AppText as Text } from "../../components/ui/AppText";
import { Menu } from "../../components/ui/Menu";
import { AgentIdentityChip } from "../../j5/agents/AgentIdentityChip";
import { CaptainSeats, CaptainSeatsToggle } from "../../j5/crew/CaptainSeats";
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
import { ProjectFavicon } from "../../components/ProjectFavicon";
import { ProviderIcon, ProviderInstanceIcon } from "../../components/ProviderIcon";
Expand Down Expand Up @@ -1277,6 +1278,14 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
) : (
<View className="flex-1" />
)}
<CaptainSeatsToggle
thread={thread}
mutedClassName={
selected
? selectedThreadRowColors.mutedForegroundClassName
: rowAppearance.tertiaryForegroundClassName
}
/>
{pr ? (
<Pressable
// Padding cancelled by negative margin grows the touch target into
Expand Down Expand Up @@ -1440,6 +1449,14 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
/>
) : null}
</View>
<CaptainSeatsToggle
thread={thread}
mutedClassName={
selected
? selectedThreadRowColors.mutedForegroundClassName
: rowAppearance.tertiaryForegroundClassName
}
/>
{props.hasQueuedMessages ? <QueuedMessageIcon selected={selected} /> : null}
<Text
className={cn(
Expand All @@ -1460,8 +1477,21 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
</RowPressable>
);

const captainSeats = (
<CaptainSeats
thread={thread}
statusLabels={STATUS_LABEL_BY_STATUS}
onSelectThread={onSelectThread}
/>
);

if (!canOperateThread)
return <View style={rowAppearance.swipeContainerStyle}>{rowContent(() => {})}</View>;
return (
<>
<View style={rowAppearance.swipeContainerStyle}>{rowContent(() => {})}</View>
{captainSeats}
</>
);

return (
<View collapsable={false}>
Expand Down Expand Up @@ -1517,6 +1547,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
</Menu>
)}
</ThreadSwipeable>
{captainSeats}
</View>
);
});
4 changes: 4 additions & 0 deletions apps/mobile/src/features/threads/useThreadListV2.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ vi.mock("../../state/threads", () => ({
threadFamilies: { mountRows: () => () => {} },
}));
vi.mock("../../state/atom-registry", () => ({ appAtomRegistry: undefined }));
// J5 (case 115): the D22 filter reads server connections; this test lists every thread.
vi.mock("../../j5/crew/spawnedChildren", () => ({
useCrewListedThreads: <T,>(threads: T) => threads,
}));

it("reuses a large thread list across tab renders and updates when its inputs change", async () => {
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
Expand Down
5 changes: 4 additions & 1 deletion apps/mobile/src/features/threads/useThreadListV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { OlderSettledScope } from "@t3tools/client-runtime/state/threads";
import type { EnvironmentId } from "@t3tools/contracts";
import { useMemo, useSyncExternalStore } from "react";

import { useCrewListedThreads } from "../../j5/crew/spawnedChildren";
import { scopedProjectKey } from "../../lib/scopedEntities";
import { useOlderSettledShelf, useOlderSettledShelfGrowth } from "../../state/olderSettledShelf";
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
Expand Down Expand Up @@ -66,7 +67,9 @@ export function useThreadListV2(input: {
readonly settledShelfExpanded: boolean;
readonly selectedThreadKey: string | null;
}) {
const { threads, workingShelfEnabled } = input;
const { workingShelfEnabled } = input;
// J5 (register D22): an agent-spawned thread lists under its spawner, not at the top level.
const threads = useCrewListedThreads(input.threads);
const layoutTime = useMemo(
() => threadListV2LayoutTime({ threads, now: input.now, searchQuery: input.searchQuery }),
[threads, input.now, input.searchQuery],
Expand Down
Loading
Loading