@devries-cameron20 / t3code Mirror · read-only
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 21, 04:45 UTC

main
tsx 56 lines 2.16 KB
Raw
1 import { msg, T, useGT, useMessages } from "gt-react-native";
2 import { useAtomValue } from "@effect/atom-react";
3 import type { ToolCallVisibility } from "@t3tools/contracts/settings";
4 import { AsyncResult } from "effect/reactivity";
5 import { View } from "react-native";
6
7 import { AppText as Text } from "../../../../components/ui/AppText";
8 import { ListChoiceRow } from "../../../../components/ui/ListChoiceRow";
9 import { mobilePreferencesAtom, saveMobilePreferences } from "../../../../state/preferences";
10 import { useAtomCommand } from "../../../../state/use-atom-command";
11 import { SettingsSection } from "../../components/SettingsSection";
12
13 const TOOL_CALL_VISIBILITY_OPTIONS: ReadonlyArray<{
14 readonly value: ToolCallVisibility;
15 readonly label: string;
16 }> = [
17 { value: "showAll", label: msg("Show all") },
18 { value: "hideSuccessful", label: msg("Hide successful") },
19 { value: "hideAll", label: msg("Hide all") },
20 { value: "zen", label: msg("Zen", { $context: "tool call visibility: only final answers" }) },
21 ];
22
23 export function ToolCallsAppearanceSection() {
24 const gt = useGT();
25 const m = useMessages();
26 const savePreferences = useAtomCommand(saveMobilePreferences);
27 const preferences = useAtomValue(mobilePreferencesAtom);
28 const selected = AsyncResult.isSuccess(preferences)
29 ? (preferences.value.toolCallVisibility ?? "showAll")
30 : null;
31
32 return (
33 <View className="gap-3">
34 <SettingsSection title={gt("Tool calls in chat")}>
35 {TOOL_CALL_VISIBILITY_OPTIONS.map((option, index) => (
36 <ListChoiceRow
37 key={option.value}
38 label={m(option.label)}
39 selected={selected === option.value}
40 separated={index > 0}
41 disabled={selected === null}
42 onPress={() => {
43 void savePreferences({ toolCallVisibility: option.value });
44 }}
45 />
46 ))}
47 </SettingsSection>
48 <Text className="px-2 text-sm text-foreground-muted">
49 <T>
50 Hide the commands, edits, and searches agents run. Hide successful keeps failures. Zen
51 shows only final answers. Approvals, questions, and errors always show.
52 </T>
53 </Text>
54 </View>
55 );
56 }