Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed broken "Pages and Resources" page #446

Merged
merged 2 commits into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions src/CourseAuthoringPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,34 @@ import { getCourseAppsApiStatus, getLoadingStatus } from './pages-and-resources/
import { RequestStatus } from './data/constants';
import Loading from './generic/Loading';

const AppHeader = (courseNumber, courseOrg, courseTitle, courseId) => (
const AppHeader = ({
courseNumber, courseOrg, courseTitle, courseId,
}) => (
<Header
courseNumber={courseNumber}
courseOrg={courseOrg}
courseTitle={courseTitle}
courseId={courseId}
/>
);
);

const AppFooter = () => (
<div className="mt-6">
<Footer />
</div>
);
AppHeader.propTypes = {
courseId: PropTypes.string.isRequired,
courseNumber: PropTypes.string,
courseOrg: PropTypes.string,
courseTitle: PropTypes.string.isRequired,
};

AppHeader.defaultProps = {
courseNumber: null,
courseOrg: null,
};

const AppFooter = () => (
<div className="mt-6">
<Footer />
</div>
);

const CourseAuthoringPage = ({ courseId, children }) => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -57,7 +71,14 @@ const CourseAuthoringPage = ({ courseId, children }) => {
we shouldn't have the header and footer on these pages.
This functionality will be removed in TNL-9591 */}
{inProgress ? !pathname.includes('/editor/') && <Loading />
: <AppHeader courseNumber={courseNumber} courseOrg={courseOrg} courseTitle={courseTitle} courseId={courseId} />}
: (
<AppHeader
courseNumber={courseNumber}
courseOrg={courseOrg}
courseTitle={courseTitle}
courseId={courseId}
/>
)}
{children}
{!inProgress && <AppFooter />}
</div>
Expand Down