MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / BridgeDialog

Function BridgeDialog

src/components/BridgeDialog.tsx:26–152  ·  view source on GitHub ↗
({ onDone }: Props)

Source from the content-addressed store, hash-verified

24};
25
26export function BridgeDialog({ onDone }: Props): React.ReactNode {
27 useRegisterOverlay('bridge-dialog');
28
29 const connected = useAppState(s => s.replBridgeConnected);
30 const sessionActive = useAppState(s => s.replBridgeSessionActive);
31 const reconnecting = useAppState(s => s.replBridgeReconnecting);
32 const connectUrl = useAppState(s => s.replBridgeConnectUrl);
33 const sessionUrl = useAppState(s => s.replBridgeSessionUrl);
34 const error = useAppState(s => s.replBridgeError);
35 const explicit = useAppState(s => s.replBridgeExplicit);
36 const environmentId = useAppState(s => s.replBridgeEnvironmentId);
37 const sessionId = useAppState(s => s.replBridgeSessionId);
38 const verbose = useAppState(s => s.verbose);
39 const setAppState = useSetAppState();
40
41 const [showQR, setShowQR] = useState(false);
42 const [qrText, setQrText] = useState('');
43 const [branchName, setBranchName] = useState('');
44
45 const repoName = basename(getOriginalCwd());
46
47 // Fetch branch name on mount
48 useEffect(() => {
49 getBranch()
50 .then(setBranchName)
51 .catch(() => {});
52 }, []);
53
54 // The URL to display/QR: session URL when connected, connect URL when ready
55 const displayUrl = sessionActive ? sessionUrl : connectUrl;
56
57 // Generate QR code when URL changes or QR is toggled on
58 useEffect(() => {
59 if (!showQR || !displayUrl) {
60 setQrText('');
61 return;
62 }
63 qrToString(displayUrl, {
64 type: 'terminal',
65 errorCorrectionLevel: 'L',
66 small: true,
67 })
68 .then(setQrText)
69 .catch(() => setQrText(''));
70 }, [showQR, displayUrl]);
71
72 useKeybindings(
73 {
74 'confirm:yes': onDone,
75 'confirm:toggle': () => {
76 setShowQR(prev => !prev);
77 },
78 },
79 { context: 'Confirmation' },
80 );
81
82 useInput(input => {
83 if (input === 'd') {

Callers

nothing calls this directly

Calls 14

useInputFunction · 0.90
useRegisterOverlayFunction · 0.85
useAppStateFunction · 0.85
useSetAppStateFunction · 0.85
getOriginalCwdFunction · 0.85
getBranchFunction · 0.85
useKeybindingsFunction · 0.85
saveGlobalConfigFunction · 0.85
getBridgeStatusFunction · 0.85
buildActiveFooterTextFunction · 0.85
buildIdleFooterTextFunction · 0.85
setAppStateFunction · 0.50

Tested by

no test coverage detected