Skip to content

Commit 767e134

Browse files
committed
feat: remove status from incomplete courses and LPs that have ended
1 parent 42d0dbb commit 767e134

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/learningpath/CourseCard.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export const CourseCard = ({
9696
// Course has ended.
9797
accessText = <>Access ended on <b>{endDateStr}</b></>;
9898
buttonText = 'View';
99+
// Remove status, as learners cannot do anything to change it at this point.
100+
if (status.toLowerCase() !== 'completed') {
101+
statusVariant = '';
102+
}
99103
} else {
100104
// Course is currently available.
101105
accessText = <>Access until <b>{endDateStr}</b></>;
@@ -115,12 +119,12 @@ export const CourseCard = ({
115119
<Card.Body>
116120
<Card.Section className="pb-2.5 d-flex justify-content-between chip-section">
117121
<Chip iconBefore={LmsBook} className="border-0 p-0 course-chip">COURSE</Chip>
118-
<Chip iconBefore={statusIcon} className={`pl-1 status-chip status-${statusVariant}`}>{status.toUpperCase()}</Chip>
122+
{!!statusVariant && <Chip iconBefore={statusIcon} className={`pl-1 status-chip status-${statusVariant}`}>{status.toUpperCase()}</Chip>}
119123
</Card.Section>
120124
<Card.Section className="pt-1 pb-1 title"><h3>{name}</h3></Card.Section>
121125
<Card.Section className="pt-1 pb-1 card-subtitle text-muted">{orgData.name}</Card.Section>
122126
<Card.Section className="pt-1 pb-1">
123-
{status.toLowerCase() === 'in progress' && (
127+
{status.toLowerCase() === 'in progress' && !!statusVariant && (
124128
orientation === 'vertical' ? (
125129
<ProgressBar
126130
now={progressBarPercent}

src/learningpath/LearningPathCard.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ const LearningPathCard = ({ learningPath, showFilters = false }) => {
7878
// Learning path has ended.
7979
accessText = <>Access ended on <b>{maxDateStr}</b></>;
8080
buttonText = 'View';
81+
// Remove status, as learners cannot do anything to change it at this point.
82+
if (status.toLowerCase() !== 'completed') {
83+
statusVariant = '';
84+
}
8185
} else {
8286
// Learning path is currently available.
8387
accessText = <>Access until <b>{maxDateStr}</b></>;
@@ -101,12 +105,12 @@ const LearningPathCard = ({ learningPath, showFilters = false }) => {
101105
<Card.Body>
102106
<Card.Section className="pb-2.5 d-flex justify-content-between chip-section">
103107
<Chip iconBefore={FormatListBulleted} className="border-0 p-0 lp-chip">LEARNING PATH</Chip>
104-
<Chip iconBefore={statusIcon} className={`pl-1 status-chip status-${statusVariant}`}>{status.toUpperCase()}</Chip>
108+
{!!statusVariant && <Chip iconBefore={statusIcon} className={`pl-1 status-chip status-${statusVariant}`}>{status.toUpperCase()}</Chip>}
105109
</Card.Section>
106110
<Card.Section className="pt-1 pb-1 title"><h3>{displayName}</h3></Card.Section>
107111
<Card.Section className="pt-1 pb-1 card-subtitle text-muted">{subtitleLine}</Card.Section>
108112
<Card.Section className="pt-1 pb-1">
109-
{status.toLowerCase() === 'in progress' && (
113+
{status.toLowerCase() === 'in progress' && !!statusVariant && (
110114
orientation === 'vertical' ? (
111115
<ProgressBar
112116
now={progressBarPercent}

0 commit comments

Comments
 (0)