@devries-cameron20 / t3code Mirror · read-only / commits / c7fa1e9694
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 24, 00:15 UTC

fix(mobile): share settings action row defaults (#12369)

Julius Marminge committed Sep 17, 2026 at 20:28 UTC c7fa1e96943f380a8893e89460d03a362285ab83
4 files changed +72 -33
apps/mobile/src/components/MaterialListRow.tsx
+3 -1
@@ -9,6 +9,7 @@ import { SymbolView } from "./AppSymbol";
9 /** Shared geometry for Material navigation and selection lists. Group rows in one card. */
10 export function MaterialListRow({
11 title,
12 + titleClassName,
13 subtitle,
14 leading,
15 trailing,
@@ -16,6 +17,7 @@ export function MaterialListRow({
17 ...props
18 }: Omit<ComponentProps<typeof Pressable>, "children"> & {
19 readonly title: string;
20 + readonly titleClassName?: string;
21 readonly subtitle?: string | null;
22 readonly leading?: ReactNode;
23 readonly trailing?: ReactNode;
@@ -38,7 +40,7 @@ export function MaterialListRow({
40 >
41 {leading ? <View className="size-6 items-center justify-center">{leading}</View> : null}
42 <View className="min-w-0 flex-1 gap-1">
41 - <AppText className="text-base text-foreground" numberOfLines={2}>
43 + <AppText className={cn("text-base text-foreground", titleClassName)} numberOfLines={2}>
44 {title}
45 </AppText>
46 {subtitle ? (
apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx
+6 -16
@@ -2,12 +2,13 @@ import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollVie
2 import Constants from "expo-constants";
3 import * as Updates from "expo-updates";
4 import { useEffect, useState } from "react";
5 -import { ActivityIndicator, Platform, Pressable, View } from "react-native";
5 +import { ActivityIndicator, Platform, View } from "react-native";
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
7
8 import { SymbolView } from "../../components/AppSymbol";
9 import { AppText as Text } from "../../components/AppText";
10 import { tryCopyTextWithHaptic } from "../../lib/copyTextWithHaptic";
11 +import { SettingsActionRow } from "../settings/components/SettingsActionRow";
12 import { SettingsScreen } from "../settings/components/SettingsScreen";
13 import { SettingsSection } from "../settings/components/SettingsSection";
14 import {
@@ -108,23 +109,12 @@ export function SettingsDiagnosticsRouteScreen() {
109
110 <View className="gap-3">
111 <SettingsSection title="Actions">
111 - <Pressable
112 - accessibilityRole="button"
112 + <SettingsActionRow
113 + icon={copied ? "checkmark" : "doc.on.doc"}
114 + label={copied ? "Copied" : "Copy crash report"}
115 disabled={state.status !== "ready"}
116 onPress={() => void copyReport()}
115 - className="flex-row items-center gap-4 p-4 disabled:opacity-40"
116 - >
117 - <SymbolView
118 - name={copied ? "checkmark" : "doc.on.doc"}
119 - size={22}
120 - tintColorClassName="accent-icon"
121 - type="monochrome"
122 - weight="regular"
123 - />
124 - <Text className="flex-1 text-lg text-foreground">
125 - {copied ? "Copied" : "Copy crash report"}
126 - </Text>
127 - </Pressable>
117 + />
118 </SettingsSection>
119 <Text className="px-2 text-sm leading-normal text-foreground-muted">
120 Paste the report into a GitHub issue. It contains the app version, the JavaScript error
apps/mobile/src/features/settings/SettingsClientStorageRouteScreen.tsx
+7 -16
@@ -16,6 +16,7 @@ import {
16 } from "../../state/client-cache-state";
17 import { useServerConfigs } from "../../state/entities";
18 import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
19 +import { SettingsActionRow } from "./components/SettingsActionRow";
20 import { SettingsSection } from "./components/SettingsSection";
21 import { SettingsScreen } from "./components/SettingsScreen";
22
@@ -139,24 +140,14 @@ export function SettingsClientStorageRouteScreen() {
140
141 <View className="gap-3">
142 <SettingsSection title="Actions">
142 - <Pressable
143 - accessibilityRole="button"
143 + <SettingsActionRow
144 + icon="trash"
145 + label={summary ? `Clear ${formatBytes(summary.payloadBytes)}` : "Clear caches"}
146 + tone="danger"
147 disabled={isClearing || !summary || summary.recordCount === 0}
148 + loading={isClearing}
149 onPress={confirmClearAll}
146 - className="flex-row items-center gap-4 p-4 disabled:opacity-40"
147 - >
148 - <SymbolView
149 - name="trash"
150 - size={22}
151 - tintColorClassName="accent-danger-foreground"
152 - type="monochrome"
153 - weight="regular"
154 - />
155 - <Text className="flex-1 text-lg tabular-nums text-danger-foreground">
156 - {summary ? `Clear ${formatBytes(summary.payloadBytes)}` : "Clear caches"}
157 - </Text>
158 - {isClearing ? <ActivityIndicator colorClassName="accent-danger-foreground" /> : null}
159 - </Pressable>
150 + />
151 </SettingsSection>
152 <Text className="px-2 text-sm leading-normal text-foreground-muted">
153 Clearing caches never removes environment connections, credentials, account data, or
apps/mobile/src/features/settings/components/SettingsActionRow.tsx new
+56
@@ -0,0 +1,56 @@
1 +import type { ComponentProps } from "react";
2 +import { ActivityIndicator, Platform, Pressable } from "react-native";
3 +
4 +import { SymbolView } from "../../../components/AppSymbol";
5 +import { AppText as Text } from "../../../components/AppText";
6 +import { MaterialListRow } from "../../../components/MaterialListRow";
7 +import { cn } from "../../../lib/cn";
8 +
9 +export function SettingsActionRow(props: {
10 + readonly icon: ComponentProps<typeof SymbolView>["name"];
11 + readonly label: string;
12 + readonly tone?: "default" | "danger";
13 + readonly disabled?: boolean;
14 + readonly loading?: boolean;
15 + readonly onPress: () => void;
16 +}) {
17 + const danger = props.tone === "danger";
18 + const textClassName = danger ? "tabular-nums text-danger-foreground" : "text-foreground";
19 + const iconColorClassName = danger ? "accent-danger-foreground" : "accent-icon";
20 + const icon = (
21 + <SymbolView
22 + name={props.icon}
23 + size={Platform.OS === "android" ? 24 : 22}
24 + tintColorClassName={iconColorClassName}
25 + type="monochrome"
26 + weight="regular"
27 + />
28 + );
29 + const spinner = props.loading ? <ActivityIndicator colorClassName={iconColorClassName} /> : null;
30 +
31 + if (Platform.OS === "android") {
32 + return (
33 + <MaterialListRow
34 + title={props.label}
35 + titleClassName={textClassName}
36 + leading={icon}
37 + trailing={spinner}
38 + disabled={props.disabled}
39 + onPress={props.onPress}
40 + />
41 + );
42 + }
43 +
44 + return (
45 + <Pressable
46 + accessibilityRole="button"
47 + disabled={props.disabled}
48 + onPress={props.onPress}
49 + className="flex-row items-center gap-4 p-4 disabled:opacity-40"
50 + >
51 + {icon}
52 + <Text className={cn("flex-1 text-lg", textClassName)}>{props.label}</Text>
53 + {spinner}
54 + </Pressable>
55 + );
56 +}