📚: {courseId}
diff --git a/src/plugin-slots/ProgressTabCertificateStatusSidePanelSlot/README.md b/src/plugin-slots/ProgressTabCertificateStatusSidePanelSlot/README.md index e661a03788..813671b7e7 100644 --- a/src/plugin-slots/ProgressTabCertificateStatusSidePanelSlot/README.md +++ b/src/plugin-slots/ProgressTabCertificateStatusSidePanelSlot/README.md @@ -20,7 +20,7 @@ The following `env.config.jsx` will render the `course_id` of the course as a `< ```js import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; -import { useContextId } from './src/data/hooks'; +import { useParams } from 'react-router-dom'; const config = { pluginSlots: { @@ -33,7 +33,7 @@ const config = { id: 'custom_certificate_status_content', type: DIRECT_PLUGIN, RenderWidget: () => { - const courseId = useContextId(); + const { courseId } = useParams(); return (📚: {courseId}
diff --git a/src/plugin-slots/ProgressTabCourseGradeSlot/README.md b/src/plugin-slots/ProgressTabCourseGradeSlot/README.md index 1e5a343e32..6ab6fe4967 100644 --- a/src/plugin-slots/ProgressTabCourseGradeSlot/README.md +++ b/src/plugin-slots/ProgressTabCourseGradeSlot/README.md @@ -19,7 +19,7 @@ The following `env.config.jsx` will render the `course_id` of the course as a `< ```js import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; -import { useContextId } from './src/data/hooks'; +import { useParams } from 'react-router-dom'; const config = { pluginSlots: { @@ -32,7 +32,7 @@ const config = { id: 'custom_course_grade_content', type: DIRECT_PLUGIN, RenderWidget: () => { - const courseId = useContextId(); + const { courseId } = useParams(); return (📚: {courseId}
diff --git a/src/plugin-slots/ProgressTabGradeBreakdownSlot/README.md b/src/plugin-slots/ProgressTabGradeBreakdownSlot/README.md index 06d7bc2129..b01cbb41f3 100644 --- a/src/plugin-slots/ProgressTabGradeBreakdownSlot/README.md +++ b/src/plugin-slots/ProgressTabGradeBreakdownSlot/README.md @@ -19,7 +19,7 @@ The following `env.config.jsx` will render the `course_id` of the course as a `< ```js import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; -import { useContextId } from './src/data/hooks'; +import { useParams } from 'react-router-dom'; const config = { pluginSlots: { @@ -32,7 +32,7 @@ const config = { id: 'custom_grade_summary_content', type: DIRECT_PLUGIN, RenderWidget: () => { - const courseId = useContextId(); + const { courseId } = useParams(); return (📚: {courseId}
diff --git a/src/plugin-slots/ProgressTabGradeBreakdownSlot/index.jsx b/src/plugin-slots/ProgressTabGradeBreakdownSlot/index.jsx index 54fccfaffc..7be22fb928 100644 --- a/src/plugin-slots/ProgressTabGradeBreakdownSlot/index.jsx +++ b/src/plugin-slots/ProgressTabGradeBreakdownSlot/index.jsx @@ -1,13 +1,11 @@ -import { useModel } from '@src/generic/model-store'; import { PluginSlot } from '@openedx/frontend-plugin-framework'; import React from 'react'; import DetailedGrades from '../../course-home/progress-tab/grades/detailed-grades/DetailedGrades'; import GradeSummary from '../../course-home/progress-tab/grades/grade-summary/GradeSummary'; -import { useContextId } from '../../data/hooks'; +import { useProgressData } from '../../course-home/progress-tab/hooks'; const ProgressTabGradeBreakdownSlot = () => { - const courseId = useContextId(); - const { gradesFeatureIsFullyLocked } = useModel('progress', courseId); + const { gradesFeatureIsFullyLocked } = useProgressData(); const applyLockedOverlay = gradesFeatureIsFullyLocked ? 'locked-overlay' : ''; return (📚: {courseId}
diff --git a/src/tab-page/TabContainer.jsx b/src/tab-page/TabContainer.jsx index d63aa4ed82..66bda599a1 100644 --- a/src/tab-page/TabContainer.jsx +++ b/src/tab-page/TabContainer.jsx @@ -11,21 +11,16 @@ const TabContainer = (props) => { fetch, slice, tab, - isProgressTab, } = props; - const { courseId: courseIdFromUrl, targetUserId } = useParams(); + const { courseId: courseIdFromUrl } = useParams(); const dispatch = useDispatch(); useEffect(() => { // The courseId from the URL is the course we WANT to load. - if (isProgressTab) { - dispatch(fetch(courseIdFromUrl, targetUserId)); - } else { - dispatch(fetch(courseIdFromUrl)); - } + dispatch(fetch(courseIdFromUrl)); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [courseIdFromUrl, targetUserId]); + }, [courseIdFromUrl]); // The courseId from the store is the course we HAVE loaded. If the URL changes, // we don't want the application to adjust to it until it has actually loaded the new data. @@ -50,11 +45,6 @@ TabContainer.propTypes = { fetch: PropTypes.func.isRequired, slice: PropTypes.string.isRequired, tab: PropTypes.string.isRequired, - isProgressTab: PropTypes.bool, -}; - -TabContainer.defaultProps = { - isProgressTab: false, }; export default TabContainer; diff --git a/src/tab-page/TabContainer.test.jsx b/src/tab-page/TabContainer.test.jsx index fc0d5f39e4..3eb95f6ad0 100644 --- a/src/tab-page/TabContainer.test.jsx +++ b/src/tab-page/TabContainer.test.jsx @@ -51,32 +51,4 @@ describe('Tab Container', () => { expect(mockDispatch).toHaveBeenCalledWith(courseId); expect(screen.getByTestId('TabPage')).toBeInTheDocument(); }); - - it('Should handle passing in a targetUserId', () => { - const targetUserId = '1'; - - render( -