({ onDone }: Props)
| 22 | | undefined |
| 23 | |
| 24 | export function RemoteCallout({ onDone }: Props): React.ReactNode { |
| 25 | const onDoneRef = useRef(onDone) |
| 26 | onDoneRef.current = onDone |
| 27 | |
| 28 | const handleCancel = useCallback((): void => { |
| 29 | onDoneRef.current('dismiss') |
| 30 | }, []) |
| 31 | |
| 32 | // Permanently mark as seen on mount so it only shows once. |
| 33 | useEffect(() => { |
| 34 | saveGlobalConfig(current => { |
| 35 | if (current.remoteDialogSeen) return current |
| 36 | return { |
| 37 | ...current, |
| 38 | remoteDialogSeen: true, |
| 39 | } |
| 40 | }) |
| 41 | }, []) |
| 42 | |
| 43 | const handleSelect = useCallback((value: RemoteCalloutSelection): void => { |
| 44 | onDoneRef.current(value) |
| 45 | }, []) |
| 46 | |
| 47 | const options: OptionWithDescription<RemoteCalloutSelection>[] = [ |
| 48 | { |
| 49 | label: 'Enable Remote Control for this session', |
| 50 | description: |
| 51 | 'Opens a secure connection to the Noumena remote session service.', |
| 52 | value: 'enable', |
| 53 | }, |
| 54 | { |
| 55 | label: 'Never mind', |
| 56 | description: 'You can always enable it later with /remote-control.', |
| 57 | value: 'dismiss', |
| 58 | }, |
| 59 | ] |
| 60 | |
| 61 | return ( |
| 62 | <PermissionDialog title="Remote Control"> |
| 63 | <Box flexDirection="column" paddingX={2} paddingY={1}> |
| 64 | <Box marginBottom={1} flexDirection="column"> |
| 65 | <Text> |
| 66 | Remote Control lets you access this CLI session from the web app or |
| 67 | desktop app, so you can pick up where you left off on any device. |
| 68 | </Text> |
| 69 | <Text> </Text> |
| 70 | <Text> |
| 71 | You can disconnect remote access anytime by running /remote-control |
| 72 | again. |
| 73 | </Text> |
| 74 | </Box> |
| 75 | <Box> |
| 76 | <Select |
| 77 | options={options} |
| 78 | onChange={handleSelect} |
| 79 | onCancel={handleCancel} |
| 80 | /> |
| 81 | </Box> |
nothing calls this directly
no test coverage detected