Skip to content

TCA-868 status of a course into the course cards -> TCA-701 #461

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

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
}
}

.completed {
background: $tc-white;
border: 1px solid $black-20;
}

.cardHeader {
display: flex;

Expand Down Expand Up @@ -94,4 +99,8 @@

.cardBottom {
color: $blue-140;

a:nth-child(2) {
margin-left: $space-sm;
}
}
19 changes: 17 additions & 2 deletions src-ts/tools/learn/welcome/courses-card/CoursesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
= useState<string>('secondary')
const [courseProgress, setCourseProgress]: [number | undefined, Dispatch<SetStateAction<number | undefined>>]
= useState<number | undefined>(undefined)
const [linkCompleted, setLinkCompleted]: [string, Dispatch<SetStateAction<string>>]
= useState<string>('')

useEffect(() => {

Expand All @@ -46,10 +48,15 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
if (isCompleted) {
// if the course is completed, View the Certificate
setButtonLabel('View Certificate')
setButtonStyle('primary')
setLink(getCertificatePath(
props.certification.providerName,
props.certification.certification,
))
setLinkCompleted(getCoursePath(
props.certification.providerName,
props.certification.certification,
))

} else if (!inProgress) {
// if there is no in-progress lesson for the course,
Expand Down Expand Up @@ -80,7 +87,7 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
])

return (
<div className={classNames(styles.wrap, !link && 'soon')}>
<div className={classNames(styles.wrap, !link && 'soon', linkCompleted && styles.completed)}>
<div className={styles.cardHeader}>
<CourseBadge type={props.certification.trackType ?? 'DEV'} />
<div className={styles.cardHeaderTitleWrap}>
Expand All @@ -101,7 +108,7 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
</div>

<div className={styles.cardHeaderDividerWrap}>
{courseProgress === undefined ? (
{courseProgress === undefined ? linkCompleted ? undefined : (
<div className={styles.cardHeaderDivider} />
) : (
<ProgressBar progress={courseProgress} />
Expand All @@ -124,6 +131,14 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
route={link}
/>
)}
{linkCompleted && (
<Button
buttonStyle='secondary'
size='xs'
label='Details'
route={linkCompleted}
/>
)}
{!courseEnabled && (
<h4 className='details'>Coming Soon</h4>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, memo, ReactNode } from 'react'
import classNames from 'classnames'

import { FccLogoBlackSvg, IconLevel1, IconLevel2, IconLevel3, IconSolid } from '../../../../../lib'
import { FccLogoBlackSvg, IconLevel1, IconLevel2, IconLevel3, IconSolid, Tooltip } from '../../../../../lib'
import { TCACertification } from '../../../learn-lib'
import { SkillLabel } from '../../skill'
import { ReactComponent as TCACertBadgeDEV1 } from '../assets/web-dev-cert-badge-1.svg'
Expand Down Expand Up @@ -62,7 +62,15 @@ const TCCertCard: FC<TCCertCardProps> = (props: TCCertCardProps) => {

<div className={styles.skills}>
<span className={classNames('body-small', styles.infoText)}>skills taught</span>
{skills.map(skill => <SkillLabel skill={skill} />)}
{skills.slice(0, 3)
.map(skill => <SkillLabel skill={skill} />)}
{skills.length > 3 && (
<Tooltip
content={skills.slice(0, 3)
.join(', ')}
trigger={<SkillLabel skill={`+ ${skills.slice(0, 3).length}`} />}
/>
)}
</div>

<div className={styles.contentFrom}>
Expand Down