Skip to content

Commit 2d698d8

Browse files
feat: course unenroll is configureable and its slot is added
1 parent aaf2e36 commit 2d698d8

File tree

11 files changed

+42
-8
lines changed

11 files changed

+42
-8
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ CAREER_LINK_URL=''
4242
ENABLE_EDX_PERSONAL_DASHBOARD=false
4343
ENABLE_PROGRAMS=false
4444
NON_BROWSABLE_COURSES=false
45+
SHOW_UNENROLL_SURVEY=false
4546
# Fallback in local style files
4647
PARAGON_THEME_URLS={}

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ CAREER_LINK_URL=''
4848
ENABLE_EDX_PERSONAL_DASHBOARD=false
4949
ENABLE_PROGRAMS=false
5050
NON_BROWSABLE_COURSES=false
51+
SHOW_UNENROLL_SURVEY=false
5152
# Fallback in local style files
5253
PARAGON_THEME_URLS={}

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ CAREER_LINK_URL=''
4747
ENABLE_EDX_PERSONAL_DASHBOARD=true
4848
ENABLE_PROGRAMS=false
4949
NON_BROWSABLE_COURSES=false
50+
SHOW_UNENROLL_SURVEY=true
5051
PARAGON_THEME_URLS={}

example.env.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ module.exports = {
7070
ENABLE_NOTICES: '',
7171
CAREER_LINK_URL: '',
7272
EXPERIMENT_08_23_VAN_PAINTED_DOOR: true,
73+
SHOW_UNENROLL_SURVEY: true
7374
};

src/config/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const configuration = {
2121
SEARCH_CATALOG_URL: process.env.SEARCH_CATALOG_URL || null,
2222
ENABLE_PROGRAMS: process.env.ENABLE_PROGRAMS === 'true',
2323
NON_BROWSABLE_COURSES: process.env.NON_BROWSABLE_COURSES === 'true',
24+
SHOW_UNENROLL_SURVEY: process.env.SHOW_UNENROLL_SURVEY === 'true',
2425
};
2526

2627
const features = {};

src/containers/UnenrollConfirmModal/components/ReasonPane.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export const ReasonPane = ({
5050
</>
5151
);
5252
};
53-
ReasonPane.propTypes = {
54-
reason: PropTypes.shape({
53+
54+
export const reasonShape = PropTypes.shape({
5555
value: PropTypes.string,
5656
hasReason: PropTypes.bool,
5757
selectOption: PropTypes.func,
@@ -61,7 +61,10 @@ ReasonPane.propTypes = {
6161
}),
6262
selected: PropTypes.string,
6363
handleSubmit: PropTypes.func.isRequired,
64-
}).isRequired,
64+
})
65+
66+
ReasonPane.propTypes = {
67+
reason: reasonShape.isRequired,
6568
handleClose: PropTypes.func.isRequired,
6669
};
6770

src/containers/UnenrollConfirmModal/hooks/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
import { getConfig } from '@edx/frontend-platform';
2+
13
import React from 'react';
24

35
import { StrictDict } from 'utils';
46
import { apiHooks } from 'hooks';
57

68
import { useUnenrollReasons } from './reasons';
79
import * as module from '.';
10+
import { configuration } from 'config';
811

912
export const state = StrictDict({
1013
confirmed: (val) => React.useState(val), // eslint-disable-line
@@ -24,7 +27,7 @@ export const useUnenrollData = ({ closeModal, cardId }) => {
2427

2528
let modalState;
2629
if (isConfirmed) {
27-
modalState = (reason.isSubmitted)
30+
modalState = (reason.isSubmitted || !configuration.SHOW_UNENROLL_SURVEY)
2831
? modalStates.finished : modalStates.reason;
2932
} else {
3033
modalState = modalStates.confirm;

src/containers/UnenrollConfirmModal/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { ModalDialog } from '@openedx/paragon';
77
import { nullMethod } from 'utils';
88

99
import ConfirmPane from './components/ConfirmPane';
10-
import ReasonPane from './components/ReasonPane';
1110
import FinishedPane from './components/FinishedPane';
1211

1312
import { useUnenrollData, modalStates } from './hooks';
13+
import CourseUnenrollReasonSlot from 'plugin-slots/CourseUnenrollReasonSlot';
1414

1515
export const UnenrollConfirmModal = ({
1616
closeModal,
@@ -44,7 +44,7 @@ export const UnenrollConfirmModal = ({
4444
<FinishedPane handleClose={closeAndRefresh} cardId={cardId} />
4545
)}
4646
{(modalState === modalStates.reason) && (
47-
<ReasonPane reason={reason} handleClose={close} />
47+
<CourseUnenrollReasonSlot reason={reason} close={close} />
4848
)}
4949
</div>
5050
</ModalDialog>

src/plugin-slots/CourseListSlot/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This slot is used for replacing or adding content around the `CourseList` compon
1515

1616
## Example
1717

18-
The space will show the `CourseList` component by default. This can be disabled in the configuration with the `keepDefault` boolean.
18+
The space will show the `CourseList` component by default. This can be disabled in the configuration with the `keepDefault` boolean.
1919

2020
![Screenshot of the CourseListSlot](./images/course_list_slot.png)
2121

@@ -60,4 +60,4 @@ const config = {
6060
}
6161

6262
export default config;
63-
```
63+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Course Unenroll Slot

0 commit comments

Comments
 (0)