diff --git a/client/app/bundles/course/assessment/submission/pages/SubmissionEditIndex/components/button/RunCodeButton.tsx b/client/app/bundles/course/assessment/submission/pages/SubmissionEditIndex/components/button/RunCodeButton.tsx index b8207b7843..dadf3d546b 100644 --- a/client/app/bundles/course/assessment/submission/pages/SubmissionEditIndex/components/button/RunCodeButton.tsx +++ b/client/app/bundles/course/assessment/submission/pages/SubmissionEditIndex/components/button/RunCodeButton.tsx @@ -1,6 +1,8 @@ import { FC } from 'react'; import { useFormContext } from 'react-hook-form'; -import { Button } from '@mui/material'; +import Hotkeys from 'react-hot-keys'; +import { FormattedMessage } from 'react-intl'; +import { Button, Tooltip } from '@mui/material'; import { submitAnswer } from 'course/assessment/submission/actions/answers'; import { getQuestionFlags } from 'course/assessment/submission/selectors/questionFlags'; @@ -47,25 +49,40 @@ const RunCodeButton: FC = (props) => { }); }; + const isDisabled = + isAutograding || + isResetting || + isSaving || + (!graderView && attemptsLeft === 0); + return ( - + <> + true} + keyName="command+shift+enter,control+shift+enter" + onKeyDown={() => onSubmitAnswer()} + /> + } + > + + + ); }; diff --git a/client/app/bundles/course/assessment/submission/translations.ts b/client/app/bundles/course/assessment/submission/translations.ts index 1839a14ed2..e1ef4feb71 100644 --- a/client/app/bundles/course/assessment/submission/translations.ts +++ b/client/app/bundles/course/assessment/submission/translations.ts @@ -120,6 +120,10 @@ const translations = defineMessages({ id: 'course.assessment.submission.runCode', defaultMessage: 'Run Code', }, + runCodeTooltip: { + id: 'course.assessment.submission.runCodeShortcut', + defaultMessage: '(Ctrl+Shift+Enter) or (⌘+Shift+Enter)', + }, runCodeWithLimit: { id: 'course.assessment.submission.runCodeWithLimit', defaultMessage: