({
onDone
}: Props)
| 11 | onDone: (selection: RemoteCalloutSelection) => void; |
| 12 | }; |
| 13 | export function RemoteCallout({ |
| 14 | onDone |
| 15 | }: Props): React.ReactNode { |
| 16 | const onDoneRef = useRef(onDone); |
| 17 | onDoneRef.current = onDone; |
| 18 | const handleCancel = useCallback((): void => { |
| 19 | onDoneRef.current('dismiss'); |
| 20 | }, []); |
| 21 | |
| 22 | // Permanently mark as seen on mount so it only shows once |
| 23 | useEffect(() => { |
| 24 | saveGlobalConfig(current => { |
| 25 | if (current.remoteDialogSeen) return current; |
| 26 | return { |
| 27 | ...current, |
| 28 | remoteDialogSeen: true |
| 29 | }; |
| 30 | }); |
| 31 | }, []); |
| 32 | const handleSelect = useCallback((value: RemoteCalloutSelection): void => { |
| 33 | onDoneRef.current(value); |
| 34 | }, []); |
| 35 | const options: OptionWithDescription<RemoteCalloutSelection>[] = [{ |
| 36 | label: 'Enable Remote Control for this session', |
| 37 | description: 'Opens a secure connection to claude.ai.', |
| 38 | value: 'enable' |
| 39 | }, { |
| 40 | label: 'Never mind', |
| 41 | description: 'You can always enable it later with /remote-control.', |
| 42 | value: 'dismiss' |
| 43 | }]; |
| 44 | return <PermissionDialog title="Remote Control"> |
| 45 | <Box flexDirection="column" paddingX={2} paddingY={1}> |
| 46 | <Box marginBottom={1} flexDirection="column"> |
| 47 | <Text> |
| 48 | Remote Control lets you access this CLI session from the web |
| 49 | (claude.ai/code) or the Claude app, so you can pick up where you |
| 50 | left off on any device. |
| 51 | </Text> |
| 52 | <Text> </Text> |
| 53 | <Text> |
| 54 | You can disconnect remote access anytime by running /remote-control |
| 55 | again. |
| 56 | </Text> |
| 57 | </Box> |
| 58 | <Box> |
| 59 | <Select options={options} onChange={handleSelect} onCancel={handleCancel} /> |
| 60 | </Box> |
| 61 | </Box> |
| 62 | </PermissionDialog>; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Check whether to show the remote callout (first-time dialog). |
nothing calls this directly
no test coverage detected