Skip to content

Commit 30cfd26

Browse files
Ahtesham QuraishFaraz32123
authored andcommitted
refactor: Replace of injectIntl with useIntl() part 5 #2285
1 parent 082a1c6 commit 30cfd26

File tree

11 files changed

+33
-54
lines changed

11 files changed

+33
-54
lines changed

src/editors/containers/VideoEditor/components/VideoSettingsModal/components/LicenseWidget/LicenseDetails.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { connect } from 'react-redux';
33
import PropTypes from 'prop-types';
44
import {
55
FormattedMessage,
6-
injectIntl,
76
} from '@edx/frontend-platform/i18n';
87
import {
98
ActionRow,
@@ -163,4 +162,4 @@ export const mapDispatchToProps = (dispatch) => ({
163162
});
164163

165164
export const LicenseDetailsInternal = LicenseDetails; // For testing only
166-
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LicenseDetails));
165+
export default connect(mapStateToProps, mapDispatchToProps)(LicenseDetails);

src/editors/containers/VideoEditor/components/VideoSettingsModal/components/LicenseWidget/index.jsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { connect } from 'react-redux';
33
import PropTypes from 'prop-types';
44
import {
55
FormattedMessage,
6-
injectIntl,
7-
intlShape,
6+
useIntl,
87
} from '@edx/frontend-platform/i18n';
98
import {
109
Button,
@@ -25,8 +24,6 @@ import LicenseDisplay from './LicenseDisplay';
2524
* Collapsible Form widget controlling video license type and details
2625
*/
2726
const LicenseWidget = ({
28-
// injected
29-
intl,
3027
// redux
3128
isLibrary,
3229
licenseType,
@@ -35,6 +32,7 @@ const LicenseWidget = ({
3532
courseLicenseDetails,
3633
updateField,
3734
}) => {
35+
const intl = useIntl();
3836
const { license, details, level } = hooks.determineLicense({
3937
isLibrary,
4038
licenseType,
@@ -85,8 +83,6 @@ const LicenseWidget = ({
8583
};
8684

8785
LicenseWidget.propTypes = {
88-
// injected
89-
intl: intlShape.isRequired,
9086
// redux
9187
isLibrary: PropTypes.bool.isRequired,
9288
licenseType: PropTypes.string.isRequired,
@@ -109,4 +105,4 @@ export const mapDispatchToProps = (dispatch) => ({
109105
});
110106

111107
export const LicenseWidgetInternal = LicenseWidget; // For testing only
112-
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LicenseWidget));
108+
export default connect(mapStateToProps, mapDispatchToProps)(LicenseWidget);

src/files-and-videos/videos-page/info-sidebar/InfoTab.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Stack } from '@openedx/paragon';
4-
import { injectIntl, FormattedDate, FormattedMessage } from '@edx/frontend-platform/i18n';
4+
import { FormattedDate, FormattedMessage } from '@edx/frontend-platform/i18n';
55
import { getFileSizeToClosestByte } from '../../../utils';
66
import { getFormattedDuration } from '../data/utils';
77
import messages from './messages';
@@ -47,4 +47,4 @@ InfoTab.defaultProps = {
4747
video: {},
4848
};
4949

50-
export default injectIntl(InfoTab);
50+
export default InfoTab;

src/files-and-videos/videos-page/transcript-settings/Cielo24Form.jsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { isEmpty } from 'lodash';
4-
import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n';
4+
import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n';
55
import { Form, Stack, TransitionReplace } from '@openedx/paragon';
66
import FormDropdown from './FormDropdown';
77
import { getFidelityOptions } from '../data/utils';
@@ -12,9 +12,8 @@ const Cielo24Form = ({
1212
data,
1313
setData,
1414
transcriptionPlan,
15-
// injected
16-
intl,
1715
}) => {
16+
const intl = useIntl();
1817
if (hasTranscriptCredentials) {
1918
const { fidelity } = transcriptionPlan;
2019
const selectedLanguage = data.preferredLanguages ? data.preferredLanguages : '';
@@ -118,8 +117,6 @@ Cielo24Form.propTypes = {
118117
turnaround: PropTypes.shape({}),
119118
fidelity: PropTypes.shape({}),
120119
}).isRequired,
121-
// injected
122-
intl: intlShape.isRequired,
123120
};
124121

125-
export default injectIntl(Cielo24Form);
122+
export default Cielo24Form;

src/generic/configure-modal/UnitTab.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Alert, Form } from '@openedx/paragon';
44
import {
5-
FormattedMessage, injectIntl, useIntl,
5+
FormattedMessage, useIntl,
66
} from '@edx/frontend-platform/i18n';
77
import { Field } from 'formik';
88
import classNames from 'classnames';
@@ -198,4 +198,4 @@ UnitTab.propTypes = {
198198
}).isRequired,
199199
};
200200

201-
export default injectIntl(UnitTab);
201+
export default UnitTab;

src/pages-and-resources/discussions/app-config-form/apps/shared/DivisionByGroupFields.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useContext } from 'react';
2-
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
2+
import { useIntl } from '@edx/frontend-platform/i18n';
33
import {
44
Form, TransitionReplace, Hyperlink, Alert,
55
} from '@openedx/paragon';
@@ -12,7 +12,8 @@ import messages from '../../messages';
1212
import AppConfigFormDivider from './AppConfigFormDivider';
1313
import { OpenedXConfigFormContext } from '../openedx/OpenedXConfigFormProvider';
1414

15-
const DivisionByGroupFields = ({ intl }) => {
15+
const DivisionByGroupFields = () => {
16+
const intl = useIntl();
1617
const { validDiscussionTopics } = useContext(OpenedXConfigFormContext);
1718
const {
1819
handleChange,
@@ -142,8 +143,4 @@ const DivisionByGroupFields = ({ intl }) => {
142143
);
143144
};
144145

145-
DivisionByGroupFields.propTypes = {
146-
intl: intlShape.isRequired,
147-
};
148-
149-
export default injectIntl(DivisionByGroupFields);
146+
export default DivisionByGroupFields;

src/pages-and-resources/discussions/app-config-form/apps/shared/discussion-topics/DiscussionTopics.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useContext, useCallback } from 'react';
22
import { Add } from '@openedx/paragon/icons';
33
import { Button } from '@openedx/paragon';
4-
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
4+
import { useIntl } from '@edx/frontend-platform/i18n';
55
import { FieldArray, useFormikContext } from 'formik';
66
import { v4 as uuid } from 'uuid';
77
import { remove as removeElements, uniq, uniqBy } from 'lodash';
@@ -10,7 +10,8 @@ import TopicItem from './TopicItem';
1010
import { OpenedXConfigFormContext } from '../../openedx/OpenedXConfigFormProvider';
1111
import { filterItemFromObject } from '../../../utils';
1212

13-
const DiscussionTopics = ({ intl }) => {
13+
const DiscussionTopics = () => {
14+
const intl = useIntl();
1415
const {
1516
values: appConfig,
1617
validateForm,
@@ -92,8 +93,4 @@ const DiscussionTopics = ({ intl }) => {
9293
);
9394
};
9495

95-
DiscussionTopics.propTypes = {
96-
intl: intlShape.isRequired,
97-
};
98-
99-
export default injectIntl(DiscussionTopics);
96+
export default DiscussionTopics;

src/pages-and-resources/discussions/app-config-form/apps/shared/discussion-topics/TopicItem.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
33

44
import { useFormikContext } from 'formik';
55

6-
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
6+
import { useIntl } from '@edx/frontend-platform/i18n';
77
import {
88
Button, Card, Form,
99
} from '@openedx/paragon';
@@ -13,14 +13,14 @@ import messages from '../../../messages';
1313
import FieldFeedback from '../../../../../../generic/FieldFeedback';
1414

1515
const TopicItem = ({
16-
intl,
1716
index,
1817
id,
1918
name,
2019
onDelete,
2120
hasError,
2221
onFocus,
2322
}) => {
23+
const intl = useIntl();
2424
const {
2525
handleChange, handleBlur, errors,
2626
} = useFormikContext();
@@ -139,9 +139,8 @@ TopicItem.propTypes = {
139139
id: PropTypes.string.isRequired,
140140
index: PropTypes.number.isRequired,
141141
onDelete: PropTypes.func.isRequired,
142-
intl: intlShape.isRequired,
143142
hasError: PropTypes.bool.isRequired,
144143
onFocus: PropTypes.func.isRequired,
145144
};
146145

147-
export default injectIntl(TopicItem);
146+
export default TopicItem;

src/pages-and-resources/discussions/app-list/AppListNextButton.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useContext } from 'react';
2-
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
2+
import { useIntl } from '@edx/frontend-platform/i18n';
33
import { Button } from '@openedx/paragon';
44
import { useSelector } from 'react-redux';
55
import { useNavigate } from 'react-router-dom';
@@ -8,7 +8,8 @@ import { DiscussionsContext } from '../DiscussionsProvider';
88

99
import messages from './messages';
1010

11-
const AppListNextButton = ({ intl }) => {
11+
const AppListNextButton = () => {
12+
const intl = useIntl();
1213
const { selectedAppId } = useSelector(state => state.discussions);
1314
const { path: discussionsPath } = useContext(DiscussionsContext);
1415
const navigate = useNavigate();
@@ -27,8 +28,4 @@ const AppListNextButton = ({ intl }) => {
2728
);
2829
};
2930

30-
AppListNextButton.propTypes = {
31-
intl: intlShape.isRequired,
32-
};
33-
34-
export default injectIntl(AppListNextButton);
31+
export default AppListNextButton;

src/schedule-and-details/introducing-section/introduction-video/index.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Form, Button, Card } from '@openedx/paragon';
4-
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
4+
import { useIntl } from '@edx/frontend-platform/i18n';
55

66
import messages from './messages';
77

8-
const IntroductionVideo = ({ intl, introVideo, onChange }) => {
8+
const IntroductionVideo = ({ introVideo, onChange }) => {
9+
const intl = useIntl();
910
const embedVideoUrl = introVideo
1011
? `//www.youtube.com/embed/${introVideo}`
1112
: '';
@@ -56,9 +57,8 @@ IntroductionVideo.defaultProps = {
5657
};
5758

5859
IntroductionVideo.propTypes = {
59-
intl: intlShape.isRequired,
6060
introVideo: PropTypes.string,
6161
onChange: PropTypes.func.isRequired,
6262
};
6363

64-
export default injectIntl(IntroductionVideo);
64+
export default IntroductionVideo;

0 commit comments

Comments
 (0)