Skip to content

Commit e0ac919

Browse files
committed
fix(mobile): refine agent Stop button layout
1 parent 9f71d86 commit e0ac919

3 files changed

Lines changed: 40 additions & 29 deletions

File tree

‎apps/mobile/src/features/threads/SubagentStopButton.tsx‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { useAtomValue } from "@effect/atom-react";
22
import type { EnvironmentId, OrchestrationV2Subagent } from "@t3tools/contracts";
33
import { useState } from "react";
4-
import { Alert, Pressable } from "react-native";
4+
import { Alert, Pressable, View } from "react-native";
55

66
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
77
import { AppText as Text } from "../../components/AppText";
88
import { SymbolView } from "../../components/AppSymbol";
9+
import { cn } from "../../lib/cn";
910
import { orchestrationEnvironment } from "../../state/orchestration";
1011
import { threadEnvironment } from "../../state/threads";
1112
import { useAtomCommand } from "../../state/use-atom-command";
@@ -17,6 +18,7 @@ import {
1718
export function SubagentStopButton(props: {
1819
readonly environmentId: EnvironmentId;
1920
readonly subagent: OrchestrationV2Subagent;
21+
readonly className?: string;
2022
}) {
2123
const target = resolveSubagentStopTarget(props.subagent);
2224
const canStopWorkflow = useAtomValue(
@@ -72,14 +74,19 @@ export function SubagentStopButton(props: {
7274
accessibilityState={{ disabled: stopping, busy: stopping }}
7375
disabled={stopping}
7476
onPress={confirmStop}
75-
className="min-h-11 min-w-11 flex-row items-center justify-center gap-1.5 rounded-full bg-subtle px-3 active:opacity-70 disabled:opacity-50"
76-
>
77-
{stopping ? (
78-
<AppActivityIndicator size="small" />
79-
) : (
80-
<SymbolView name="stop.fill" size={10} tintColorClassName="accent-danger-foreground" />
77+
className={cn(
78+
"min-h-11 justify-center active:opacity-70 disabled:opacity-50",
79+
props.className,
8180
)}
82-
<Text className="font-t3-medium text-xs text-danger-foreground">Stop</Text>
81+
>
82+
<View className="h-7 flex-row items-center gap-1.5 rounded-full border border-danger-border bg-danger px-3">
83+
{stopping ? (
84+
<AppActivityIndicator size="small" />
85+
) : (
86+
<SymbolView name="stop.fill" size={9} tintColorClassName="accent-danger-foreground" />
87+
)}
88+
<Text className="font-t3-medium text-xs text-danger-foreground">Stop</Text>
89+
</View>
8390
</Pressable>
8491
);
8592
}

‎apps/mobile/src/features/threads/ThreadAgentsSheet.tsx‎

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,21 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
102102
return group === undefined ? (
103103
<View key={subagent.id} className="border-b border-border">
104104
{row}
105+
<SubagentStopButton
106+
environmentId={target.environmentId}
107+
subagent={subagent}
108+
className="-mt-3 mb-1 self-end"
109+
/>
105110
</View>
106111
) : (
107112
<ThreadWorkflowGroup
108113
key={subagent.id}
109114
environmentId={target.environmentId}
110115
group={group}
111116
header={row}
117+
stopButton={
118+
<SubagentStopButton environmentId={target.environmentId} subagent={subagent} />
119+
}
112120
onOpen={openChildThread}
113121
/>
114122
);
@@ -179,28 +187,22 @@ function AgentRow(props: {
179187
</View>
180188
);
181189

182-
return (
183-
<View className="flex-row items-center gap-3">
184-
{childThreadId === null ? (
185-
<View
186-
accessible
187-
accessibilityHint="Provider-managed agent. Its work appears in the transcript."
188-
className="min-w-0 flex-1"
189-
>
190-
{row}
191-
</View>
192-
) : (
193-
<Pressable
194-
accessibilityRole="link"
195-
accessibilityHint="Opens this agent thread"
196-
onPress={() => props.onOpen(childThreadId)}
197-
className="min-w-0 flex-1 active:opacity-70"
198-
>
199-
{row}
200-
</Pressable>
201-
)}
202-
<SubagentStopButton environmentId={props.environmentId} subagent={subagent} />
190+
return childThreadId === null ? (
191+
<View
192+
accessible
193+
accessibilityHint="Provider-managed agent. Its work appears in the transcript."
194+
>
195+
{row}
203196
</View>
197+
) : (
198+
<Pressable
199+
accessibilityRole="link"
200+
accessibilityHint="Opens this agent thread"
201+
onPress={() => props.onOpen(childThreadId)}
202+
className="active:opacity-70"
203+
>
204+
{row}
205+
</Pressable>
204206
);
205207
}
206208

‎apps/mobile/src/features/threads/ThreadWorkflowGroup.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function ThreadWorkflowGroup(props: {
2424
readonly environmentId: EnvironmentId;
2525
readonly group: SubagentWorkflowGroup;
2626
readonly header: ReactNode;
27+
readonly stopButton: ReactNode;
2728
readonly onOpen: (threadId: ThreadId) => void;
2829
}) {
2930
const { group } = props;
@@ -55,6 +56,7 @@ export function ThreadWorkflowGroup(props: {
5556
{summary}
5657
</Text>
5758
</Pressable>
59+
{props.stopButton}
5860
</View>
5961
{expanded ? (
6062
<View className="ml-[3px] border-l border-border pl-3.5">

0 commit comments

Comments
 (0)