@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 63 lines 1.98 KB
Raw
1 import { useGT } from "gt-react-native";
2 import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
3 import Animated, { FadeIn, FadeOut, ReduceMotion } from "react-native-reanimated";
4 import { Toast } from "../../components/ui/Toast";
5 import { useBarInset } from "../../components/ui/useBarInset";
6 import { MOBILE_MOTION } from "../../lib/designTokens";
7 import type { GitActionProgress } from "../../state/use-vcs-action-state";
8
9 export function GitActionProgressOverlay(props: {
10 readonly progress: GitActionProgress;
11 readonly onDismiss: () => void;
12 readonly onOpenPullRequest?: (url: string) => Promise<boolean>;
13 }) {
14 const gt = useGT();
15 const { progress, onDismiss } = props;
16 const openPullRequest = props.onOpenPullRequest;
17 const top = useBarInset() + 8;
18 const handlePress = () => {
19 if (progress.prUrl) {
20 void (openPullRequest
21 ? openPullRequest(progress.prUrl)
22 : tryOpenExternalUrl(progress.prUrl, "pull-request"));
23 return;
24 }
25 };
26
27 if (progress.phase === "idle") {
28 return null;
29 }
30
31 return (
32 <Animated.View
33 entering={FadeIn.duration(MOBILE_MOTION.enter).reduceMotion(ReduceMotion.System)}
34 exiting={FadeOut.duration(MOBILE_MOTION.exit).reduceMotion(ReduceMotion.System)}
35 className="absolute inset-x-3 z-[100]"
36 style={{ top }}
37 pointerEvents="box-none"
38 onAccessibilityEscape={onDismiss}
39 >
40 <Toast
41 singleLine
42 message={progress.label ?? gt("Source control")}
43 description={progress.description ?? undefined}
44 tone={
45 progress.phase === "error"
46 ? "danger"
47 : progress.phase === "success"
48 ? "success"
49 : "default"
50 }
51 busy={progress.phase === "running"}
52 action={
53 progress.prUrl
54 ? {
55 label: gt("View", { $context: "verb, opens the pull request" }),
56 onPress: handlePress,
57 }
58 : undefined
59 }
60 />
61 </Animated.View>
62 );
63 }