Add button to submit exam without approval process

This commit is contained in:
Joao Correia
2025-02-09 17:37:19 +00:00
parent 9ae6b8e894
commit 75b4643918
8 changed files with 47 additions and 25 deletions

View File

@@ -19,7 +19,7 @@ interface SettingsEditorProps {
children?: ReactNode;
canPreview: boolean;
canSubmit: boolean;
submitModule: () => void;
submitModule: (requiresApproval: boolean) => void;
preview: () => void;
}
@@ -148,19 +148,31 @@ const SettingsEditor: React.FC<SettingsEditorProps> = ({
</div>
</Dropdown>
{children}
<div className="flex flex-row justify-between mt-4">
<div className="flex flex-col gap-3 mt-4">
<button
className={clsx(
"flex items-center justify-center px-4 py-2 text-white rounded-xl transition-colors duration-300",
`bg-ielts-${module}/70 border border-ielts-${module} hover:bg-ielts-${module} disabled:bg-ielts-${module}/30`,
"disabled:cursor-not-allowed disabled:text-gray-200"
)}
onClick={submitModule}
onClick={() => submitModule(true)}
disabled={!canSubmit}
>
<FaFileUpload className="mr-2" size={18} />
Submit Module as Exam
</button>
<button
className={clsx(
"flex items-center justify-center px-4 py-2 text-white rounded-xl transition-colors duration-300",
`bg-ielts-${module}/70 border border-ielts-${module} hover:bg-ielts-${module} disabled:bg-ielts-${module}/30`,
"disabled:cursor-not-allowed disabled:text-gray-200"
)}
onClick={() => submitModule(false)}
disabled={!canSubmit}
>
<FaFileUpload className="mr-2" size={18} />
Submit Module as Exam Without Approval Process
</button>
<button
className={clsx(
"flex items-center justify-center px-4 py-2 text-white rounded-xl transition-colors duration-300",

View File

@@ -76,7 +76,7 @@ const LevelSettings: React.FC = () => {
});
});
const submitLevel = async () => {
const submitLevel = async (requiresApproval: boolean) => {
if (title === "") {
toast.error("Enter a title for the exam!");
return;
@@ -195,7 +195,8 @@ const LevelSettings: React.FC = () => {
category: s.settings.category
};
}).filter(part => part.exercises.length > 0),
isDiagnostic: true, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
requiresApproval: requiresApproval,
isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
minTimer,
module: "level",
id: title,

View File

@@ -65,7 +65,7 @@ const ListeningSettings: React.FC = () => {
}
];
const submitListening = async () => {
const submitListening = async (requiresApproval: boolean) => {
if (title === "") {
toast.error("Enter a title for the exam!");
return;
@@ -138,7 +138,8 @@ const ListeningSettings: React.FC = () => {
category: s.settings.category
};
}),
isDiagnostic: true, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
requiresApproval: requiresApproval,
isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
minTimer,
module: "listening",
id: title,

View File

@@ -60,7 +60,7 @@ const ReadingSettings: React.FC = () => {
(s.state as ReadingPart).exercises.length > 0
);
const submitReading = () => {
const submitReading = (requiresApproval: boolean) => {
if (title === "") {
toast.error("Enter a title for the exam!");
return;
@@ -74,7 +74,8 @@ const ReadingSettings: React.FC = () => {
category: localSettings.category,
};
}),
isDiagnostic: true, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
requiresApproval: requiresApproval,
isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
minTimer,
module: "reading",
id: title,

View File

@@ -84,7 +84,7 @@ const SpeakingSettings: React.FC = () => {
});
})();
const submitSpeaking = async () => {
const submitSpeaking = async (requiresApproval: boolean) => {
if (title === "") {
toast.error("Enter a title for the exam!");
return;
@@ -181,7 +181,8 @@ const SpeakingSettings: React.FC = () => {
minTimer,
module: "speaking",
id: title,
isDiagnostic: true, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
requiresApproval: requiresApproval,
isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
variant: undefined,
difficulty,
instructorGender: "varied",

View File

@@ -88,7 +88,7 @@ const WritingSettings: React.FC = () => {
openDetachedTab("popout?type=Exam&module=writing", router)
}
const submitWriting = async () => {
const submitWriting = async (requiresApproval: boolean) => {
if (title === "") {
toast.error("Enter a title for the exam!");
return;
@@ -131,7 +131,8 @@ const WritingSettings: React.FC = () => {
minTimer,
module: "writing",
id: title,
isDiagnostic: true, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
requiresApproval: requiresApproval,
isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed.
variant: undefined,
difficulty,
access,