feat: add functionality to see unit draft preview (#1501)

* feat: add functionality to see unit draft preview

* feat: add tests for course link redirects

* fix: course redirect unit to sequnce unit redirect

* fix: test coverage
This commit is contained in:
Kristin Aoki
2024-10-28 10:31:17 -04:00
committed by GitHub
parent 6f1159617e
commit d47433ee83
17 changed files with 1196 additions and 173 deletions

View File

@@ -1,6 +1,6 @@
import React, { Suspense, useEffect } from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { useIntl } from '@edx/frontend-platform/i18n';
import PageLoading from '../../../generic/PageLoading';
import { useModel } from '../../../generic/model-store';
@@ -11,12 +11,13 @@ const ContentLock = React.lazy(() => import('./content-lock'));
const SequenceContent = ({
gated,
intl,
courseId,
sequenceId,
unitId,
unitLoadedHandler,
isStaff,
}) => {
const intl = useIntl();
const sequence = useModel('sequences', sequenceId);
// Go back to the top of the page whenever the unit or sequence changes.
@@ -59,6 +60,7 @@ const SequenceContent = ({
key={unitId}
id={unitId}
onLoaded={unitLoadedHandler}
isStaff={isStaff}
/>
);
};
@@ -69,11 +71,11 @@ SequenceContent.propTypes = {
sequenceId: PropTypes.string.isRequired,
unitId: PropTypes.string,
unitLoadedHandler: PropTypes.func.isRequired,
intl: intlShape.isRequired,
isStaff: PropTypes.bool.isRequired,
};
SequenceContent.defaultProps = {
unitId: null,
};
export default injectIntl(SequenceContent);
export default SequenceContent;