diff --git a/source/wizards/steps/provider-step.tsx b/source/wizards/steps/provider-step.tsx index ae612011..9fb24f49 100644 --- a/source/wizards/steps/provider-step.tsx +++ b/source/wizards/steps/provider-step.tsx @@ -41,6 +41,8 @@ interface TemplateOption { value: string; } +const DONE_SHORTCUT_KEY = 'd'; + /** * Find the best matching template for an existing provider config. * Match by id, name, or baseUrl — then fall back to custom. @@ -155,13 +157,11 @@ export function ProviderStep({ {label: 'Add custom provider manually', value: 'custom'}, ]; - const getTemplateOptions = (): TemplateOption[] => [ - ...PROVIDER_TEMPLATES.map(template => ({ + const getTemplateOptions = (): TemplateOption[] => + PROVIDER_TEMPLATES.map(template => ({ label: template.name, value: template.id, - })), - ...(providers.length > 0 ? [{label: 'Done & Save', value: 'done'}] : []), - ]; + })); const editOptions: TemplateOption[] = providers.map((provider, index) => ({ label: provider.name, @@ -190,11 +190,6 @@ export function ProviderStep({ }; const handleTemplateSelect = (item: TemplateOption) => { - if (item.value === 'done') { - onComplete(providers); - return; - } - // Adding new provider const template = PROVIDER_TEMPLATES.find(t => t.id === item.value); if (template) { @@ -509,7 +504,21 @@ export function ProviderStep({ setMode('field-input'); }; - useInput((_input, key) => { + useInput((input, key) => { + // "Done & Save" shortcut + if ( + mode === 'template-selection' && + providers.length > 0 && + typeof input === 'string' && + input.length > 0 && + input.toLowerCase() === DONE_SHORTCUT_KEY && + !key.ctrl && + !key.meta + ) { + onComplete(providers); + return; + } + // Handle Shift+Tab for going back if (key.shift && key.tab) { if (mode === 'field-input') { @@ -611,6 +620,13 @@ export function ProviderStep({ items={getTemplateOptions()} onSelect={(item: TemplateOption) => handleTemplateSelect(item)} /> + {providers.length > 0 && ( + + + Done is always available: press {DONE_SHORTCUT_KEY} + + + )} ); }