diff --git a/src/course-outline/CourseOutline.jsx b/src/course-outline/CourseOutline.jsx index 8c5530ca3f..25c6564bce 100644 --- a/src/course-outline/CourseOutline.jsx +++ b/src/course-outline/CourseOutline.jsx @@ -363,6 +363,8 @@ const CourseOutline = ({ courseId }) => { unit={unit} subsection={subsection} section={section} + isSelfPaced={statusBarData.isSelfPaced} + isCustomRelativeDatesActive={isCustomRelativeDatesActive} index={unitIndex} canMoveItem={canMoveItem(subsection.childInfo.children)} savingStatus={savingStatus} diff --git a/src/course-outline/unit-card/UnitCard.jsx b/src/course-outline/unit-card/UnitCard.jsx index 4f440ec29e..e7745770a3 100644 --- a/src/course-outline/unit-card/UnitCard.jsx +++ b/src/course-outline/unit-card/UnitCard.jsx @@ -9,12 +9,15 @@ import CardHeader from '../card-header/CardHeader'; import BaseTitleWithStatusBadge from '../card-header/BaseTitleWithStatusBadge'; import ConditionalSortableElement from '../drag-helper/ConditionalSortableElement'; import TitleLink from '../card-header/TitleLink'; +import XBlockStatus from '../xblock-status/XBlockStatus'; import { getItemStatus, getItemStatusBorder, scrollToElement } from '../utils'; const UnitCard = ({ unit, subsection, section, + isSelfPaced, + isCustomRelativeDatesActive, index, canMoveItem, onOpenPublishModal, @@ -146,6 +149,13 @@ const UnitCard = ({ namePrefix={namePrefix} actions={actions} /> +
+ +
); @@ -193,6 +203,8 @@ UnitCard.propTypes = { index: PropTypes.number.isRequired, canMoveItem: PropTypes.func.isRequired, onOrderChange: PropTypes.func.isRequired, + isSelfPaced: PropTypes.bool.isRequired, + isCustomRelativeDatesActive: PropTypes.bool.isRequired, }; export default UnitCard; diff --git a/src/course-outline/unit-card/UnitCard.scss b/src/course-outline/unit-card/UnitCard.scss index cf30dfcc2a..31d56e18e9 100644 --- a/src/course-outline/unit-card/UnitCard.scss +++ b/src/course-outline/unit-card/UnitCard.scss @@ -1,10 +1,6 @@ .unit-card { flex-grow: 1; - .unit-card__content { - margin: $spacer; - } - .item-card-header__badge-status { background: $light-100; } diff --git a/src/course-outline/xblock-status/XBlockStatus.jsx b/src/course-outline/xblock-status/XBlockStatus.jsx index 5d38a5ae22..95e43d3be4 100644 --- a/src/course-outline/xblock-status/XBlockStatus.jsx +++ b/src/course-outline/xblock-status/XBlockStatus.jsx @@ -45,6 +45,7 @@ const XBlockStatus = ({ } = item; const isInstructorPaced = !isSelfPaced; + const isVertical = category === COURSE_BLOCK_NAMES.vertical.id; const statusMessages = []; let releaseLabel = messages.unscheduledLabel; @@ -83,12 +84,12 @@ const XBlockStatus = ({ if (!staffOnlyMessage) { const { selectedPartitionIndex, selectedGroupsLabel } = userPartitionInfo; - if (selectedPartitionIndex !== -1 && !isNaN(selectedPartitionIndex) && category === COURSE_BLOCK_NAMES.vertical.id) { + if (selectedPartitionIndex !== -1 && !isNaN(selectedPartitionIndex) && isVertical) { statusMessages.push({ icon: GroupsIcon, text: intl.formatMessage(messages.restrictedUnitAccess, { selectedGroupsLabel }), }); - } else if (hasPartitionGroupComponents && category === COURSE_BLOCK_NAMES.vertical.id) { + } else if (hasPartitionGroupComponents && isVertical) { statusMessages.push({ icon: GroupsIcon, text: intl.formatMessage(messages.restrictedUnitAccessToSomeContent), @@ -97,16 +98,14 @@ const XBlockStatus = ({ } const releaseStatusDiv = () => ( - <> +
{intl.formatMessage(messages.releaseStatusScreenReaderTitle)} -
- - {intl.formatMessage(releaseLabel)} - {releaseDate && releaseDate} -
- + + {intl.formatMessage(releaseLabel)} + {releaseDate && releaseDate} +
) const gradingTypeDiv = () => ( @@ -121,15 +120,15 @@ const XBlockStatus = ({ ) - const dueDateDiv = () => ( - <> - {dueDate && isInstructorPaced && ( + const dueDateDiv = () => { + if (dueDate && isInstructorPaced) { + return (
{intl.formatMessage(messages.dueLabel)} {dueDate}
- )} - - ) + ) + } + } const selfPacedRelativeDueWeeksDiv = () => (
@@ -141,7 +140,7 @@ const XBlockStatus = ({ ) const explanatoryMessageDiv = () => ( - {explanatoryMessage} + {explanatoryMessage} ) const renderGradingTypeAndDueDate = () => { @@ -202,34 +201,36 @@ const XBlockStatus = ({ if (gradingPolicyMismatch) { return (
{intl.formatMessage(messages.gradingPolicyMismatchText, { gradingType })}
) - } else { - return null; } } const renderStatusMessages = () => { - return ( - <> - {statusMessages.map(({ icon, text }) => ( -
- - {text} -
- ))} - - ) + if (statusMessages.length > 0) { + return ( +
+ {statusMessages.map(({ icon, text }) => ( +
+ + {text} +
+ ))} +
+ ) + } } return (
- {explanatoryMessage ? explanatoryMessageDiv(): isInstructorPaced && releaseStatusDiv()} - {renderGradingTypeAndDueDate()} + {!isVertical && ( + explanatoryMessage ? explanatoryMessageDiv(): isInstructorPaced && releaseStatusDiv() + )} + {!isVertical && renderGradingTypeAndDueDate()} {hideAfterDue && hideAfterDueMessage()} {renderStatusMessages()} {renderGradingPolicyAlert()}