All checks pass. The implementation is complete. (#1403)

**Summary:** Added CMD+Enter keyboard shortcut to the CreateAttemptDialog by:

1. Importing `useKeySubmitTask` and `Scope` from `@/keyboard`
2. Adding the `useKeySubmitTask` hook that calls `handleCreate` when:
   - The dialog is visible (`modal.visible`)
   - Creation is allowed (`canCreate` - profile and branch selected, not loading, not already creating)

This follows the same pattern used in other dialogs like `RestoreLogsDialog.tsx`.
This commit is contained in:
Louis Knight-Webb
2025-12-01 14:53:05 -05:00
committed by GitHub
parent e616bc3ee8
commit 2a9655465c

View File

@@ -26,6 +26,7 @@ import { paths } from '@/lib/paths';
import NiceModal, { useModal } from '@ebay/nice-modal-react';
import { defineModal } from '@/lib/modals';
import type { ExecutorProfileId, BaseCodingAgent } from 'shared/types';
import { useKeySubmitTask, Scope } from '@/keyboard';
export interface CreateAttemptDialogProps {
taskId: string;
@@ -157,6 +158,12 @@ const CreateAttemptDialogImpl = NiceModal.create<CreateAttemptDialogProps>(
if (!open) modal.hide();
};
useKeySubmitTask(handleCreate, {
enabled: modal.visible && canCreate,
scope: Scope.DIALOG,
preventDefault: true,
});
return (
<Dialog open={modal.visible} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[500px]">