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
| 1 | import { useGT } from "gt-react-native"; |
| 2 | import { AppText as Text } from "../../components/ui/AppText"; |
| 3 | import { cn } from "../../lib/cn"; |
| 4 | import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic"; |
| 5 | |
| 6 | export function ConnectionTraceId({ |
| 7 | traceId, |
| 8 | tone = "muted", |
| 9 | activation = "press", |
| 10 | }: { |
| 11 | readonly traceId: string; |
| 12 | readonly tone?: "muted" | "danger"; |
| 13 | readonly activation?: "press" | "longPress"; |
| 14 | }) { |
| 15 | const gt = useGT(); |
| 16 | const copy = () => copyTextWithHaptic(traceId, { target: "connection-trace-id" }); |
| 17 | return ( |
| 18 | <> |
| 19 | {" "} |
| 20 | {gt("Trace ID:")}{" "} |
| 21 | <Text |
| 22 | accessibilityHint={ |
| 23 | activation === "longPress" |
| 24 | ? gt("Long press to copy the trace ID") |
| 25 | : gt("Copies the trace ID") |
| 26 | } |
| 27 | accessibilityLabel={gt("Copy trace ID {traceId}", { traceId })} |
| 28 | accessibilityRole="button" |
| 29 | accessibilityActions={[{ name: "activate", label: gt("Copy trace ID") }]} |
| 30 | onAccessibilityAction={(event) => { |
| 31 | event.stopPropagation(); |
| 32 | if (event.nativeEvent.actionName === "activate") copy(); |
| 33 | }} |
| 34 | className={cn( |
| 35 | "underline decoration-dotted", |
| 36 | tone === "danger" ? "text-danger-foreground" : "text-foreground-muted", |
| 37 | )} |
| 38 | onLongPress={ |
| 39 | activation === "longPress" |
| 40 | ? (event) => { |
| 41 | event.stopPropagation(); |
| 42 | copy(); |
| 43 | } |
| 44 | : undefined |
| 45 | } |
| 46 | onPress={(event) => { |
| 47 | event.stopPropagation(); |
| 48 | if (activation === "press") copy(); |
| 49 | }} |
| 50 | > |
| 51 | {traceId} |
| 52 | </Text> |
| 53 | </> |
| 54 | ); |
| 55 | } |