diff --git a/src/components/course/EnrollButton.jsx b/src/components/course/EnrollButton.jsx
index a03519943b..dc5a4937ec 100644
--- a/src/components/course/EnrollButton.jsx
+++ b/src/components/course/EnrollButton.jsx
@@ -10,7 +10,10 @@ import { CourseContext } from './CourseContextProvider';
import EnrollButtonLabel from './EnrollButtonLabel';
import EnrollModal from './EnrollModal';
+import { features } from '../../config';
+
import { useCourseEnrollmentUrl } from './data/hooks';
+
import {
hasCourseStarted,
findUserEnrollmentForCourse,
@@ -108,20 +111,48 @@ export default function EnrollButton() {
);
+ const enrollBtnDisabled = (
+
+ );
+
const enrollLinkClass = 'btn-block';
if (!userEnrollment && isEnrollable) {
// enroll with a subscription license
if (enrollmentUrl && subscriptionLicense) {
+ if (userSubsidy) {
+ return (
+
+ );
+ }
+ // no user subsidy means we need to warn user with a dialog
return (
-
+ <>
+ setIsModalOpen(true)}
+ />
+
+ >
);
}
// enroll with an offer (code)
+ if (!features.ENROLL_WITH_CODES) { // can't do offer based enrollment yet without switch
+ return enrollBtnDisabled;
+ }
if (enrollmentUrl) {
return (
<>
@@ -146,12 +177,7 @@ export default function EnrollButton() {
}
if (!userEnrollment && !isEnrollable) {
- return (
-
- );
+ return enrollBtnDisabled;
}
if (userEnrollment) {