@devries-cameron20 / t3code Mirror · read-only / commits / 6e37f7116c
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 23, 00:30 UTC

refactor(mobile): share preview actions (#21942)

Julius Marminge committed Oct 19, 2026 at 15:04 UTC 6e37f7116c70e3aa5e4aa17ab00e65449a9bf0d3
9 files changed +112 -163
apps/mobile/src/components/ComposerContextAttachment.tsx
+7 -8
@@ -1,3 +1,4 @@
1 +import { Button } from "./ui/Button";
2 import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
3 import { AsyncResult } from "effect/reactivity";
4 import * as Dialog from "./ui/Dialog";
@@ -118,16 +119,14 @@ export function ComposerContextAttachment(props: {
119 </Text>
120 ) : null}
121 <PresentationSource identifier={shareSourceIdentifier}>
121 - <Pressable
122 - accessibilityRole="button"
122 + <Button
123 + label={sharing ? "Opening attachment…" : "Open or share attachment"}
124 + tone="secondary"
125 disabled={sharing}
126 onPress={() => void share()}
125 - className="rounded-xl bg-subtle p-4"
126 - >
127 - <Text className="text-foreground">
128 - {sharing ? "Opening attachment…" : "Open or share attachment"}
129 - </Text>
130 - </Pressable>
127 + fullWidth
128 + loading={sharing}
129 + />
130 </PresentationSource>
131 {previewOpen && record.kind === "image" && uri ? (
132 <FilePreviewModal
apps/mobile/src/components/ComposerContextSheet.tsx
+22 -31
@@ -1,3 +1,4 @@
1 +import { Button } from "./ui/Button";
2 import * as Dialog from "./ui/Dialog";
3 import { useOpenPullRequest } from "../native/useOpenPullRequest";
4 import { SourceFileSurface } from "../features/files/SourceFileSurface";
@@ -299,18 +300,17 @@ export function ComposerContextSheet(props: {
300 <View className="gap-3">
301 <ContextField label="Thread" value={record.title} />
302 {props.onOpenThread ? (
302 - <Pressable
303 - accessibilityRole="button"
303 + <Button
304 + label="Open thread"
305 + tone="secondary"
306 onPress={() =>
307 props.onOpenThread?.({
308 environmentId: record.environmentId,
309 threadId: record.threadId,
310 })
311 }
310 - className="rounded-xl bg-subtle p-4"
311 - >
312 - <Text className="text-foreground">Open thread</Text>
313 - </Pressable>
312 + fullWidth
313 + />
314 ) : null}
315 </View>
316 ) : null}
@@ -322,13 +322,12 @@ export function ComposerContextSheet(props: {
322 value={props.skillDescription ?? "No description is available for this skill."}
323 />
324 {props.onOpenSkill ? (
325 - <Pressable
326 - accessibilityRole="button"
325 + <Button
326 + label="View instructions"
327 + tone="secondary"
328 onPress={props.onOpenSkill}
328 - className="rounded-xl bg-subtle p-4"
329 - >
330 - <Text className="text-foreground">View instructions</Text>
331 - </Pressable>
329 + fullWidth
330 + />
331 ) : null}
332 </View>
333 ) : null}
@@ -364,31 +363,23 @@ export function ComposerContextSheet(props: {
363 </Pressable>
364 ) : null}
365 {props.onOpenAttachment ? (
367 - <Pressable
368 - accessibilityRole="button"
366 + <Button
367 + label="Open attachment"
368 + tone="secondary"
369 onPress={props.onOpenAttachment}
370 - className="rounded-xl bg-subtle p-4"
371 - >
372 - <Text className="text-foreground">Open attachment</Text>
373 - </Pressable>
370 + fullWidth
371 + />
372 ) : null}
373 {props.onOpenPullRequest && !pullRequestUrl ? (
376 - <Pressable
377 - accessibilityRole="button"
374 + <Button
375 + label="Open pull request"
376 + tone="secondary"
377 onPress={props.onOpenPullRequest}
379 - className="rounded-xl bg-subtle p-4"
380 - >
381 - <Text className="text-foreground">Open pull request</Text>
382 - </Pressable>
378 + fullWidth
379 + />
380 ) : null}
381 {props.onRemove ? (
385 - <Pressable
386 - accessibilityRole="button"
387 - onPress={props.onRemove}
388 - className="rounded-xl bg-subtle p-4"
389 - >
390 - <Text className="text-foreground">Remove from draft</Text>
391 - </Pressable>
382 + <Button label="Remove from draft" tone="secondary" onPress={props.onRemove} fullWidth />
383 ) : null}
384 </ScrollView>
385 </Sheet>
apps/mobile/src/components/FilePreview.tsx
+5 -8
@@ -1,6 +1,7 @@
1 +import { Button } from "./ui/Button";
2 import * as Dialog from "./ui/Dialog";
3 import { useEffect, useEffectEvent } from "react";
3 -import { Modal, Pressable, View } from "react-native";
4 +import { Modal, View } from "react-native";
5 import ImageViewing from "react-native-image-viewing";
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
7
@@ -84,13 +85,9 @@ function DocumentPreview(props: {
85 <Text className="text-foreground-muted" numberOfLines={2}>
86 {name ?? "Document"}
87 </Text>
87 - <Pressable
88 - accessibilityRole="button"
89 - onPress={props.onRequestClose}
90 - className="self-end p-3"
91 - >
92 - <Text className="text-foreground">Cancel</Text>
93 - </Pressable>
88 + <View className="items-end">
89 + <Button label="Cancel" tone="text" onPress={props.onRequestClose} />
90 + </View>
91 </View>
92 </View>
93 </Modal>
apps/mobile/src/features/browser/PreviewStreamWebView.tsx
+28 -52
@@ -1,3 +1,4 @@
1 +import { Button } from "../../components/ui/Button";
2 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
3 import * as Dialog from "../../components/ui/Dialog";
4 import previewStreamScript from "@t3tools/mobile-preview-stream";
@@ -142,13 +143,9 @@ export function PreviewStreamWebView(
143 {error || "Connecting to browser..."}
144 </AppText>
145 {error && (
145 - <Pressable
146 - accessibilityRole="button"
147 - className="rounded-full border border-secondary-border bg-secondary px-6 py-3"
148 - onPress={refresh}
149 - >
150 - <AppText className="text-secondary-foreground">Retry</AppText>
151 - </Pressable>
146 + <View className="items-center">
147 + <Button label="Retry" tone="secondary" onPress={refresh} />
148 + </View>
149 )}
150 </>
151 )}
@@ -335,19 +332,14 @@ function PreviewStreamDocumentView({
332 {previewStreamControlLabel(control)}
333 </AppText>
334 {control?.canOperate ? (
338 - <Pressable
339 - accessibilityRole="button"
335 + <Button
336 + label={control.controller === "you" ? "Release control" : "Take control"}
337 + tone="secondary"
338 disabled={control.controller === "another-viewer"}
341 - accessibilityState={{ disabled: control.controller === "another-viewer" }}
342 - className="rounded-full border border-secondary-border bg-secondary px-3 py-2"
339 onPress={() =>
340 command({ type: control.controller === "you" ? "releaseControl" : "takeControl" })
341 }
346 - >
347 - <AppText className="text-xs text-secondary-foreground">
348 - {control.controller === "you" ? "Release control" : "Take control"}
349 - </AppText>
350 - </Pressable>
342 + />
343 ) : null}
344 </View>
345 ) : null}
@@ -445,22 +437,12 @@ function PreviewStreamDocumentView({
437 The page asks for {fileChooser.multiple ? "files" : "a file"}.
438 </AppText>
439 <View className="flex-row justify-end gap-3">
448 - <Pressable
449 - accessibilityRole="button"
450 - className="px-3 py-2"
451 - onPress={() => answerFileChooser(false)}
452 - >
453 - <AppText className="text-secondary-foreground">Cancel</AppText>
454 - </Pressable>
455 - <Pressable
456 - accessibilityRole="button"
457 - className="px-3 py-2"
440 + <Button label="Cancel" tone="text" onPress={() => answerFileChooser(false)} />
441 + <Button
442 + label={`Choose ${fileChooser.multiple ? "files" : "file"}`}
443 + tone="secondary"
444 onPress={() => answerFileChooser(true)}
459 - >
460 - <AppText className="text-secondary-foreground">
461 - Choose {fileChooser.multiple ? "files" : "file"}
462 - </AppText>
463 - </Pressable>
445 + />
446 </View>
447 </View>
448 ) : null}
@@ -480,16 +462,14 @@ function PreviewStreamDocumentView({
462 />
463 ) : null}
464 <View className="flex-row justify-end gap-3">
483 - <Pressable
484 - accessibilityRole="button"
485 - className="px-3 py-2"
465 + <Button
466 + label="Dismiss"
467 + tone="text"
468 onPress={() => command({ type: "dialog", accept: false })}
487 - >
488 - <AppText className="text-secondary-foreground">Dismiss</AppText>
489 - </Pressable>
490 - <Pressable
491 - accessibilityRole="button"
492 - className="px-3 py-2"
469 + />
470 + <Button
471 + label="Accept"
472 + tone="secondary"
473 onPress={() =>
474 command({
475 type: "dialog",
@@ -497,9 +477,7 @@ function PreviewStreamDocumentView({
477 ...(control.dialog?.type === "prompt" ? { promptText } : {}),
478 })
479 }
500 - >
501 - <AppText className="text-secondary-foreground">Accept</AppText>
502 - </Pressable>
480 + />
481 </View>
482 </>
483 ) : (
@@ -537,15 +515,13 @@ function PreviewStreamDocumentView({
515 </Pressable>
516 ) : null}
517 {status === "error" && !gone && !compact ? (
540 - <Pressable
541 - accessibilityRole="button"
542 - className="rounded-full border border-secondary-border bg-secondary px-6 py-3"
543 - onPress={onRetry}
544 - >
545 - <AppText className="text-secondary-foreground">
546 - {hostSetup ? "Try again" : "Reconnect"}
547 - </AppText>
548 - </Pressable>
518 + <View className="items-center">
519 + <Button
520 + label={hostSetup ? "Try again" : "Reconnect"}
521 + tone="secondary"
522 + onPress={onRetry}
523 + />
524 + </View>
525 ) : null}
526 </View>
527 ) : null}
apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
+7 -14
@@ -1,3 +1,4 @@
1 +import { Button } from "../../components/ui/Button";
2 import * as Dialog from "../../components/ui/Dialog";
3 import {
4 deviceToolVersionLabels,
@@ -270,13 +271,9 @@ function DevicePreviewScreen({
271 <AppText selectable className="text-center text-sm text-foreground-muted">
272 {state.error}
273 </AppText>
273 - <Pressable
274 - accessibilityRole="button"
275 - className="rounded-full border border-secondary-border bg-secondary px-6 py-3"
276 - onPress={state.refresh}
277 - >
278 - <AppText className="text-secondary-foreground">Retry</AppText>
279 - </Pressable>
274 + <View className="items-center">
275 + <Button label="Retry" tone="secondary" onPress={state.refresh} />
276 + </View>
277 </>
278 ) : focused && foreground ? (
279 <AppActivityIndicator color={themeVariables["--color-icon"]} />
@@ -399,13 +396,9 @@ function OpenDevicePreview({
396 <AppText selectable className="text-center text-sm text-foreground-muted">
397 {error}
398 </AppText>
402 - <Pressable
403 - accessibilityRole="button"
404 - className="rounded-full border border-secondary-border bg-secondary px-6 py-3"
405 - onPress={refresh}
406 - >
407 - <AppText className="text-secondary-foreground">Retry</AppText>
408 - </Pressable>
399 + <View className="items-center">
400 + <Button label="Retry" tone="secondary" onPress={refresh} />
401 + </View>
402 </>
403 ) : (
404 <>
apps/mobile/src/features/devices/DeviceStreamWebView.tsx
+5 -8
@@ -1,3 +1,4 @@
1 +import { Button } from "../../components/ui/Button";
2 import deviceStreamScript from "@t3tools/mobile-device-stream";
3 import {
4 useEffect,
@@ -8,7 +9,7 @@ import {
9 useState,
10 type Ref,
11 } from "react";
11 -import { Platform, Pressable, View } from "react-native";
12 +import { Platform, View } from "react-native";
13 import { WebView } from "react-native-webview";
14 import type { DeviceStreamStatus } from "@t3tools/client-runtime/device/stream";
15
@@ -194,13 +195,9 @@ function DeviceStreamDocumentView({
195 {status === "error" ? error : "Connecting to device..."}
196 </AppText>
197 {status === "error" ? (
197 - <Pressable
198 - accessibilityRole="button"
199 - className="rounded-full border border-secondary-border bg-secondary px-6 py-3"
200 - onPress={onRetry}
201 - >
202 - <AppText className="text-secondary-foreground">Reconnect</AppText>
203 - </Pressable>
198 + <View className="items-center">
199 + <Button label="Reconnect" tone="secondary" onPress={onRetry} />
200 + </View>
201 ) : null}
202 </View>
203 ) : null}
apps/mobile/src/features/files/AudioFilePreview.tsx
+17 -24
@@ -1,6 +1,7 @@
1 +import { Button } from "../../components/ui/Button";
2 import { useAudioPlayer, useAudioPlayerStatus } from "expo-audio";
3 import { useEffect, useState } from "react";
3 -import { Pressable, View } from "react-native";
4 +import { View } from "react-native";
5 import { AppText as Text } from "../../components/ui/AppText";
6 import { useFullscreenVideoOpen, useMediaAudioSessionHold } from "../../lib/videoAudioSession";
7
@@ -34,47 +35,39 @@ export function AudioFilePreview(props: { uri: string; onRetry: () => void }) {
35 {timestamp(status.currentTime)} / {timestamp(status.duration)}
36 </Text>
37 <View className="flex-row items-center gap-4">
37 - <Pressable
38 - accessibilityRole="button"
38 + <Button
39 + label="−15s"
40 + tone="text"
41 accessibilityLabel="Back 15 seconds"
42 disabled={!status.isLoaded}
43 onPress={() => seek(Math.max(0, status.currentTime - 15))}
42 - className="p-4"
43 - >
44 - <Text className="text-foreground">−15s</Text>
45 - </Pressable>
46 - <Pressable
47 - accessibilityRole="button"
44 + />
45 + <Button
46 + label={!status.isLoaded ? "Loading…" : status.playing ? "Pause" : "Play"}
47 + tone="secondary"
48 disabled={!status.isLoaded}
49 onPress={() => {
50 if (status.playing) player.pause();
51 else if (status.didJustFinish || status.currentTime >= status.duration) seek(0, true);
52 else player.play();
53 }}
54 - className="rounded-xl bg-subtle px-6 py-4"
55 - >
56 - <Text className="text-foreground">
57 - {!status.isLoaded ? "Loading…" : status.playing ? "Pause" : "Play"}
58 - </Text>
59 - </Pressable>
60 - <Pressable
61 - accessibilityRole="button"
54 + />
55 + <Button
56 + label="+15s"
57 + tone="text"
58 accessibilityLabel="Forward 15 seconds"
59 disabled={!status.isLoaded}
60 onPress={() => seek(Math.min(status.duration, status.currentTime + 15))}
65 - className="p-4"
66 - >
67 - <Text className="text-foreground">+15s</Text>
68 - </Pressable>
61 + />
62 </View>
63 {status.error || seekError ? (
64 <View className="items-center gap-3">
65 <Text className="text-center text-foreground">
66 This audio could not be played. Try again or save it to open in another app.
67 </Text>
75 - <Pressable accessibilityRole="button" onPress={props.onRetry} className="p-3">
76 - <Text className="text-foreground">Try again</Text>
77 - </Pressable>
68 + <View className="items-center">
69 + <Button label="Try again" tone="secondary" onPress={props.onRetry} />
70 + </View>
71 </View>
72 ) : null}
73 </View>
apps/mobile/src/features/files/FileTreeBrowser.tsx
+9 -8
@@ -1,3 +1,4 @@
1 +import { Button } from "../../components/ui/Button";
2 import { LegendList } from "@legendapp/list/react-native";
3 import type { ProjectEntry } from "@t3tools/contracts";
4 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
@@ -264,14 +265,14 @@ export function FileTreeBrowser(props: {
265 >
266 {props.error}
267 </Text>
267 - <Pressable
268 - accessibilityRole="button"
269 - onPress={props.onRefresh}
270 - disabled={props.isPending}
271 - className="mt-3 min-h-11 self-start justify-center rounded-full bg-subtle px-4 active:opacity-70 disabled:opacity-50"
272 - >
273 - <Text className="text-sm font-t3-medium text-foreground">Try again</Text>
274 - </Pressable>
268 + <View className="mt-3">
269 + <Button
270 + label="Try again"
271 + tone="secondary"
272 + onPress={props.onRefresh}
273 + disabled={props.isPending}
274 + />
275 + </View>
276 </>
277 ) : props.isPending ? (
278 <AppActivityIndicator size="small" />
apps/mobile/src/features/threads/McpAppWebView.tsx
+12 -10
@@ -1,3 +1,4 @@
1 +import { Button } from "../../components/ui/Button";
2 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
3 import * as Dialog from "../../components/ui/Dialog";
4 import type { EnvironmentId, ThreadId, TurnItemId } from "@t3tools/contracts";
@@ -23,7 +24,7 @@ import * as Predicate from "effect/Predicate";
24 import Constants from "expo-constants";
25 import { useNavigation } from "@react-navigation/native";
26 import { useEffect, useMemo, useRef, useState } from "react";
26 -import { Platform, Pressable, View } from "react-native";
27 +import { Platform, View } from "react-native";
28 import { useSafeAreaInsets } from "react-native-safe-area-context";
29 import { WebView, type WebViewMessageEvent } from "react-native-webview";
30
@@ -490,15 +491,16 @@ export function ThreadMcpApp(props: {
491 className="items-center justify-center gap-2 rounded-lg border border-border"
492 >
493 <Text className="text-sm text-foreground-muted">The {app.server} app was closed</Text>
493 - <Pressable
494 - accessibilityRole="button"
495 - onPress={() => {
496 - setDocumentKey((value) => value + 1);
497 - setClosed(false);
498 - }}
499 - >
500 - <Text className="text-sm text-foreground">Show app</Text>
501 - </Pressable>
494 + <View className="items-center">
495 + <Button
496 + label="Show app"
497 + tone="secondary"
498 + onPress={() => {
499 + setDocumentKey((value) => value + 1);
500 + setClosed(false);
501 + }}
502 + />
503 + </View>
504 </View>
505 );
506 }