@devries-cameron20 / t3code Mirror · read-only / commits / 5837a85e74
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 00:30 UTC

refactor(mobile): consolidate shared action buttons (#21940)

Julius Marminge committed Oct 19, 2026 at 15:04 UTC 5837a85e747710425d4299a70a01395a87da8764
10 files changed +21 -127
apps/mobile/src/components/ui/Button.android.tsx
+1 -1
@@ -49,7 +49,7 @@ export function Button(props: ButtonProps) {
49 <View
50 accessible
51 accessibilityRole="button"
52 - accessibilityLabel={props.label}
52 + accessibilityLabel={props.accessibilityLabel ?? props.label}
53 accessibilityHint={props.accessibilityHint}
54 accessibilityState={{
55 disabled: Boolean(props.disabled || props.loading),
apps/mobile/src/components/ui/Button.tsx
+2 -1
@@ -6,6 +6,7 @@ import { cn } from "../../lib/cn";
6
7 export interface ButtonProps {
8 readonly label: string;
9 + readonly accessibilityLabel?: string;
10 readonly icon?: AppSymbolName;
11 readonly onPress: () => void;
12 readonly disabled?: boolean;
@@ -29,7 +30,7 @@ export function Button(props: ButtonProps) {
30 return (
31 <Pressable
32 accessibilityRole="button"
32 - accessibilityLabel={props.label}
33 + accessibilityLabel={props.accessibilityLabel ?? props.label}
34 accessibilityHint={props.accessibilityHint}
35 accessibilityState={{ disabled, busy: Boolean(props.loading) }}
36 disabled={disabled}
apps/mobile/src/features/projects/AddProjectScreen.tsx
+1 -14
@@ -262,20 +262,7 @@ function PrimaryActionButton(props: {
262 readonly loading?: boolean;
263 readonly onPress: () => void;
264 }) {
265 - if (Platform.OS === "android") return <Button {...props} tone="primary" fullWidth />;
266 - return (
267 - <Pressable
268 - disabled={props.disabled}
269 - onPress={props.onPress}
270 - className="h-12 items-center justify-center rounded-full bg-primary active:opacity-70 disabled:opacity-45"
271 - >
272 - {props.loading ? (
273 - <AppActivityIndicator colorClassName={String("accent-primary-foreground")} />
274 - ) : (
275 - <Text className="text-base font-t3-bold text-primary-foreground">{props.label}</Text>
276 - )}
277 - </Pressable>
278 - );
265 + return <Button {...props} tone="primary" fullWidth />;
266 }
267
268 function ProjectPathInput(props: {
apps/mobile/src/features/threads/PendingApprovalCard.tsx
+2 -2
@@ -1,4 +1,4 @@
1 -import { RequestActionButton } from "./RequestActionButton";
1 +import { Button } from "../../components/ui/Button";
2 import type {
3 ProviderApprovalDecision,
4 ProviderApprovalOption,
@@ -55,7 +55,7 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
55 ) : null}
56 <View className="flex-row flex-wrap gap-2.5">
57 {options.map((option) => (
58 - <RequestActionButton
58 + <Button
59 key={option.decision}
60 label={option.label}
61 tone={
apps/mobile/src/features/threads/PendingUserInputCard.tsx
+3 -3
@@ -1,4 +1,4 @@
1 -import { RequestActionButton } from "./RequestActionButton";
1 +import { Button } from "../../components/ui/Button";
2 import { QuestionAttachments } from "./QuestionAttachments";
3 import type { RuntimeRequestId } from "@t3tools/contracts";
4 import type { ThreadUserInputQuestion } from "@t3tools/client-runtime/state/thread-requests";
@@ -304,9 +304,9 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
304 );
305 })}
306 </ScrollView>
307 - <RequestActionButton
307 + <Button
308 label="Submit answers"
309 - size="large"
309 + fullWidth
310 tone={props.answers ? "primary" : "secondary"}
311 disabled={!props.canOperateThread || responseDisabled || props.answers === null}
312 onPress={() => void props.onSubmit()}
apps/mobile/src/features/threads/ProviderSubagentBar.tsx
+2 -2
@@ -7,7 +7,7 @@ import { View } from "react-native";
7
8 import { AppText as Text } from "../../components/ui/AppText";
9 import { ProviderIcon } from "../../components/ProviderIcon";
10 -import { RequestActionButton } from "./RequestActionButton";
10 +import { Button } from "../../components/ui/Button";
11 import { useVisibleSecondClock } from "./use-visible-second-clock";
12
13 export function ProviderSubagentBar(props: {
@@ -60,7 +60,7 @@ export function ProviderSubagentBar(props: {
60 </Text>
61 </View>
62 {props.onOpenParent ? (
63 - <RequestActionButton label="Open parent" tone="secondary" onPress={props.onOpenParent} />
63 + <Button label="Open parent" tone="secondary" onPress={props.onOpenParent} />
64 ) : null}
65 </View>
66 );
apps/mobile/src/features/threads/RequestActionButton.tsx deleted
-44
@@ -1,44 +0,0 @@
1 -import type { ComponentProps } from "react";
2 -import { Pressable } from "react-native";
3 -
4 -import { AppText as Text } from "../../components/ui/AppText";
5 -import { cn } from "../../lib/cn";
6 -
7 -export function RequestActionButton({
8 - label,
9 - tone = "primary",
10 - size = "default",
11 - disabled,
12 - ...props
13 -}: Omit<ComponentProps<typeof Pressable>, "children" | "className" | "style"> & {
14 - label: string;
15 - tone?: "primary" | "secondary" | "danger";
16 - size?: "default" | "large";
17 -}) {
18 - return (
19 - <Pressable
20 - {...props}
21 - accessibilityRole="button"
22 - accessibilityState={{ ...props.accessibilityState, disabled: Boolean(disabled) }}
23 - disabled={disabled}
24 - className={cn(
25 - "items-center justify-center active:opacity-70 disabled:opacity-50",
26 - size === "large" ? "rounded-2xl px-4 py-3.5" : "rounded-[14px] px-3.5 py-3",
27 - tone === "primary" ? "bg-primary" : tone === "danger" ? "bg-danger" : "bg-subtle-strong",
28 - )}
29 - >
30 - <Text
31 - className={cn(
32 - "text-sm",
33 - tone === "primary"
34 - ? "font-t3-extrabold text-primary-foreground"
35 - : tone === "danger"
36 - ? "font-t3-bold text-danger-foreground"
37 - : "font-t3-bold text-foreground",
38 - )}
39 - >
40 - {label}
41 - </Text>
42 - </Pressable>
43 - );
44 -}
apps/mobile/src/features/threads/SecretRequestCard.tsx
+4 -2
@@ -18,7 +18,7 @@ import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
18 import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
19 import { serverEnvironment } from "../../state/server";
20 import { useAtomCommand } from "../../state/use-atom-command";
21 -import { RequestActionButton } from "./RequestActionButton";
21 +import { Button } from "../../components/ui/Button";
22
23 const LOCK_SYMBOL: AppSymbolName = { ios: "lock", android: "lock" };
24 const PRIVATE_SYMBOL: AppSymbolName = { ios: "checkmark.shield", android: "lock" };
@@ -128,8 +128,10 @@ function PendingSecretRequestForm(props: {
128 {error}
129 </Text>
130 ) : null}
131 - <RequestActionButton
131 + <Button
132 label="Save securely"
133 + tone="primary"
134 + fullWidth
135 disabled={submitting || secret.trim().length === 0}
136 onPress={() => void send({ type: "save", secret })}
137 />
apps/mobile/src/features/threads/ThreadCreationFailedCard.tsx
+2 -2
@@ -1,4 +1,4 @@
1 -import { RequestActionButton } from "./RequestActionButton";
1 +import { Button } from "../../components/ui/Button";
2 import { View } from "react-native";
3
4 import { AppText as Text } from "../../components/ui/AppText";
@@ -19,7 +19,7 @@ export function ThreadCreationFailedCard(props: {
19 Your prompt was kept in the project draft.
20 </Text>
21 <View className="flex-row">
22 - <RequestActionButton label="Edit task" onPress={props.onEditTask} />
22 + <Button label="Edit task" tone="primary" onPress={props.onEditTask} />
23 </View>
24 </View>
25 );
apps/mobile/src/features/threads/git/gitSheetComponents.tsx
+4 -56
@@ -1,9 +1,7 @@
1 import { SymbolView } from "../../../components/ui/AppSymbol";
2 import type { ComponentProps } from "react";
3 -import { Platform, Pressable, View } from "react-native";
4 -import { AppText as Text } from "../../../components/ui/AppText";
3 +import { View } from "react-native";
4 import { Button } from "../../../components/ui/Button";
6 -import { cn } from "../../../lib/cn";
5
6 export function SheetActionButton(props: {
7 readonly icon: ComponentProps<typeof SymbolView>["name"];
@@ -12,60 +10,10 @@ export function SheetActionButton(props: {
10 readonly tone?: "primary" | "secondary" | "danger";
11 readonly onPress: () => void;
12 }) {
15 - if (Platform.OS === "android")
16 - return (
17 - <View className="flex-1">
18 - <Button
19 - label={props.label}
20 - icon={props.icon}
21 - tone={props.tone}
22 - disabled={props.disabled}
23 - onPress={props.onPress}
24 - fullWidth
25 - />
26 - </View>
27 - );
28 - const tone = props.tone ?? "secondary";
29 - const textColorClassName =
30 - tone === "primary"
31 - ? "accent-primary-foreground"
32 - : tone === "danger"
33 - ? "accent-danger-foreground"
34 - : "accent-secondary-foreground";
35 -
13 return (
37 - <Pressable
38 - className={cn(
39 - "min-h-[48px] flex-1 items-center justify-center rounded-[18px] px-3 py-3 disabled:opacity-[0.45]",
40 - tone === "primary" ? "bg-primary" : tone === "danger" ? "bg-danger" : "bg-secondary",
41 - tone !== "primary" &&
42 - (tone === "danger" ? "border border-danger-border" : "border border-secondary-border"),
43 - )}
44 - accessibilityRole="button"
45 - disabled={props.disabled}
46 - onPress={props.onPress}
47 - >
48 - <View className="max-w-full flex-row items-center justify-center gap-1.5">
49 - <SymbolView
50 - name={props.icon}
51 - size={16}
52 - tintColorClassName={textColorClassName}
53 - type="monochrome"
54 - />
55 - <Text
56 - className={cn(
57 - "shrink text-center text-xs font-t3-bold tracking-[0.9px] uppercase",
58 - tone === "primary"
59 - ? "text-primary-foreground"
60 - : tone === "danger"
61 - ? "text-danger-foreground"
62 - : "text-secondary-foreground",
63 - )}
64 - >
65 - {props.label}
66 - </Text>
67 - </View>
68 - </Pressable>
14 + <View className="flex-1">
15 + <Button {...props} fullWidth />
16 + </View>
17 );
18 }
19