import React, { useCallback } from 'react'; import { Text, Dialog } from '@anthropic/ink'; import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js'; import { isSupportedTerminal } from '../utils/ide.js'; import { Select } from './CustomSelect/index.js'; type IdeAutoConnectDialogProps = { onComplete: () => void; }; export function IdeAutoConnectDialog({ onComplete }: IdeAutoConnectDialogProps): React.ReactNode { const handleSelect = useCallback( async (value: string) => { const autoConnect = value === 'yes'; // Save the preference and mark dialog as shown saveGlobalConfig(current => ({ ...current, autoConnectIde: autoConnect, hasIdeAutoConnectDialogBeenShown: true, })); onComplete(); }, [onComplete], ); const options = [ { label: 'Yes', value: 'yes' }, { label: 'No', value: 'no' }, ]; return ( ); } export function shouldShowDisableAutoConnectDialog(): boolean { const config = getGlobalConfig(); return !isSupportedTerminal() && config.autoConnectIde === true; }