Skip to content

Commit

Permalink
fix: dont allow course detail page to break editor (#790)
Browse files Browse the repository at this point in the history
At the moment, editors served from V1 libraries are broken because they use the course authoring MFE url (because they use editors in the same way courses do).
  • Loading branch information
connorhaugh authored Jan 11, 2024
1 parent 0debaec commit a3975f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/CourseAuthoringPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ const CourseAuthoringPage = ({ courseId, children }) => {
const courseDetailStatus = useSelector(state => state.courseDetail.status);
const inProgress = courseDetailStatus === RequestStatus.IN_PROGRESS;
const { pathname } = useLocation();
const showHeader = !pathname.includes('/editor');
const isEditor = pathname.includes('/editor');

if (courseDetailStatus === RequestStatus.NOT_FOUND) {
if (courseDetailStatus === RequestStatus.NOT_FOUND && !isEditor) {
return (
<NotFoundAlert />
);
Expand All @@ -72,8 +72,8 @@ const CourseAuthoringPage = ({ courseId, children }) => {
using url pattern containing /editor/,
we shouldn't have the header and footer on these pages.
This functionality will be removed in TNL-9591 */}
{inProgress ? showHeader && <Loading />
: (showHeader && (
{inProgress ? !isEditor && <Loading />
: (!isEditor && (
<AppHeader
courseNumber={courseNumber}
courseOrg={courseOrg}
Expand All @@ -83,7 +83,7 @@ const CourseAuthoringPage = ({ courseId, children }) => {
)
)}
{children}
{!inProgress && showHeader && <StudioFooter />}
{!inProgress && !isEditor && <StudioFooter />}
</div>
);
};
Expand Down

0 comments on commit a3975f4

Please sign in to comment.