diff --git a/src/alerts/access-expiration-alert/AccessExpirationAlert.jsx b/src/alerts/access-expiration-alert/AccessExpirationAlert.jsx index fb270fb391..ce8537bf42 100644 --- a/src/alerts/access-expiration-alert/AccessExpirationAlert.jsx +++ b/src/alerts/access-expiration-alert/AccessExpirationAlert.jsx @@ -1,14 +1,13 @@ import PropTypes from 'prop-types'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; -import { - FormattedMessage, FormattedDate, injectIntl, intlShape, -} from '@edx/frontend-platform/i18n'; +import { FormattedMessage, FormattedDate, useIntl } from '@edx/frontend-platform/i18n'; import { Alert, Hyperlink } from '@openedx/paragon'; import { Info } from '@openedx/paragon/icons'; import messages from './messages'; -const AccessExpirationAlert = ({ intl, payload }) => { +const AccessExpirationAlert = ({ payload }) => { + const intl = useIntl(); const { accessExpiration, courseId, @@ -119,7 +118,6 @@ const AccessExpirationAlert = ({ intl, payload }) => { }; AccessExpirationAlert.propTypes = { - intl: intlShape.isRequired, payload: PropTypes.shape({ accessExpiration: PropTypes.shape({ expirationDate: PropTypes.string.isRequired, @@ -134,4 +132,4 @@ AccessExpirationAlert.propTypes = { }).isRequired, }; -export default injectIntl(AccessExpirationAlert); +export default AccessExpirationAlert; diff --git a/src/alerts/active-enteprise-alert/ActiveEnterpriseAlert.jsx b/src/alerts/active-enteprise-alert/ActiveEnterpriseAlert.jsx index 4145b1aa7a..73e1bf289d 100644 --- a/src/alerts/active-enteprise-alert/ActiveEnterpriseAlert.jsx +++ b/src/alerts/active-enteprise-alert/ActiveEnterpriseAlert.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import PropTypes from 'prop-types'; import { Alert, Hyperlink } from '@openedx/paragon'; import { WarningFilled } from '@openedx/paragon/icons'; @@ -7,7 +7,8 @@ import { WarningFilled } from '@openedx/paragon/icons'; import { getConfig } from '@edx/frontend-platform'; import genericMessages from './messages'; -const ActiveEnterpriseAlert = ({ intl, payload }) => { +const ActiveEnterpriseAlert = ({ payload }) => { + const intl = useIntl(); const { text, courseId } = payload; const changeActiveEnterprise = ( { }; ActiveEnterpriseAlert.propTypes = { - intl: intlShape.isRequired, payload: PropTypes.shape({ text: PropTypes.string, courseId: PropTypes.string, }).isRequired, }; -export default injectIntl(ActiveEnterpriseAlert); +export default ActiveEnterpriseAlert; diff --git a/src/alerts/enrollment-alert/EnrollmentAlert.jsx b/src/alerts/enrollment-alert/EnrollmentAlert.jsx index 410859dacf..09dad932d2 100644 --- a/src/alerts/enrollment-alert/EnrollmentAlert.jsx +++ b/src/alerts/enrollment-alert/EnrollmentAlert.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import PropTypes from 'prop-types'; import { Alert, Button } from '@openedx/paragon'; import { Info, WarningFilled } from '@openedx/paragon/icons'; @@ -11,7 +11,8 @@ import { useModel } from '../../generic/model-store'; import messages from './messages'; import useEnrollClickHandler from './clickHook'; -const EnrollmentAlert = ({ intl, payload }) => { +const EnrollmentAlert = ({ payload }) => { + const intl = useIntl(); const { canEnroll, courseId, @@ -58,7 +59,6 @@ const EnrollmentAlert = ({ intl, payload }) => { }; EnrollmentAlert.propTypes = { - intl: intlShape.isRequired, payload: PropTypes.shape({ canEnroll: PropTypes.bool, courseId: PropTypes.string, @@ -67,4 +67,4 @@ EnrollmentAlert.propTypes = { }).isRequired, }; -export default injectIntl(EnrollmentAlert); +export default EnrollmentAlert; diff --git a/src/alerts/logistration-alert/AccountActivationAlert.jsx b/src/alerts/logistration-alert/AccountActivationAlert.jsx index 0d6ed76537..70fcfdb879 100644 --- a/src/alerts/logistration-alert/AccountActivationAlert.jsx +++ b/src/alerts/logistration-alert/AccountActivationAlert.jsx @@ -9,13 +9,12 @@ import { Icon, } from '@openedx/paragon'; import { Check, ArrowForward } from '@openedx/paragon/icons'; -import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { sendActivationEmail } from '../../courseware/data'; import messages from './messages'; -const AccountActivationAlert = ({ - intl, -}) => { +const AccountActivationAlert = () => { + const intl = useIntl(); const [showModal, setShowModal] = useState(false); const [showSpinner, setShowSpinner] = useState(false); const [showCheck, setShowCheck] = useState(false); @@ -125,8 +124,4 @@ const AccountActivationAlert = ({ ); }; -AccountActivationAlert.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(AccountActivationAlert); +export default AccountActivationAlert; diff --git a/src/alerts/logistration-alert/LogistrationAlert.jsx b/src/alerts/logistration-alert/LogistrationAlert.jsx index 110ebafe5e..38f0887e78 100644 --- a/src/alerts/logistration-alert/LogistrationAlert.jsx +++ b/src/alerts/logistration-alert/LogistrationAlert.jsx @@ -1,13 +1,14 @@ import React from 'react'; import { getConfig } from '@edx/frontend-platform'; -import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n'; +import { useIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; import { getLoginRedirectUrl } from '@edx/frontend-platform/auth'; import { Alert, Hyperlink } from '@openedx/paragon'; import { WarningFilled } from '@openedx/paragon/icons'; import genericMessages from '../../generic/messages'; -const LogistrationAlert = ({ intl }) => { +const LogistrationAlert = () => { + const intl = useIntl(); const signIn = ( { ); }; -LogistrationAlert.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(LogistrationAlert); +export default LogistrationAlert; diff --git a/src/course-home/courseware-search/CoursewareResultsFilter.jsx b/src/course-home/courseware-search/CoursewareResultsFilter.jsx index f8590f6292..b13cf2b807 100644 --- a/src/course-home/courseware-search/CoursewareResultsFilter.jsx +++ b/src/course-home/courseware-search/CoursewareResultsFilter.jsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Tabs, Tab } from '@openedx/paragon'; import { useParams } from 'react-router'; @@ -13,7 +13,8 @@ const filterTypes = ['text', 'video', 'sequence']; const filterOther = 'other'; const validFilters = [filterAll, ...filterTypes, filterOther]; -export const CoursewareSearchResultsFilter = ({ intl }) => { +export const CoursewareSearchResultsFilter = () => { + const intl = useIntl(); const { courseId } = useParams(); const lastSearch = useModel('contentSearchResults', courseId); const { filter: filterKeyword, setFilter } = useCoursewareSearchParams(); @@ -73,8 +74,4 @@ export const CoursewareSearchResultsFilter = ({ intl }) => { ); }; -CoursewareSearchResultsFilter.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CoursewareSearchResultsFilter); +export default CoursewareSearchResultsFilter; diff --git a/src/course-home/courseware-search/CoursewareSearchEmpty.jsx b/src/course-home/courseware-search/CoursewareSearchEmpty.jsx index 9eef71cabd..bfe94d921b 100644 --- a/src/course-home/courseware-search/CoursewareSearchEmpty.jsx +++ b/src/course-home/courseware-search/CoursewareSearchEmpty.jsx @@ -1,15 +1,14 @@ import React from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import messages from './messages'; -const CoursewareSearchEmpty = ({ intl }) => ( -
-

{intl.formatMessage(messages.searchResultsNone)}

-
-); - -CoursewareSearchEmpty.propTypes = { - intl: intlShape.isRequired, +const CoursewareSearchEmpty = () => { + const intl = useIntl(); + return ( +
+

{intl.formatMessage(messages.searchResultsNone)}

+
+ ); }; -export default injectIntl(CoursewareSearchEmpty); +export default CoursewareSearchEmpty; diff --git a/src/course-home/courseware-search/CoursewareSearchToggle.jsx b/src/course-home/courseware-search/CoursewareSearchToggle.jsx index a1c65d1c18..707c453829 100644 --- a/src/course-home/courseware-search/CoursewareSearchToggle.jsx +++ b/src/course-home/courseware-search/CoursewareSearchToggle.jsx @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Button } from '@openedx/paragon'; import { ManageSearch } from '@openedx/paragon/icons'; import { useDispatch } from 'react-redux'; @@ -7,9 +7,8 @@ import messages from './messages'; import { useCoursewareSearchFeatureFlag, useCoursewareSearchParams } from './hooks'; import { setShowSearch } from '../data/slice'; -const CoursewareSearchToggle = ({ - intl, -}) => { +const CoursewareSearchToggle = () => { + const intl = useIntl(); const dispatch = useDispatch(); const enabled = useCoursewareSearchFeatureFlag(); const { query } = useCoursewareSearchParams(); @@ -41,8 +40,4 @@ const CoursewareSearchToggle = ({ ); }; -CoursewareSearchToggle.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CoursewareSearchToggle); +export default CoursewareSearchToggle; diff --git a/src/course-home/dates-tab/DatesTab.jsx b/src/course-home/dates-tab/DatesTab.jsx index 71b4389bc9..65fed3dfdd 100644 --- a/src/course-home/dates-tab/DatesTab.jsx +++ b/src/course-home/dates-tab/DatesTab.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import messages from './messages'; import Timeline from './timeline/Timeline'; @@ -14,7 +14,8 @@ import ShiftDatesAlert from '../suggested-schedule-messaging/ShiftDatesAlert'; import UpgradeToCompleteAlert from '../suggested-schedule-messaging/UpgradeToCompleteAlert'; import UpgradeToShiftDatesAlert from '../suggested-schedule-messaging/UpgradeToShiftDatesAlert'; -const DatesTab = ({ intl }) => { +const DatesTab = () => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -59,8 +60,4 @@ const DatesTab = ({ intl }) => { ); }; -DatesTab.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(DatesTab); +export default DatesTab; diff --git a/src/course-home/dates-tab/timeline/Day.jsx b/src/course-home/dates-tab/timeline/Day.jsx index 8fd3d0c0ae..2d70c50ad2 100644 --- a/src/course-home/dates-tab/timeline/Day.jsx +++ b/src/course-home/dates-tab/timeline/Day.jsx @@ -5,8 +5,7 @@ import { useSelector } from 'react-redux'; import { FormattedDate, FormattedTime, - injectIntl, - intlShape, + useIntl, } from '@edx/frontend-platform/i18n'; import { Tooltip, OverlayTrigger } from '@openedx/paragon'; import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'; @@ -20,10 +19,10 @@ import { isLearnerAssignment } from '../utils'; const Day = ({ date, first, - intl, items, last, }) => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -108,7 +107,6 @@ const Day = ({ Day.propTypes = { date: PropTypes.objectOf(Date).isRequired, first: PropTypes.bool, - intl: intlShape.isRequired, items: PropTypes.arrayOf(PropTypes.shape({ date: PropTypes.string, dateType: PropTypes.string, @@ -126,4 +124,4 @@ Day.defaultProps = { last: false, }; -export default injectIntl(Day); +export default Day; diff --git a/src/course-home/discussion-tab/DiscussionTab.jsx b/src/course-home/discussion-tab/DiscussionTab.jsx index 06ee97cc7c..83588cfe79 100644 --- a/src/course-home/discussion-tab/DiscussionTab.jsx +++ b/src/course-home/discussion-tab/DiscussionTab.jsx @@ -1,5 +1,4 @@ import { getConfig } from '@edx/frontend-platform'; -import { injectIntl } from '@edx/frontend-platform/i18n'; import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import { useParams, generatePath, useNavigate } from 'react-router-dom'; @@ -30,6 +29,4 @@ const DiscussionTab = () => { ); }; -DiscussionTab.propTypes = {}; - -export default injectIntl(DiscussionTab); +export default DiscussionTab; diff --git a/src/course-home/goal-unsubscribe/GoalUnsubscribe.jsx b/src/course-home/goal-unsubscribe/GoalUnsubscribe.jsx index 5b69d8149d..75147b6aef 100644 --- a/src/course-home/goal-unsubscribe/GoalUnsubscribe.jsx +++ b/src/course-home/goal-unsubscribe/GoalUnsubscribe.jsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import HeaderSlot from '../../plugin-slots/HeaderSlot'; import PageLoading from '../../generic/PageLoading'; @@ -10,7 +10,8 @@ import { unsubscribeFromCourseGoal } from '../data/api'; import messages from './messages'; import ResultPage from './ResultPage'; -const GoalUnsubscribe = ({ intl }) => { +const GoalUnsubscribe = () => { + const intl = useIntl(); const { token } = useParams(); const [error, setError] = useState(false); const [isLoading, setIsLoading] = useState(true); @@ -51,8 +52,4 @@ const GoalUnsubscribe = ({ intl }) => { ); }; -GoalUnsubscribe.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(GoalUnsubscribe); +export default GoalUnsubscribe; diff --git a/src/course-home/goal-unsubscribe/ResultPage.jsx b/src/course-home/goal-unsubscribe/ResultPage.jsx index fe8351269a..35006544d8 100644 --- a/src/course-home/goal-unsubscribe/ResultPage.jsx +++ b/src/course-home/goal-unsubscribe/ResultPage.jsx @@ -1,28 +1,26 @@ import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; -import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Button, Hyperlink } from '@openedx/paragon'; import messages from './messages'; import { ReactComponent as UnsubscribeIcon } from './unsubscribe.svg'; -const ResultPage = ({ courseTitle, error, intl }) => { - const errorDescription = ( - - {intl.formatMessage(messages.contactSupport)} -
- ), - }} - /> +const ResultPage = ({ courseTitle, error }) => { + const intl = useIntl(); + const errorDescription = intl.formatMessage( + messages.errorDescription, + { + contactSupport: ( + + {intl.formatMessage(messages.contactSupport)} + + ), + }, ); const header = error @@ -54,7 +52,6 @@ ResultPage.defaultProps = { ResultPage.propTypes = { courseTitle: PropTypes.string, error: PropTypes.bool, - intl: intlShape.isRequired, }; -export default injectIntl(ResultPage); +export default ResultPage; diff --git a/src/course-home/goal-unsubscribe/messages.ts b/src/course-home/goal-unsubscribe/messages.ts index 4eec06a6a0..ee4f713673 100644 --- a/src/course-home/goal-unsubscribe/messages.ts +++ b/src/course-home/goal-unsubscribe/messages.ts @@ -16,6 +16,11 @@ const messages = defineMessages({ defaultMessage: 'Something went wrong', description: 'It indicate that the unsubscribing request has failed', }, + errorDescription: { + id: 'learning.goals.unsubscribe.errorDescription', + defaultMessage: 'We were unable to unsubscribe you from goal reminder emails. Please try again later or {contactSupport} for help.', + description: 'Message that notifies user that unsubscribing failed and to try again', + }, goToDashboard: { id: 'learning.goals.unsubscribe.goToDashboard', defaultMessage: 'Go to dashboard', diff --git a/src/course-home/outline-tab/alerts/certificate-status-alert/CertificateStatusAlert.jsx b/src/course-home/outline-tab/alerts/certificate-status-alert/CertificateStatusAlert.jsx index 0104bc236c..dd7114be7e 100644 --- a/src/course-home/outline-tab/alerts/certificate-status-alert/CertificateStatusAlert.jsx +++ b/src/course-home/outline-tab/alerts/certificate-status-alert/CertificateStatusAlert.jsx @@ -3,8 +3,7 @@ import PropTypes from 'prop-types'; import { FormattedDate, FormattedMessage, - injectIntl, - intlShape, + useIntl, } from '@edx/frontend-platform/i18n'; import { Alert, Button } from '@openedx/paragon'; import { useDispatch } from 'react-redux'; @@ -25,7 +24,8 @@ export const CERT_STATUS_TYPE = { UNVERIFIED: 'unverified', }; -const CertificateStatusAlert = ({ intl, payload }) => { +const CertificateStatusAlert = ({ payload }) => { + const intl = useIntl(); const dispatch = useDispatch(); const { certificateAvailableDate, @@ -192,7 +192,6 @@ const CertificateStatusAlert = ({ intl, payload }) => { }; CertificateStatusAlert.propTypes = { - intl: intlShape.isRequired, payload: PropTypes.shape({ certificateAvailableDate: PropTypes.string, certStatus: PropTypes.string, @@ -210,4 +209,4 @@ CertificateStatusAlert.propTypes = { }).isRequired, }; -export default injectIntl(CertificateStatusAlert); +export default CertificateStatusAlert; diff --git a/src/course-home/outline-tab/alerts/private-course-alert/PrivateCourseAlert.jsx b/src/course-home/outline-tab/alerts/private-course-alert/PrivateCourseAlert.jsx index 493fed5206..d97d725473 100644 --- a/src/course-home/outline-tab/alerts/private-course-alert/PrivateCourseAlert.jsx +++ b/src/course-home/outline-tab/alerts/private-course-alert/PrivateCourseAlert.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; -import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n'; +import { useIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; import { getLoginRedirectUrl } from '@edx/frontend-platform/auth'; import { Alert, Button, Hyperlink } from '@openedx/paragon'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; @@ -14,7 +14,8 @@ import outlineMessages from '../../messages'; import useEnrollClickHandler from '../../../../alerts/enrollment-alert/clickHook'; import { useModel } from '../../../../generic/model-store'; -const PrivateCourseAlert = ({ intl, payload }) => { +const PrivateCourseAlert = ({ payload }) => { + const intl = useIntl(); const { anonymousUser, canEnroll, @@ -103,7 +104,6 @@ const PrivateCourseAlert = ({ intl, payload }) => { }; PrivateCourseAlert.propTypes = { - intl: intlShape.isRequired, payload: PropTypes.shape({ anonymousUser: PropTypes.bool, canEnroll: PropTypes.bool, @@ -111,4 +111,4 @@ PrivateCourseAlert.propTypes = { }).isRequired, }; -export default injectIntl(PrivateCourseAlert); +export default PrivateCourseAlert; diff --git a/src/course-home/outline-tab/widgets/CourseDates.jsx b/src/course-home/outline-tab/widgets/CourseDates.jsx index 0db9e2e5a6..2ae3b459f4 100644 --- a/src/course-home/outline-tab/widgets/CourseDates.jsx +++ b/src/course-home/outline-tab/widgets/CourseDates.jsx @@ -1,15 +1,14 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import DateSummary from '../DateSummary'; import messages from '../messages'; import { useModel } from '../../../generic/model-store'; -const CourseDates = ({ - intl, -}) => { +const CourseDates = () => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -48,8 +47,4 @@ const CourseDates = ({ ); }; -CourseDates.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CourseDates); +export default CourseDates; diff --git a/src/course-home/outline-tab/widgets/CourseHandouts.jsx b/src/course-home/outline-tab/widgets/CourseHandouts.jsx index ac90adad8b..8c609531b9 100644 --- a/src/course-home/outline-tab/widgets/CourseHandouts.jsx +++ b/src/course-home/outline-tab/widgets/CourseHandouts.jsx @@ -1,13 +1,14 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import LmsHtmlFragment from '../LmsHtmlFragment'; import messages from '../messages'; import { useModel } from '../../../generic/model-store'; -const CourseHandouts = ({ intl }) => { +const CourseHandouts = () => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -31,8 +32,4 @@ const CourseHandouts = ({ intl }) => { ); }; -CourseHandouts.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CourseHandouts); +export default CourseHandouts; diff --git a/src/course-home/outline-tab/widgets/CourseTools.jsx b/src/course-home/outline-tab/widgets/CourseTools.jsx index 62ef499000..a3a7e13944 100644 --- a/src/course-home/outline-tab/widgets/CourseTools.jsx +++ b/src/course-home/outline-tab/widgets/CourseTools.jsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { sendTrackingLogEvent } from '@edx/frontend-platform/analytics'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faBookmark, faCertificate, faInfo, faCalendar, faStar, @@ -14,7 +14,8 @@ import messages from '../messages'; import { useModel } from '../../../generic/model-store'; import LaunchCourseHomeTourButton from '../../../product-tours/newUserCourseHomeTour/LaunchCourseHomeTourButton'; -const CourseTools = ({ intl }) => { +const CourseTools = () => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -81,8 +82,4 @@ const CourseTools = ({ intl }) => { ); }; -CourseTools.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CourseTools); +export default CourseTools; diff --git a/src/course-home/outline-tab/widgets/LearningGoalButton.jsx b/src/course-home/outline-tab/widgets/LearningGoalButton.jsx index c477ea9028..71a5c91c09 100644 --- a/src/course-home/outline-tab/widgets/LearningGoalButton.jsx +++ b/src/course-home/outline-tab/widgets/LearningGoalButton.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; // These flag svgs are derivatives of the Flag icon from paragon import { ReactComponent as FlagIntenseIcon } from './flag_black.svg'; import { ReactComponent as FlagCasualIcon } from './flag_outline.svg'; @@ -13,8 +13,8 @@ const LearningGoalButton = ({ level, isSelected, handleSelect, - intl, }) => { + const intl = useIntl(); const buttonDetails = { casual: { daysPerWeek: 1, @@ -53,7 +53,6 @@ LearningGoalButton.propTypes = { level: PropTypes.string.isRequired, isSelected: PropTypes.bool.isRequired, handleSelect: PropTypes.func.isRequired, - intl: intlShape.isRequired, }; -export default injectIntl(LearningGoalButton); +export default LearningGoalButton; diff --git a/src/course-home/outline-tab/widgets/ProctoringInfoPanel.jsx b/src/course-home/outline-tab/widgets/ProctoringInfoPanel.jsx index 23241d97c4..29167e5a6f 100644 --- a/src/course-home/outline-tab/widgets/ProctoringInfoPanel.jsx +++ b/src/course-home/outline-tab/widgets/ProctoringInfoPanel.jsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import camelCase from 'lodash.camelcase'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Button } from '@openedx/paragon'; import messages from '../messages'; @@ -10,7 +10,8 @@ import { getProctoringInfoData } from '../../data/api'; import { fetchProctoringInfoResolved } from '../../data/slice'; import { useModel } from '../../../generic/model-store'; -const ProctoringInfoPanel = ({ intl }) => { +const ProctoringInfoPanel = () => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -216,8 +217,4 @@ const ProctoringInfoPanel = ({ intl }) => { ); }; -ProctoringInfoPanel.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(ProctoringInfoPanel); +export default ProctoringInfoPanel; diff --git a/src/course-home/outline-tab/widgets/StartOrResumeCourseCard.jsx b/src/course-home/outline-tab/widgets/StartOrResumeCourseCard.jsx index c160e5279d..a75e76be3e 100644 --- a/src/course-home/outline-tab/widgets/StartOrResumeCourseCard.jsx +++ b/src/course-home/outline-tab/widgets/StartOrResumeCourseCard.jsx @@ -1,13 +1,14 @@ import React from 'react'; import { Button, Card } from '@openedx/paragon'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { useSelector } from 'react-redux'; import { sendTrackingLogEvent } from '@edx/frontend-platform/analytics'; import messages from '../messages'; import { useModel } from '../../../generic/model-store'; -const StartOrResumeCourseCard = ({ intl }) => { +const StartOrResumeCourseCard = () => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -62,8 +63,4 @@ const StartOrResumeCourseCard = ({ intl }) => { ); }; -StartOrResumeCourseCard.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(StartOrResumeCourseCard); +export default StartOrResumeCourseCard; diff --git a/src/course-home/outline-tab/widgets/WeeklyLearningGoalCard.jsx b/src/course-home/outline-tab/widgets/WeeklyLearningGoalCard.jsx index 1c1592193f..575cb8ad67 100644 --- a/src/course-home/outline-tab/widgets/WeeklyLearningGoalCard.jsx +++ b/src/course-home/outline-tab/widgets/WeeklyLearningGoalCard.jsx @@ -6,7 +6,7 @@ import { Form, Card, Icon } from '@openedx/paragon'; import { history } from '@edx/frontend-platform'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Email } from '@openedx/paragon/icons'; import { useSelector } from 'react-redux'; import messages from '../messages'; @@ -18,8 +18,8 @@ import './FlagButton.scss'; const WeeklyLearningGoalCard = ({ daysPerWeek, subscribedToReminders, - intl, }) => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -152,11 +152,10 @@ const WeeklyLearningGoalCard = ({ WeeklyLearningGoalCard.propTypes = { daysPerWeek: PropTypes.number, subscribedToReminders: PropTypes.bool, - intl: intlShape.isRequired, }; WeeklyLearningGoalCard.defaultProps = { daysPerWeek: null, subscribedToReminders: false, }; -export default injectIntl(WeeklyLearningGoalCard); +export default WeeklyLearningGoalCard; diff --git a/src/course-home/suggested-schedule-messaging/ShiftDatesAlert.jsx b/src/course-home/suggested-schedule-messaging/ShiftDatesAlert.jsx index 2a0b760825..06edda53b6 100644 --- a/src/course-home/suggested-schedule-messaging/ShiftDatesAlert.jsx +++ b/src/course-home/suggested-schedule-messaging/ShiftDatesAlert.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Alert, Button, @@ -14,7 +14,8 @@ import { resetDeadlines } from '../data'; import { useModel } from '../../generic/model-store'; import messages from './messages'; -const ShiftDatesAlert = ({ fetch, intl, model }) => { +const ShiftDatesAlert = ({ fetch, model }) => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -59,8 +60,7 @@ const ShiftDatesAlert = ({ fetch, intl, model }) => { ShiftDatesAlert.propTypes = { fetch: PropTypes.func.isRequired, - intl: intlShape.isRequired, model: PropTypes.string.isRequired, }; -export default injectIntl(ShiftDatesAlert); +export default ShiftDatesAlert; diff --git a/src/course-home/suggested-schedule-messaging/SuggestedScheduleHeader.jsx b/src/course-home/suggested-schedule-messaging/SuggestedScheduleHeader.jsx index 7953929c98..b6c30668f0 100644 --- a/src/course-home/suggested-schedule-messaging/SuggestedScheduleHeader.jsx +++ b/src/course-home/suggested-schedule-messaging/SuggestedScheduleHeader.jsx @@ -1,16 +1,15 @@ import React from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import messages from './messages'; -const SuggestedScheduleHeader = ({ intl }) => ( -

- {intl.formatMessage(messages.suggestedSchedule)} -

-); - -SuggestedScheduleHeader.propTypes = { - intl: intlShape.isRequired, +const SuggestedScheduleHeader = () => { + const intl = useIntl(); + return ( +

+ {intl.formatMessage(messages.suggestedSchedule)} +

+ ); }; -export default injectIntl(SuggestedScheduleHeader); +export default SuggestedScheduleHeader; diff --git a/src/course-home/suggested-schedule-messaging/UpgradeToCompleteAlert.jsx b/src/course-home/suggested-schedule-messaging/UpgradeToCompleteAlert.jsx index ee89d74296..10f5731fe5 100644 --- a/src/course-home/suggested-schedule-messaging/UpgradeToCompleteAlert.jsx +++ b/src/course-home/suggested-schedule-messaging/UpgradeToCompleteAlert.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Alert, Button, @@ -12,7 +12,8 @@ import { import { useModel } from '../../generic/model-store'; import messages from './messages'; -const UpgradeToCompleteAlert = ({ intl, logUpgradeLinkClick }) => { +const UpgradeToCompleteAlert = ({ logUpgradeLinkClick }) => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -58,7 +59,6 @@ const UpgradeToCompleteAlert = ({ intl, logUpgradeLinkClick }) => { }; UpgradeToCompleteAlert.propTypes = { - intl: intlShape.isRequired, logUpgradeLinkClick: PropTypes.func, }; @@ -66,4 +66,4 @@ UpgradeToCompleteAlert.defaultProps = { logUpgradeLinkClick: () => {}, }; -export default injectIntl(UpgradeToCompleteAlert); +export default UpgradeToCompleteAlert; diff --git a/src/course-home/suggested-schedule-messaging/UpgradeToShiftDatesAlert.jsx b/src/course-home/suggested-schedule-messaging/UpgradeToShiftDatesAlert.jsx index 09e4cb0b43..25bedd3e6a 100644 --- a/src/course-home/suggested-schedule-messaging/UpgradeToShiftDatesAlert.jsx +++ b/src/course-home/suggested-schedule-messaging/UpgradeToShiftDatesAlert.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Alert, Button, @@ -13,7 +13,8 @@ import { import { useModel } from '../../generic/model-store'; import messages from './messages'; -const UpgradeToShiftDatesAlert = ({ intl, logUpgradeLinkClick, model }) => { +const UpgradeToShiftDatesAlert = ({ logUpgradeLinkClick, model }) => { + const intl = useIntl(); const { courseId, } = useSelector(state => state.courseHome); @@ -60,7 +61,6 @@ const UpgradeToShiftDatesAlert = ({ intl, logUpgradeLinkClick, model }) => { }; UpgradeToShiftDatesAlert.propTypes = { - intl: intlShape.isRequired, logUpgradeLinkClick: PropTypes.func, model: PropTypes.string.isRequired, }; @@ -69,4 +69,4 @@ UpgradeToShiftDatesAlert.defaultProps = { logUpgradeLinkClick: () => {}, }; -export default injectIntl(UpgradeToShiftDatesAlert); +export default UpgradeToShiftDatesAlert; diff --git a/src/course-tabs/CourseTabsNavigation.jsx b/src/course-tabs/CourseTabsNavigation.jsx index 3aefb34945..9c2a12ef8c 100644 --- a/src/course-tabs/CourseTabsNavigation.jsx +++ b/src/course-tabs/CourseTabsNavigation.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import classNames from 'classnames'; import messages from './messages'; @@ -9,8 +9,9 @@ import { CoursewareSearch, CoursewareSearchToggle } from '../course-home/coursew import { useCoursewareSearchState } from '../course-home/courseware-search/hooks'; const CourseTabsNavigation = ({ - activeTabSlug, className, tabs, intl, + activeTabSlug, className, tabs, }) => { + const intl = useIntl(); const { show } = useCoursewareSearchState(); return ( @@ -51,7 +52,6 @@ CourseTabsNavigation.propTypes = { slug: PropTypes.string.isRequired, url: PropTypes.string.isRequired, })).isRequired, - intl: intlShape.isRequired, }; CourseTabsNavigation.defaultProps = { @@ -59,4 +59,4 @@ CourseTabsNavigation.defaultProps = { className: null, }; -export default injectIntl(CourseTabsNavigation); +export default CourseTabsNavigation; diff --git a/src/courseware/course/celebration/CelebrationModal.jsx b/src/courseware/course/celebration/CelebrationModal.jsx index ad5e32ba7c..62b2df22f2 100644 --- a/src/courseware/course/celebration/CelebrationModal.jsx +++ b/src/courseware/course/celebration/CelebrationModal.jsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { ActionRow, breakpoints, @@ -18,8 +18,9 @@ import { recordFirstSectionCelebration } from './utils'; import { useModel } from '../../../generic/model-store'; const CelebrationModal = ({ - courseId, intl, isOpen, onClose, ...rest + courseId, isOpen, onClose, ...rest }) => { + const intl = useIntl(); const { org, celebrations } = useModel('courseHomeMeta', courseId); const dispatch = useDispatch(); const wideScreen = useWindowSize().width >= breakpoints.small.minWidth; @@ -66,9 +67,8 @@ const CelebrationModal = ({ CelebrationModal.propTypes = { courseId: PropTypes.string.isRequired, - intl: intlShape.isRequired, isOpen: PropTypes.bool.isRequired, onClose: PropTypes.func.isRequired, }; -export default injectIntl(CelebrationModal); +export default CelebrationModal; diff --git a/src/courseware/course/celebration/WeeklyGoalCelebrationModal.jsx b/src/courseware/course/celebration/WeeklyGoalCelebrationModal.jsx index 8f14f4744e..3626574727 100644 --- a/src/courseware/course/celebration/WeeklyGoalCelebrationModal.jsx +++ b/src/courseware/course/celebration/WeeklyGoalCelebrationModal.jsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { ActionRow, Button, Icon, StandardModal, } from '@openedx/paragon'; @@ -12,8 +12,9 @@ import { recordWeeklyGoalCelebration } from './utils'; import { useModel } from '../../../generic/model-store'; const WeeklyGoalCelebrationModal = ({ - courseId, daysPerWeek, intl, isOpen, onClose, ...rest + courseId, daysPerWeek, isOpen, onClose, ...rest }) => { + const intl = useIntl(); const { org } = useModel('courseHomeMeta', courseId); useEffect(() => { @@ -77,9 +78,8 @@ const WeeklyGoalCelebrationModal = ({ WeeklyGoalCelebrationModal.propTypes = { courseId: PropTypes.string.isRequired, daysPerWeek: PropTypes.number.isRequired, - intl: intlShape.isRequired, isOpen: PropTypes.bool.isRequired, onClose: PropTypes.func.isRequired, }; -export default injectIntl(WeeklyGoalCelebrationModal); +export default WeeklyGoalCelebrationModal; diff --git a/src/courseware/course/chat/Chat.jsx b/src/courseware/course/chat/Chat.jsx index 86412c46d8..98c348f312 100644 --- a/src/courseware/course/chat/Chat.jsx +++ b/src/courseware/course/chat/Chat.jsx @@ -4,7 +4,6 @@ import PropTypes from 'prop-types'; import { Xpert } from '@edx/frontend-lib-learning-assistant'; import { getConfig } from '@edx/frontend-platform'; -import { injectIntl } from '@edx/frontend-platform/i18n'; import { ALLOW_UPSELL_MODES, VERIFIED_MODES } from '@src/constants'; import { useModel } from '../../../generic/model-store'; @@ -80,4 +79,4 @@ Chat.defaultProps = { enrollmentMode: null, }; -export default injectIntl(Chat); +export default Chat; diff --git a/src/courseware/course/content-tools/calculator/Calculator.jsx b/src/courseware/course/content-tools/calculator/Calculator.jsx index 95b4c2ff7d..aeaabc7c3d 100644 --- a/src/courseware/course/content-tools/calculator/Calculator.jsx +++ b/src/courseware/course/content-tools/calculator/Calculator.jsx @@ -1,402 +1,389 @@ -import React, { Component } from 'react'; +import React, { useState } from 'react'; import { Collapsible } from '@openedx/paragon'; import { getConfig } from '@edx/frontend-platform'; import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; -import { - FormattedMessage, injectIntl, intlShape, -} from '@edx/frontend-platform/i18n'; +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCalculator, faQuestionCircle, faTimesCircle, faEquals, } from '@fortawesome/free-solid-svg-icons'; import messages from './messages'; -class Calculator extends Component { - constructor(props) { - super(props); - this.state = { - equation: '', - result: '', - }; - this.handleSubmit = this.handleSubmit.bind(this); - } +const Calculator = () => { + const intl = useIntl(); + const [equation, setEquation] = useState(''); + const [result, setResult] = useState(''); - async handleSubmit(event) { + const handleSubmit = async (event) => { event.preventDefault(); event.stopPropagation(); const urlEncoded = new URLSearchParams(); - urlEncoded.append('equation', this.state.equation); + urlEncoded.append('equation', equation); const response = await getAuthenticatedHttpClient().get( `${getConfig().LMS_BASE_URL}/calculate?${urlEncoded.toString()}`, ); - this.setState(() => ({ result: response.data.result })); - } + setResult(response.data.result); + }; - changeEquation(value) { - this.setState(() => ({ equation: value })); - } + const changeEquation = (value) => { + setEquation(value); + }; - render() { - return ( - -
- - - - - - {this.props.intl.formatMessage(messages['calculator.button.label'])} - -
- -
- this.changeEquation(event.target.value)} - /> - - -
+ return ( + +
+ + + + + + {intl.formatMessage(messages['calculator.button.label'])} + +
+ +
+ changeEquation(event.target.value)} + /> + + +
- -
- - - - - - - -
- + +
+ + + + + - - - ), - }} + id="calculator.instructions.button.label" + defaultMessage="Calculator Instructions" /> -

- - - -

-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
- - -
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
-
    -
  • 2520
  • -
  • 2/3
  • -
  • 3.14, .98
  • -
-
- - -
    -
  • - {' + - * / '} - -
  • -
  • - {'^ '} - -
  • -
  • - {'|| '} - -
  • -
-
-
    -
  • x+(2*y)/x-1
  • -
  • x^(n+1)
  • -
  • v_IN+v_OUT
  • -
  • 1||2
  • -
-
- - e, pi -
    -
  • 20*e
  • -
  • 418*pi
  • -
-
- - - - -
    -
  • 20%
  • -
-
- - abs, exp, fact, factorial, ln, log2, log10, sqrt -
    -
  • abs(x+y)
  • -
  • sqrt(x^2-y)
  • -
-
- - -
    -
  • sin, cos, tan, sec, csc, cot
  • -
  • arcsin, sinh, arcsinh
  • -
-
-
    -
  • sin(4x+y)
  • -
  • arccsch(4x+y)
  • -
-
- - - - 10^-9
- - - - 1e-9
- - - - - ); - } -} - -Calculator.propTypes = { - intl: intlShape.isRequired, +
+
+ + + + + ), + }} + /> +

+ + + +

+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+
    +
  • 2520
  • +
  • 2/3
  • +
  • 3.14, .98
  • +
+
+ + +
    +
  • + {' + - * / '} + +
  • +
  • + {'^ '} + +
  • +
  • + {'|| '} + +
  • +
+
+
    +
  • x+(2*y)/x-1
  • +
  • x^(n+1)
  • +
  • v_IN+v_OUT
  • +
  • 1||2
  • +
+
+ + e, pi +
    +
  • 20*e
  • +
  • 418*pi
  • +
+
+ + + + +
    +
  • 20%
  • +
+
+ + abs, exp, fact, factorial, ln, log2, log10, sqrt +
    +
  • abs(x+y)
  • +
  • sqrt(x^2-y)
  • +
+
+ + +
    +
  • sin, cos, tan, sec, csc, cot
  • +
  • arcsin, sinh, arcsinh
  • +
+
+
    +
  • sin(4x+y)
  • +
  • arccsch(4x+y)
  • +
+
+ + + + 10^-9
+ + + + 1e-9
+
+
+
+
+ ); }; -export default injectIntl(Calculator); +export default Calculator; diff --git a/src/courseware/course/content-tools/notes-visibility/NotesVisibility.jsx b/src/courseware/course/content-tools/notes-visibility/NotesVisibility.jsx index ecde3f9b58..60e96e6234 100644 --- a/src/courseware/course/content-tools/notes-visibility/NotesVisibility.jsx +++ b/src/courseware/course/content-tools/notes-visibility/NotesVisibility.jsx @@ -1,11 +1,9 @@ -import React, { Component } from 'react'; +import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; -import { - injectIntl, intlShape, -} from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faPencilAlt } from '@fortawesome/free-solid-svg-icons'; import messages from './messages'; @@ -15,47 +13,41 @@ function toggleNotes() { iframe.contentWindow.postMessage('tools.toggleNotes', getConfig().LMS_BASE_URL); } -class NotesVisibility extends Component { - constructor(props) { - super(props); - this.state = { - visible: props.course.notes.visible, - }; - this.visibilityUrl = `${getConfig().LMS_BASE_URL}/courses/${props.course.id}/edxnotes/visibility/`; - } +const NotesVisibility = ({ course }) => { + const intl = useIntl(); + const [visible, setVisible] = useState(course.notes.visible); + const visibilityUrl = `${getConfig().LMS_BASE_URL}/courses/${course.id}/edxnotes/visibility/`; - handleClick = () => { - const data = { visibility: !this.state.visible }; + const handleClick = () => { + const data = { visibility: !visible }; getAuthenticatedHttpClient().put( - this.visibilityUrl, + visibilityUrl, data, ).then(() => { - this.setState((state) => ({ visible: !state.visible })); + setVisible(!visible); toggleNotes(); }); }; - render() { - const message = this.state.visible ? 'notes.button.hide' : 'notes.button.show'; - return ( - - ); - } -} + const message = visible ? 'notes.button.hide' : 'notes.button.show'; + + return ( + + ); +}; NotesVisibility.propTypes = { - intl: intlShape.isRequired, course: PropTypes.shape({ id: PropTypes.string.isRequired, notes: PropTypes.shape({ @@ -64,4 +56,4 @@ NotesVisibility.propTypes = { }).isRequired, }; -export default injectIntl(NotesVisibility); +export default NotesVisibility; diff --git a/src/courseware/course/course-exit/CatalogSuggestion.jsx b/src/courseware/course/course-exit/CatalogSuggestion.jsx index de0b53a725..2d7b8934d1 100644 --- a/src/courseware/course/course-exit/CatalogSuggestion.jsx +++ b/src/courseware/course/course-exit/CatalogSuggestion.jsx @@ -4,9 +4,7 @@ import { useSelector } from 'react-redux'; import { getConfig } from '@edx/frontend-platform'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; -import { - FormattedMessage, injectIntl, intlShape, -} from '@edx/frontend-platform/i18n'; +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { Hyperlink } from '@openedx/paragon'; import { faSearch } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; @@ -16,7 +14,8 @@ import { useModel } from '../../../generic/model-store'; import messages from './messages'; import { logClick } from './utils'; -const CatalogSuggestion = ({ intl, variant }) => { +const CatalogSuggestion = ({ variant }) => { + const intl = useIntl(); const { courseId } = useSelector(state => state.courseware); const { org } = useModel('courseHomeMeta', courseId); const { administrator } = getAuthenticatedUser(); @@ -48,8 +47,7 @@ const CatalogSuggestion = ({ intl, variant }) => { }; CatalogSuggestion.propTypes = { - intl: intlShape.isRequired, variant: PropTypes.string.isRequired, }; -export default injectIntl(CatalogSuggestion); +export default CatalogSuggestion; diff --git a/src/courseware/course/course-exit/CourseCelebration.jsx b/src/courseware/course/course-exit/CourseCelebration.jsx index 8de5cb2be0..d4193954b2 100644 --- a/src/courseware/course/course-exit/CourseCelebration.jsx +++ b/src/courseware/course/course-exit/CourseCelebration.jsx @@ -2,9 +2,7 @@ import React, { useEffect } from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faLinkedinIn } from '@fortawesome/free-brands-svg-icons'; -import { - FormattedDate, FormattedMessage, injectIntl, intlShape, -} from '@edx/frontend-platform/i18n'; +import { FormattedDate, FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { Helmet } from 'react-helmet'; import { useDispatch, useSelector } from 'react-redux'; import { @@ -36,7 +34,8 @@ import CourseRecommendationsSlot from '../../../plugin-slots/CourseRecommendatio const LINKEDIN_BLUE = '#2867B2'; -const CourseCelebration = ({ intl }) => { +const CourseCelebration = () => { + const intl = useIntl(); const wideScreen = useWindowSize().width >= breakpoints.medium.minWidth; const { courseId } = useSelector(state => state.courseware); const dispatch = useDispatch(); @@ -364,8 +363,4 @@ const CourseCelebration = ({ intl }) => { ); }; -CourseCelebration.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CourseCelebration); +export default CourseCelebration; diff --git a/src/courseware/course/course-exit/CourseExit.jsx b/src/courseware/course/course-exit/CourseExit.jsx index 81758f7a6f..60d57200ac 100644 --- a/src/courseware/course/course-exit/CourseExit.jsx +++ b/src/courseware/course/course-exit/CourseExit.jsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import { getConfig } from '@edx/frontend-platform'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Button } from '@openedx/paragon'; import { useSelector } from 'react-redux'; import { Navigate } from 'react-router-dom'; @@ -15,7 +15,8 @@ import { unsubscribeFromGoalReminders } from './data/thunks'; import { useModel } from '../../../generic/model-store'; -const CourseExit = ({ intl }) => { +const CourseExit = () => { + const intl = useIntl(); const { courseId } = useSelector(state => state.courseware); const { certificateData, @@ -76,8 +77,4 @@ const CourseExit = ({ intl }) => { ); }; -CourseExit.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CourseExit); +export default CourseExit; diff --git a/src/courseware/course/course-exit/CourseInProgress.jsx b/src/courseware/course/course-exit/CourseInProgress.jsx index a33e8da621..67af096312 100644 --- a/src/courseware/course/course-exit/CourseInProgress.jsx +++ b/src/courseware/course/course-exit/CourseInProgress.jsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Helmet } from 'react-helmet'; import { useSelector } from 'react-redux'; import { Alert, Button } from '@openedx/paragon'; @@ -14,7 +14,8 @@ import DashboardFootnote from './DashboardFootnote'; import messages from './messages'; import { logClick, logVisit } from './utils'; -const CourseInProgress = ({ intl }) => { +const CourseInProgress = () => { + const intl = useIntl(); const { courseId } = useSelector(state => state.courseware); const { org, @@ -60,8 +61,4 @@ const CourseInProgress = ({ intl }) => { ); }; -CourseInProgress.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CourseInProgress); +export default CourseInProgress; diff --git a/src/courseware/course/course-exit/CourseNonPassing.jsx b/src/courseware/course/course-exit/CourseNonPassing.jsx index 3db9464c0f..c42eb90066 100644 --- a/src/courseware/course/course-exit/CourseNonPassing.jsx +++ b/src/courseware/course/course-exit/CourseNonPassing.jsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { Helmet } from 'react-helmet'; import { useSelector } from 'react-redux'; import { Alert, Button } from '@openedx/paragon'; @@ -14,7 +14,8 @@ import DashboardFootnote from './DashboardFootnote'; import messages from './messages'; import { logClick, logVisit } from './utils'; -const CourseNonPassing = ({ intl }) => { +const CourseNonPassing = () => { + const intl = useIntl(); const { courseId } = useSelector(state => state.courseware); const { org, @@ -60,8 +61,4 @@ const CourseNonPassing = ({ intl }) => { ); }; -CourseNonPassing.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(CourseNonPassing); +export default CourseNonPassing; diff --git a/src/courseware/course/course-exit/CourseRecommendations.jsx b/src/courseware/course/course-exit/CourseRecommendations.jsx index 22d6f7e5ac..0a05e28f52 100644 --- a/src/courseware/course/course-exit/CourseRecommendations.jsx +++ b/src/courseware/course/course-exit/CourseRecommendations.jsx @@ -4,7 +4,7 @@ import { getConfig } from '@edx/frontend-platform'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; import { - FormattedMessage, injectIntl, intlShape, defineMessages, + FormattedMessage, useIntl, defineMessages, } from '@edx/frontend-platform/i18n'; import { useSelector, useDispatch } from 'react-redux'; import { @@ -64,8 +64,8 @@ const CourseCard = ({ marketingUrl, onClick, }, - intl, }) => { + const intl = useIntl(); const formatList = (items, style) => ( items.join(intl.formatMessage( messages.listJoin, @@ -127,12 +127,12 @@ CourseCard.propTypes = { })), onClick: PropTypes.func, }).isRequired, - intl: intlShape.isRequired, }; -const IntlCard = injectIntl(CourseCard); +const IntlCard = CourseCard; -const CourseRecommendations = ({ intl, variant }) => { +const CourseRecommendations = ({ variant }) => { + const intl = useIntl(); const { courseId, recommendationsStatus } = useSelector(state => ({ ...state.recommendations, ...state.courseware })); const { recommendations } = useModel('coursewareMeta', courseId); const { org, number } = useModel('courseHomeMeta', courseId); @@ -205,8 +205,7 @@ const CourseRecommendations = ({ intl, variant }) => { }; CourseRecommendations.propTypes = { - intl: intlShape.isRequired, variant: PropTypes.string.isRequired, }; -export default injectIntl(CourseRecommendations); +export default CourseRecommendations; diff --git a/src/courseware/course/course-exit/DashboardFootnote.jsx b/src/courseware/course/course-exit/DashboardFootnote.jsx index b95ee84cf0..7ac7a4405f 100644 --- a/src/courseware/course/course-exit/DashboardFootnote.jsx +++ b/src/courseware/course/course-exit/DashboardFootnote.jsx @@ -3,9 +3,7 @@ import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; -import { - FormattedMessage, injectIntl, intlShape, -} from '@edx/frontend-platform/i18n'; +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { Hyperlink } from '@openedx/paragon'; import { faCalendarAlt } from '@fortawesome/free-regular-svg-icons'; import { getConfig } from '@edx/frontend-platform'; @@ -16,7 +14,8 @@ import Footnote from './Footnote'; import messages from './messages'; import { logClick } from './utils'; -const DashboardFootnote = ({ intl, variant }) => { +const DashboardFootnote = ({ variant }) => { + const intl = useIntl(); const { courseId } = useSelector(state => state.courseware); const { org } = useModel('courseHomeMeta', courseId); const { administrator } = getAuthenticatedUser(); @@ -48,8 +47,7 @@ const DashboardFootnote = ({ intl, variant }) => { }; DashboardFootnote.propTypes = { - intl: intlShape.isRequired, variant: PropTypes.string.isRequired, }; -export default injectIntl(DashboardFootnote); +export default DashboardFootnote; diff --git a/src/courseware/course/course-exit/ProgramCompletion.jsx b/src/courseware/course/course-exit/ProgramCompletion.jsx index 6992a39ed8..7c2c66e1be 100644 --- a/src/courseware/course/course-exit/ProgramCompletion.jsx +++ b/src/courseware/course/course-exit/ProgramCompletion.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; -import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { Alert, Button, Hyperlink } from '@openedx/paragon'; import certImage from '../../../generic/assets/edX_certificate.png'; import messages from './messages'; @@ -20,12 +20,12 @@ import messages from './messages'; const programTypes = ['microbachelors', 'micromasters', 'professional-certificate', 'xseries']; const ProgramCompletion = ({ - intl, progress, title, type, url, }) => { + const intl = useIntl(); if (!programTypes.includes(type) || progress.notStarted !== 0 || progress.inProgress !== 0) { return null; } @@ -98,7 +98,6 @@ const ProgramCompletion = ({ }; ProgramCompletion.propTypes = { - intl: intlShape.isRequired, progress: PropTypes.shape({ completed: PropTypes.number.isRequired, inProgress: PropTypes.number.isRequired, @@ -109,4 +108,4 @@ ProgramCompletion.propTypes = { url: PropTypes.string.isRequired, }; -export default injectIntl(ProgramCompletion); +export default ProgramCompletion; diff --git a/src/courseware/course/course-exit/UpgradeFootnote.jsx b/src/courseware/course/course-exit/UpgradeFootnote.jsx index 325a7f96d1..552f133fc4 100644 --- a/src/courseware/course/course-exit/UpgradeFootnote.jsx +++ b/src/courseware/course/course-exit/UpgradeFootnote.jsx @@ -3,9 +3,7 @@ import { useSelector } from 'react-redux'; import PropTypes from 'prop-types'; import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; -import { - FormattedDate, FormattedMessage, injectIntl, intlShape, -} from '@edx/frontend-platform/i18n'; +import { FormattedDate, FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { Hyperlink } from '@openedx/paragon'; import { faCalendarAlt } from '@fortawesome/free-regular-svg-icons'; @@ -14,7 +12,8 @@ import { logClick } from './utils'; import messages from './messages'; import { useModel } from '../../../generic/model-store'; -const UpgradeFootnote = ({ deadline, href, intl }) => { +const UpgradeFootnote = ({ deadline, href }) => { + const intl = useIntl(); const { courseId } = useSelector(state => state.courseware); const { org } = useModel('courseHomeMeta', courseId); const { administrator } = getAuthenticatedUser(); @@ -60,7 +59,6 @@ const UpgradeFootnote = ({ deadline, href, intl }) => { UpgradeFootnote.propTypes = { deadline: PropTypes.instanceOf(Date).isRequired, href: PropTypes.string.isRequired, - intl: intlShape.isRequired, }; -export default injectIntl(UpgradeFootnote); +export default UpgradeFootnote; diff --git a/src/courseware/course/course-license/CourseLicense.jsx b/src/courseware/course/course-license/CourseLicense.jsx index 656151fd46..f8f9268f8b 100644 --- a/src/courseware/course/course-license/CourseLicense.jsx +++ b/src/courseware/course/course-license/CourseLicense.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import PropTypes from 'prop-types'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCopyright } from '@fortawesome/free-regular-svg-icons'; @@ -105,8 +105,8 @@ function parseLicense(license) { const CourseLicense = ({ license, - intl, }) => { + const intl = useIntl(); const renderAllRightsReservedLicense = () => (