The best way to control Claude Code, Codex and more from any computer or phone
refactor(mobile): use shared project settings actions (#21915)
Julius Marminge committed
Oct 19, 2026 at 15:04 UTC
bcccdd8a3a0d264bbe1d2546dad69d66758aad7c
3 files changed
+32
-19
apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx
+7
-8
@@ -1,10 +1,11 @@
1
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
2
import { AppText as Text, AppTextInput } from "../../components/ui/AppText";
3
+import { Button } from "../../components/ui/Button";
4
import { ProjectFavicon } from "../../components/ProjectFavicon";
5
import { deriveProjectGroupLabel } from "@t3tools/client-runtime/state/project-grouping";
6
import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
7
import { useState } from "react";
7
-import { Platform, Pressable, View } from "react-native";
8
+import { Platform, View } from "react-native";
9
import { useSafeAreaInsets } from "react-native-safe-area-context";
10
11
import { projectEnvironment } from "../../state/projects";
@@ -123,14 +124,12 @@ function ProjectOverviewContent(props: {
124
editable={!isSaving}
125
/>
126
{canSave ? (
126
- <Pressable
127
- accessibilityRole="button"
128
- accessibilityLabel="Save project name"
127
+ <Button
128
+ label="Save"
129
+ accessibilityHint="Save project name"
130
+ tone="secondary"
131
onPress={saveName}
130
- className="rounded-full bg-subtle-strong px-4 py-2 active:opacity-70"
131
- >
132
- <Text className="text-sm font-t3-medium text-foreground">Save</Text>
133
- </Pressable>
132
+ />
133
) : null}
134
</View>
135
</View>
apps/mobile/src/features/settings/SettingsServerControlsRouteScreen.test.tsx
+18
-3
@@ -58,6 +58,21 @@ vi.mock("../../state/use-atom-command", () => ({
58
vi.mock("../threads/thread-settings-options", () => ({ RUNTIME_MODE_CHOICES: [] }));
59
vi.mock("../../components/ui/ScreenScrollView", () => ({ ScreenScrollView: Children }));
60
vi.mock("../../components/ui/AppText", () => ({ AppText: Children }));
61
+vi.mock("../../components/ui/Button", () => ({
62
+ Button: ({
63
+ label,
64
+ disabled,
65
+ onPress,
66
+ }: {
67
+ label: string;
68
+ disabled?: boolean;
69
+ onPress: () => void;
70
+ }) => (
71
+ <button disabled={disabled} onClick={onPress}>
72
+ {label}
73
+ </button>
74
+ ),
75
+}));
76
vi.mock("./components/SettingsScreen", () => ({ SettingsScreen: Children }));
77
vi.mock("./components/SettingsEnvironmentFilterHeader", () => ({
78
AndroidSettingsEnvironmentFilter: () => null,
@@ -271,15 +286,15 @@ describe.each([
286
}));
287
act(() => root.render(<Screen />));
288
274
- await act(async () => button("Use environment defaults").click());
289
+ await act(async () => button("Use defaults").click());
290
291
expectFailures();
292
expect(button(label).getAttribute("aria-checked")).toBe("true");
278
- expect(button("Use environment defaults").disabled).toBe(false);
293
+ expect(button("Use defaults").disabled).toBe(false);
294
295
mocks.alert.mockClear();
296
mocks.updateSettings.mockResolvedValue(AsyncResult.success(undefined));
282
- await act(async () => button("Use environment defaults").click());
297
+ await act(async () => button("Use defaults").click());
298
expect(mocks.updateSettings).toHaveBeenCalledTimes(6);
299
expect(mocks.alert).not.toHaveBeenCalled();
300
expect(button(label).getAttribute("aria-checked")).toBe("true");
apps/mobile/src/features/settings/components/SettingsProjectOverridesSection.tsx
+7
-8
@@ -1,5 +1,6 @@
1
-import { Pressable, View } from "react-native";
1
+import { View } from "react-native";
2
3
+import { Button } from "../../../components/ui/Button";
4
import { AppText as Text } from "../../../components/ui/AppText";
5
import { SettingsSection } from "./SettingsSection";
6
@@ -18,15 +19,13 @@ export function SettingsProjectOverridesSection(props: {
19
{props.projectLabel}
20
</Text>
21
{!props.pending && props.supportsOverrides && props.hasOverrides ? (
21
- <Pressable
22
- accessibilityRole="button"
23
- accessibilityLabel="Use environment defaults"
22
+ <Button
23
+ label="Use defaults"
24
+ accessibilityHint="Use environment defaults for this project"
25
+ tone="text"
26
disabled={props.disabled}
27
onPress={props.onClear}
26
- className="px-2 py-2 active:opacity-70"
27
- >
28
- <Text className="text-sm font-t3-medium text-primary-text">Use defaults</Text>
29
- </Pressable>
28
+ />
29
) : null}
30
</View>
31
{!props.supportsOverrides ? (