Skip to content

Commit a10f938

Browse files
committed
refactor: removing unnecessary bulk email form and changing paragon dependency
1 parent f2716f0 commit a10f938

File tree

22 files changed

+56
-782
lines changed

22 files changed

+56
-782
lines changed

plugins/communications-app/BodyForm/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Form } from '@edx/paragon';
2+
import { Form } from '@openedx/paragon';
33
import { useIntl } from '@edx/frontend-platform/i18n';
44
import TextEditor from '@communications-app/src/components/bulk-email-tool/text-editor/TextEditor';
55
import { useSelector, useDispatch } from '@communications-app/src/components/bulk-email-tool/bulk-email-form/BuildEmailFormExtensible/context';

plugins/communications-app/BodyForm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"peerDependencies": {
99
"@edx/frontend-app-communications": "*",
1010
"@edx/frontend-platform": "*",
11-
"@edx/paragon": "*",
11+
"@openedx/paragon": "*",
1212
"prop-types": "*",
1313
"react": "*"
1414
},

plugins/communications-app/CheckBoxForm/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import PropTypes from 'prop-types';
2-
import { Form, Container } from '@edx/paragon';
2+
import { Form, Container } from '@openedx/paragon';
33

44
const CheckBoxForm = ({ isChecked, handleChange, label }) => (
55
<Container className="my-4 border border-success-300 p-4">

plugins/communications-app/CheckBoxForm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"peerDependencies": {
99
"@edx/frontend-app-communications": "*",
1010
"@edx/frontend-platform": "*",
11-
"@edx/paragon": "*",
11+
"@openedx/paragon": "*",
1212
"prop-types": "*",
1313
"react": "*"
1414
},

plugins/communications-app/InputForm/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import PropTypes from 'prop-types';
2-
import { Form, Container } from '@edx/paragon';
2+
import { Form, Container } from '@openedx/paragon';
33

44
const InputForm = ({
55
isValid,

plugins/communications-app/InputForm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"peerDependencies": {
99
"@edx/frontend-app-communications": "*",
1010
"@edx/frontend-platform": "*",
11-
"@edx/paragon": "*",
11+
"@openedx/paragon": "*",
1212
"prop-types": "*",
1313
"react": "*"
1414
},

plugins/communications-app/InstructionsProfreading/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"peerDependencies": {
99
"@edx/frontend-app-communications": "*",
1010
"@edx/frontend-platform": "*",
11-
"@edx/paragon": "*",
11+
"@openedx/paragon": "*",
1212
"prop-types": "*",
1313
"react": "*"
1414
},

plugins/communications-app/RecipientsForm/index.jsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import PropTypes from 'prop-types';
3-
import { Form } from '@edx/paragon';
3+
import { Form } from '@openedx/paragon';
44
import { FormattedMessage } from '@edx/frontend-platform/i18n';
55
import { useSelector, useDispatch } from '@communications-app/src/components/bulk-email-tool/bulk-email-form/BuildEmailFormExtensible/context';
66
import { actionCreators as formActions } from '@communications-app/src/components/bulk-email-tool/bulk-email-form/BuildEmailFormExtensible/context/reducer';
@@ -10,10 +10,11 @@ import './styles.scss';
1010
const disableIsHasLearners = ['track', 'cohort'];
1111
const recipientsFormDescription = 'A selectable choice from a list of potential email recipients';
1212

13-
const RecipientsForm = ({ cohorts: additionalCohorts }) => {
13+
const RecipientsForm = ({ cohorts: additionalCohorts, courseModes }) => {
1414
const formData = useSelector((state) => state.form);
1515
const dispatch = useDispatch();
1616
const { isEditMode, emailRecipients, isFormSubmitted } = formData;
17+
const hasCourseModes = courseModes.length > 1;
1718

1819
const [selectedGroups, setSelectedGroups] = useState([]);
1920
const hasAllLearnersSelected = selectedGroups.some((group) => group === 'learners');
@@ -91,6 +92,24 @@ const RecipientsForm = ({ cohorts: additionalCohorts }) => {
9192
description={recipientsFormDescription}
9293
/>
9394
</Form.Checkbox>
95+
{
96+
// additional modes
97+
hasCourseModes
98+
&& courseModes.map((courseMode) => (
99+
<Form.Checkbox
100+
key={`track:${courseMode.slug}`}
101+
value={`track:${courseMode.slug}`}
102+
disabled={hasAllLearnersSelected}
103+
className="col col-lg-4 col-sm-6 col-12"
104+
>
105+
<FormattedMessage
106+
id="bulk.email.form.mode.label"
107+
defaultMessage="Learners in the {courseModeName} Track"
108+
values={{ courseModeName: courseMode.name }}
109+
/>
110+
</Form.Checkbox>
111+
))
112+
}
94113
{
95114
// additional cohorts
96115
additionalCohorts
@@ -152,10 +171,17 @@ const RecipientsForm = ({ cohorts: additionalCohorts }) => {
152171

153172
RecipientsForm.defaultProps = {
154173
cohorts: [],
174+
courseModes: [],
155175
};
156176

157177
RecipientsForm.propTypes = {
158178
cohorts: PropTypes.arrayOf(PropTypes.string),
179+
courseModes: PropTypes.arrayOf(
180+
PropTypes.shape({
181+
slug: PropTypes.string.isRequired,
182+
name: PropTypes.string.isRequired,
183+
}),
184+
),
159185
};
160186

161187
export default RecipientsForm;

plugins/communications-app/RecipientsForm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"peerDependencies": {
99
"@edx/frontend-app-communications": "*",
1010
"@edx/frontend-platform": "*",
11-
"@edx/paragon": "*",
11+
"@openedx/paragon": "*",
1212
"prop-types": "*",
1313
"react": "*"
1414
},

plugins/communications-app/ScheduleSection/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import {
77
Form,
88
Icon,
99
Toast,
10-
} from '@edx/paragon';
10+
} from '@openedx/paragon';
1111
import {
1212
SpinnerSimple,
1313
Cancel,
1414
Send,
1515
Event,
1616
Check,
17-
} from '@edx/paragon/icons';
17+
} from '@openedx/paragon/icons';
1818
import { getConfig } from '@edx/frontend-platform';
1919
import { useIntl } from '@edx/frontend-platform/i18n';
2020
import ScheduleEmailForm from '@communications-app/src/components/bulk-email-tool/bulk-email-form/ScheduleEmailForm';

0 commit comments

Comments
 (0)