| author | |
| committer | |
| log | c7fa1e96943f380a8893e89460d03a362285ab83 |
| tree | 75fad321e97aab1f9a00b404999ffe2aab41bd72 |
| parent | fa2decfce7fa359551634b4d24a2aecd9cef88c9 |
| signature | Signed by PGP key B5690EEEBB952194 |
4 files changed, 72 insertions(+), 33 deletions(-)
apps/mobile/src/components/MaterialListRow.tsx+3-1| ... | ... | @@ -9,6 +9,7 @@ import { SymbolView } from "./AppSymbol"; |
| 9 | 9 | /** Shared geometry for Material navigation and selection lists. Group rows in one card. */ |
| 10 | 10 | export function MaterialListRow({ |
| 11 | 11 | title, |
| 12 | titleClassName, | |
| 12 | 13 | subtitle, |
| 13 | 14 | leading, |
| 14 | 15 | trailing, |
| ... | ... | @@ -16,6 +17,7 @@ export function MaterialListRow({ |
| 16 | 17 | ...props |
| 17 | 18 | }: Omit<ComponentProps<typeof Pressable>, "children"> & { |
| 18 | 19 | readonly title: string; |
| 20 | readonly titleClassName?: string; | |
| 19 | 21 | readonly subtitle?: string | null; |
| 20 | 22 | readonly leading?: ReactNode; |
| 21 | 23 | readonly trailing?: ReactNode; |
| ... | ... | @@ -38,7 +40,7 @@ export function MaterialListRow({ |
| 38 | 40 | > |
| 39 | 41 | {leading ? <View className="size-6 items-center justify-center">{leading}</View> : null} |
| 40 | 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}> | |
| 42 | 44 | {title} |
| 43 | 45 | </AppText> |
| 44 | 46 | {subtitle ? ( |
apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx+6-16| ... | ... | @@ -2,12 +2,13 @@ import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollVie |
| 2 | 2 | import Constants from "expo-constants"; |
| 3 | 3 | import * as Updates from "expo-updates"; |
| 4 | 4 | import { useEffect, useState } from "react"; |
| 5 | import { ActivityIndicator, Platform, Pressable, View } from "react-native"; | |
| 5 | import { ActivityIndicator, Platform, View } from "react-native"; | |
| 6 | 6 | import { useSafeAreaInsets } from "react-native-safe-area-context"; |
| 7 | 7 | |
| 8 | 8 | import { SymbolView } from "../../components/AppSymbol"; |
| 9 | 9 | import { AppText as Text } from "../../components/AppText"; |
| 10 | 10 | import { tryCopyTextWithHaptic } from "../../lib/copyTextWithHaptic"; |
| 11 | import { SettingsActionRow } from "../settings/components/SettingsActionRow"; | |
| 11 | 12 | import { SettingsScreen } from "../settings/components/SettingsScreen"; |
| 12 | 13 | import { SettingsSection } from "../settings/components/SettingsSection"; |
| 13 | 14 | import { |
| ... | ... | @@ -108,23 +109,12 @@ export function SettingsDiagnosticsRouteScreen() { |
| 108 | 109 | |
| 109 | 110 | <View className="gap-3"> |
| 110 | 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"} | |
| 113 | 115 | disabled={state.status !== "ready"} |
| 114 | 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 | /> | |
| 128 | 118 | </SettingsSection> |
| 129 | 119 | <Text className="px-2 text-sm leading-normal text-foreground-muted"> |
| 130 | 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 | 16 | } from "../../state/client-cache-state"; |
| 17 | 17 | import { useServerConfigs } from "../../state/entities"; |
| 18 | 18 | import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry"; |
| 19 | import { SettingsActionRow } from "./components/SettingsActionRow"; | |
| 19 | 20 | import { SettingsSection } from "./components/SettingsSection"; |
| 20 | 21 | import { SettingsScreen } from "./components/SettingsScreen"; |
| 21 | 22 | |
| ... | ... | @@ -139,24 +140,14 @@ export function SettingsClientStorageRouteScreen() { |
| 139 | 140 | |
| 140 | 141 | <View className="gap-3"> |
| 141 | 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" | |
| 144 | 147 | disabled={isClearing || !summary || summary.recordCount === 0} |
| 148 | loading={isClearing} | |
| 145 | 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 | /> | |
| 160 | 151 | </SettingsSection> |
| 161 | 152 | <Text className="px-2 text-sm leading-normal text-foreground-muted"> |
| 162 | 153 | Clearing caches never removes environment connections, credentials, account data, or |
apps/mobile/src/features/settings/components/SettingsActionRow.tsx created+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 | } |