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