diff --git a/src/course-home/outline-tab/SequenceLink.jsx b/src/course-home/outline-tab/SequenceLink.jsx index 0bfac7d081..7e8aa04f43 100644 --- a/src/course-home/outline-tab/SequenceLink.jsx +++ b/src/course-home/outline-tab/SequenceLink.jsx @@ -1,8 +1,5 @@ -import { getConfig } from '@edx/frontend-platform'; -import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; -import classNames from 'classnames'; import { Link } from 'react-router-dom'; import { Collapsible, Hyperlink, IconButton } from '@edx/paragon'; import { @@ -11,10 +8,8 @@ import { injectIntl, intlShape, } from '@edx/frontend-platform/i18n'; -// import { faCheckCircle as fasCheckCircle } from '@fortawesome/free-solid-svg-icons'; import { faCheckCircle as fasCheckCircle, faMinus, faPlus } from '@fortawesome/free-solid-svg-icons'; import { faCheckCircle as farCheckCircle } from '@fortawesome/free-regular-svg-icons'; -import { faSpinner } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import UnitLink from './UnitLink'; @@ -40,8 +35,8 @@ function SequenceLink({ complete, description, due, - legacyWebUrl, - showLink, + // legacyWebUrl, + // showLink, title, unitIds, } = sequence; @@ -54,80 +49,99 @@ function SequenceLink({ const { userTimezone, } = useModel('outline', courseId); - const { - course - } = useModel('outline', courseId); - const { - canLoadCourseware, - } = useModel('courseHomeMeta', courseId); + + // const { + // canLoadCourseware, + // } = useModel('courseHomeMeta', courseId); const timezoneFormatArgs = userTimezone ? { timeZone: userTimezone } : {}; + const [open, setOpen] = useState(defaultOpen); - useEffect(() => { - setOpen(defaultOpen); - }, []); + setOpen(expand); + }, [expand]); + + // canLoadCourseware is true if the Courseware MFE is enabled, false otherwise - const coursewareUrl = ( - canLoadCourseware - ? {title} - : {title} - ); - const displayTitle = showLink ? coursewareUrl : title; + // const coursewareUrl = ( + // canLoadCourseware + // ? {title} + // : {title} + // ); + // const displayTitle = showLink ? coursewareUrl : title; const sequenceTitle = (
-
- {complete ? ( -
-
- {displayTitle} - - , {intl.formatMessage(complete ? messages.completedAssignment : messages.incompleteAssignment)} - - -
- {due && ( -
- - - ), - description: description || '', - }} + { unitIds.length > 0 ? ( +
+
+ {complete ? ( + + ) : ( +
+
+ {title} + + , {intl.formatMessage(complete ? messages.completedAssignment : messages.incompleteAssignment)} + + +
+ {due && ( +
+ + + ), + description: description || '', + }} + /> + +
+ )} +
+ ) : ( +
+
+
+
+ {title} (No Units) +
)}
diff --git a/src/course-home/outline-tab/UnitLink.jsx b/src/course-home/outline-tab/UnitLink.jsx index d669407056..9c5f289f01 100644 --- a/src/course-home/outline-tab/UnitLink.jsx +++ b/src/course-home/outline-tab/UnitLink.jsx @@ -52,7 +52,7 @@ function UnitLink({ return (
  • -
    +
    {complete ? ( @@ -107,14 +107,8 @@ function UnitLink({
    )}
    -
  • - - - - ) - } UnitLink.propTypes = { diff --git a/src/courseware/data/api.js b/src/courseware/data/api.js index ccbc3d61c3..857d83d699 100644 --- a/src/courseware/data/api.js +++ b/src/courseware/data/api.js @@ -134,6 +134,7 @@ export async function getCourseMetadata(courseId) { return normalizeMetadata(metadata); } + function normalizeSequenceMetadata(sequence) { return { sequence: { @@ -180,7 +181,7 @@ export async function getSequenceMetadata(sequenceId) { .get(`${getConfig().LMS_BASE_URL}/api/courseware/sequence/${sequenceId}`, {}); return normalizeSequenceMetadata(data); -} +} const getSequenceHandlerUrl = (courseId, sequenceId) => `${getConfig().LMS_BASE_URL}/courses/${courseId}/xblock/${sequenceId}/handler`;