Skip to content

Commit 1d2a6c4

Browse files
refactor(mobile): use shared cache action rows
1 parent e727a70 commit 1d2a6c4

1 file changed

Lines changed: 9 additions & 22 deletions

File tree

‎apps/mobile/src/features/settings/SettingsClientStorageRouteScreen.tsx‎

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { useAtomSet, useAtomValue } from "@effect/atom-react";
55
import { type EnvironmentMachineKind, resolveEnvironmentMachineKind } from "@t3tools/contracts";
66
import { AsyncResult } from "effect/reactivity";
77
import { useMemo } from "react";
8-
import { Pressable, View } from "react-native";
8+
import { View } from "react-native";
99
import { useSafeAreaInsets } from "react-native-safe-area-context";
1010

1111
import { AppText as Text } from "../../components/ui/AppText";
1212
import { SymbolView } from "../../components/ui/AppSymbol";
13-
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
13+
import { ENVIRONMENT_MACHINE_SYMBOLS } from "../../components/EnvironmentMachineSymbol";
1414
import {
1515
clearClientCacheAtom,
1616
clientCacheSummaryAtom,
@@ -167,28 +167,15 @@ function CacheEnvironmentRow(props: {
167167
readonly onClear: () => void;
168168
}) {
169169
return (
170-
<View
171-
className={
172-
props.first
173-
? "flex-row items-center gap-3 p-4"
174-
: "border-t border-border flex-row items-center gap-3 p-4"
175-
}
176-
>
177-
<EnvironmentMachineSymbol kind={props.machine} size={22} tintColorClassName="accent-icon" />
178-
<Text className="min-w-0 flex-1 text-base text-foreground" numberOfLines={1}>
179-
{props.environmentLabel}
180-
</Text>
181-
<Pressable
182-
accessibilityLabel={`Clear cache for ${props.environmentLabel}`}
183-
accessibilityRole="button"
170+
<View className={props.first ? undefined : "border-t border-border"}>
171+
<SettingsActionRow
172+
icon={ENVIRONMENT_MACHINE_SYMBOLS[props.machine]}
173+
label={props.environmentLabel}
174+
description={`Clear ${formatBytes(props.environment.payloadBytes)} of cached data`}
175+
tone="danger"
184176
disabled={props.disabled}
185177
onPress={props.onClear}
186-
className="rounded-full px-3 py-2 disabled:opacity-40"
187-
>
188-
<Text className="font-t3-medium tabular-nums text-danger-foreground" numberOfLines={1}>
189-
Clear {formatBytes(props.environment.payloadBytes)}
190-
</Text>
191-
</Pressable>
178+
/>
192179
</View>
193180
);
194181
}

0 commit comments

Comments
 (0)