Skip to content

Commit

Permalink
Merge branch 'master' into rpenido/fal-3529-bare-bones-taxonomy-detai…
Browse files Browse the repository at this point in the history
…l-page
  • Loading branch information
pomegranited committed Nov 15, 2023
2 parents 56dbdd2 + 2804f38 commit 9c582ed
Show file tree
Hide file tree
Showing 88 changed files with 12,933 additions and 13,096 deletions.
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ Developing

If your devstack includes the default Demo course, you can visit the following URLs to see content:

- `Proctored Exam Settings <http://localhost:2001/course/course-v1:edX+DemoX+Demo_Course/proctored-exam-settings>`_
- `Pages and Resources <http://localhost:2001/course/course-v1:edX+DemoX+Demo_Course/pages-and-resources>`_

Troubleshooting
Expand Down
21,846 changes: 10,949 additions & 10,897 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
"@edx/frontend-component-footer": "^12.3.0",
"@edx/frontend-component-header": "^4.7.0",
"@edx/frontend-enterprise-hotjar": "^2.0.0",
"@edx/frontend-lib-content-components": "1.175.0",
"@edx/frontend-lib-content-components": "1.175.1",
"@edx/frontend-platform": "5.6.1",
"@edx/paragon": "^20.45.4",
"@edx/paragon": "^21.5.6",
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-brands-svg-icons": "5.15.4",
"@fortawesome/free-regular-svg-icons": "5.15.4",
Expand All @@ -67,7 +67,7 @@
"react-router": "6.16.0",
"react-router-dom": "6.16.0",
"react-textarea-autosize": "^8.4.1",
"react-transition-group": "4.4.1",
"react-transition-group": "4.4.5",
"redux": "4.0.5",
"regenerator-runtime": "0.13.7",
"universal-cookie": "^4.0.4",
Expand All @@ -76,15 +76,15 @@
},
"devDependencies": {
"@edx/browserslist-config": "1.2.0",
"@edx/frontend-build": "13.0.1",
"@edx/frontend-build": "13.0.5",
"@edx/reactifex": "^1.0.3",
"@edx/stylelint-config-edx": "^2.3.0",
"@edx/typescript-config": "^1.0.1",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "12.1.5",
"@testing-library/user-event": "^13.2.1",
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
"axios-mock-adapter": "1.20.0",
"axios-mock-adapter": "1.22.0",
"enzyme": "3.11.0",
"enzyme-to-json": "^3.6.2",
"glob": "7.2.3",
Expand Down
7 changes: 4 additions & 3 deletions src/CourseAuthoringRoutes.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import { Routes, Route, useParams } from 'react-router-dom';
import {
Navigate, Routes, Route, useParams,
} from 'react-router-dom';
import { PageWrap } from '@edx/frontend-platform/react';
import Placeholder from '@edx/frontend-lib-content-components';
import CourseAuthoringPage from './CourseAuthoringPage';
import { PagesAndResources } from './pages-and-resources';
import ProctoredExamSettings from './proctored-exam-settings/ProctoredExamSettings';
import EditorContainer from './editors/EditorContainer';
import VideoSelectorContainer from './selectors/VideoSelectorContainer';
import CustomPages from './custom-pages';
Expand Down Expand Up @@ -61,7 +62,7 @@ const CourseAuthoringRoutes = () => {
/>
<Route
path="proctored-exam-settings"
element={<PageWrap><ProctoredExamSettings courseId={courseId} /></PageWrap>}
element={<Navigate replace to={`/course/${courseId}/pages-and-resources`} />}
/>
<Route
path="custom-pages/*"
Expand Down
24 changes: 0 additions & 24 deletions src/CourseAuthoringRoutes.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import initializeStore from './store';

const courseId = 'course-v1:edX+TestX+Test_Course';
const pagesAndResourcesMockText = 'Pages And Resources';
const proctoredExamSeetingsMockText = 'Proctored Exam Settings';
const editorContainerMockText = 'Editor Container';
const videoSelectorContainerMockText = 'Video Selector Container';
const customPagesMockText = 'Custom Pages';
Expand Down Expand Up @@ -36,10 +35,6 @@ jest.mock('./pages-and-resources/PagesAndResources', () => (props) => {
mockComponentFn(props);
return pagesAndResourcesMockText;
});
jest.mock('./proctored-exam-settings/ProctoredExamSettings', () => (props) => {
mockComponentFn(props);
return proctoredExamSeetingsMockText;
});
jest.mock('./editors/EditorContainer', () => (props) => {
mockComponentFn(props);
return editorContainerMockText;
Expand Down Expand Up @@ -76,25 +71,6 @@ describe('<CourseAuthoringRoutes>', () => {
);

expect(screen.getByText(pagesAndResourcesMockText)).toBeVisible();
expect(screen.queryByText(proctoredExamSeetingsMockText)).not.toBeInTheDocument();
expect(mockComponentFn).toHaveBeenCalledWith(
expect.objectContaining({
courseId,
}),
);
});

it('renders the ProctoredExamSettings component when the proctored exam settings route is active', () => {
render(
<AppProvider store={store} wrapWithRouter={false}>
<MemoryRouter initialEntries={['/proctored-exam-settings']}>
<CourseAuthoringRoutes />
</MemoryRouter>
</AppProvider>,
);

expect(screen.queryByText(proctoredExamSeetingsMockText)).toBeInTheDocument();
expect(screen.queryByText(pagesAndResourcesMockText)).not.toBeInTheDocument();
expect(mockComponentFn).toHaveBeenCalledWith(
expect.objectContaining({
courseId,
Expand Down
13 changes: 3 additions & 10 deletions src/custom-pages/CustomPages.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useEffect, useContext, useState } from 'react';
import PropTypes from 'prop-types';
import {
Routes, Route, useLocation, useNavigate,
} from 'react-router-dom';
import { Routes, Route, useNavigate } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import { AppContext, PageWrap } from '@edx/frontend-platform/react';
import { injectIntl, FormattedMessage, intlShape } from '@edx/frontend-platform/i18n';
Expand Down Expand Up @@ -53,13 +51,11 @@ const CustomPages = ({
const [orderedPages, setOrderedPages] = useState([]);
const [currentPage, setCurrentPage] = useState();
const [isOpen, open, close] = useToggle(false);
const [isEditModalOpen, openEditModal, closeEditModal] = useToggle(false);

const courseDetails = useModel('courseDetails', courseId);
document.title = getPageHeadTitle(courseDetails?.name, intl.formatMessage(messages.heading));

const { config } = useContext(AppContext);
const location = useLocation();
const learningCourseURL = `${config.LEARNING_BASE_URL}/course/${courseId}`;

useEffect(() => {
Expand All @@ -79,15 +75,14 @@ const CustomPages = ({
dispatch(updatePageOrder(courseId, newPageOrder));
};
const handleEditClose = () => (content) => {
navigate(location.pathname);
navigate(`/course/${courseId}/custom-pages`);
if (!content?.metadata) {
closeEditModal();
setCurrentPage(null);
return;
}
dispatch(updateSingleCustomPage({
blockId: currentPage,
metadata: { displayName: content.metadata.display_name },
onClose: closeEditModal,
setCurrentPage,
}));
};
Expand Down Expand Up @@ -192,7 +187,6 @@ const CustomPages = ({
deletePageStatus,
courseId,
setCurrentPage,
openEditModal,
}}
/>
</SortableItem>
Expand Down Expand Up @@ -262,7 +256,6 @@ const CustomPages = ({
<PageWrap>
<EditModal
courseId={courseId}
isOpen={isEditModalOpen}
pageId={currentPage}
onClose={handleEditClose}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import {
} from '@edx/paragon';
import { ContentCopy, InfoOutline } from '@edx/paragon/icons';

import { getFileSizeToClosestByte } from '../data/utils';
import { getFileSizeToClosestByte } from '../generic/utils';
import messages from './messages';

const FileInfoAssetSidebar = ({
const FileInfoModalSidebar = ({
asset,
handleLockedAsset,
// injected
Expand Down Expand Up @@ -109,7 +109,7 @@ const FileInfoAssetSidebar = ({
</Stack>
);
};
FileInfoAssetSidebar.propTypes = {
FileInfoModalSidebar.propTypes = {
asset: PropTypes.shape({
displayName: PropTypes.string.isRequired,
wrapperType: PropTypes.string.isRequired,
Expand All @@ -127,4 +127,4 @@ FileInfoAssetSidebar.propTypes = {
intl: intlShape.isRequired,
};

export default injectIntl(FileInfoAssetSidebar);
export default injectIntl(FileInfoModalSidebar);
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
Icon,
Image,
} from '@edx/paragon';
import { getSrc } from '../data/utils';
import { getSrc } from './data/utils';
import messages from './messages';

const AssetThumbnail = ({
const FileThumbnail = ({
thumbnail,
wrapperType,
externalUrl,
Expand Down Expand Up @@ -50,13 +50,13 @@ const AssetThumbnail = ({
</div>
);
};
AssetThumbnail.defaultProps = {
FileThumbnail.defaultProps = {
thumbnail: null,
wrapperType: null,
externalUrl: null,
displayName: null,
};
AssetThumbnail.propTypes = {
FileThumbnail.propTypes = {
thumbnail: PropTypes.string,
wrapperType: PropTypes.string,
externalUrl: PropTypes.string,
Expand All @@ -69,4 +69,4 @@ AssetThumbnail.propTypes = {
intl: intlShape.isRequired,
};

export default injectIntl(AssetThumbnail);
export default injectIntl(FileThumbnail);
Loading

0 comments on commit 9c582ed

Please sign in to comment.