diff --git a/src/index.scss b/src/index.scss index 8c50f364..fd94b291 100755 --- a/src/index.scss +++ b/src/index.scss @@ -14,31 +14,6 @@ flex: 0; } - main { - flex: 1; - display: flex; - flex-direction: column; - - iframe { - flex: 1; - margin: 0 -10px; - } - - nav { - display: flex; - flex-direction: row; - width: 100%; - - .unit-button { - flex: 1; - } - - button { - margin: 0px 5px; - } - } - } - footer { flex: 0; } diff --git a/src/learning-sequence/LearningSequencePage.jsx b/src/learning-sequence/LearningSequencePage.jsx index d89135b5..dd64a1e7 100644 --- a/src/learning-sequence/LearningSequencePage.jsx +++ b/src/learning-sequence/LearningSequencePage.jsx @@ -19,25 +19,24 @@ function LearningSequencePage({ match, intl }) { const { blocks, loaded, courseBlockId } = useCourseStructure(courseId); return ( -
-
- - {!loaded && } +
+ + {!loaded && } + + {loaded && } + + - {loaded && } - - -
); } diff --git a/src/learning-sequence/data/hooks.js b/src/learning-sequence/data/hooks.js index 233d2494..5f6c2c04 100644 --- a/src/learning-sequence/data/hooks.js +++ b/src/learning-sequence/data/hooks.js @@ -97,9 +97,10 @@ export function useNextUnit() { } export function useCurrentSubSectionUnits() { - const { blocks } = useContext(CourseStructureContext); + const { loaded, blocks } = useContext(CourseStructureContext); const subSection = useCurrentSubSection(); - return subSection.children.map(id => blocks[id]); + + return loaded ? subSection.children.map(id => blocks[id]) : []; } export function useSubSectionIdList() { diff --git a/src/learning-sequence/sub-section/SubSection.jsx b/src/learning-sequence/sub-section/SubSection.jsx index daff86cb..aa92656b 100644 --- a/src/learning-sequence/sub-section/SubSection.jsx +++ b/src/learning-sequence/sub-section/SubSection.jsx @@ -20,7 +20,7 @@ export default function SubSection() { const ready = blocks !== null && metadata !== null; return ready && ( -
+
diff --git a/src/learning-sequence/sub-section/SubSectionNavigation.jsx b/src/learning-sequence/sub-section/SubSectionNavigation.jsx index 3aa03fc8..58db8925 100644 --- a/src/learning-sequence/sub-section/SubSectionNavigation.jsx +++ b/src/learning-sequence/sub-section/SubSectionNavigation.jsx @@ -1,10 +1,11 @@ import React, { useCallback, useContext } from 'react'; +import PropTypes from 'prop-types'; import { history } from '@edx/frontend-platform'; import { Button } from '@edx/paragon'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faFilm, faBook, faPencilAlt, faTasks } from '@fortawesome/free-solid-svg-icons'; -import { useCurrentSubSection, usePreviousUnit, useNextUnit, useCurrentSubSectionUnits } from '../data/hooks'; +import { useCurrentSubSection, usePreviousUnit, useNextUnit, useCurrentSubSectionUnits, useCurrentUnit } from '../data/hooks'; import CourseStructureContext from '../CourseStructureContext'; function UnitIcon({ type }) { @@ -48,7 +49,7 @@ export default function SubSectionNavigation() { }); return ( -