@@ -28,6 +28,8 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
28
28
= useState < string > ( 'secondary' )
29
29
const [ courseProgress , setCourseProgress ] : [ number | undefined , Dispatch < SetStateAction < number | undefined > > ]
30
30
= useState < number | undefined > ( undefined )
31
+ const [ linkCompleted , setLinkCompleted ] : [ string , Dispatch < SetStateAction < string > > ]
32
+ = useState < string > ( '' )
31
33
32
34
useEffect ( ( ) => {
33
35
@@ -46,10 +48,15 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
46
48
if ( isCompleted ) {
47
49
// if the course is completed, View the Certificate
48
50
setButtonLabel ( 'View Certificate' )
51
+ setButtonStyle ( 'primary' )
49
52
setLink ( getCertificatePath (
50
53
props . certification . providerName ,
51
54
props . certification . certification ,
52
55
) )
56
+ setLinkCompleted ( getCoursePath (
57
+ props . certification . providerName ,
58
+ props . certification . certification ,
59
+ ) )
53
60
54
61
} else if ( ! inProgress ) {
55
62
// if there is no in-progress lesson for the course,
@@ -80,7 +87,7 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
80
87
] )
81
88
82
89
return (
83
- < div className = { classNames ( styles . wrap , ! link && 'soon' ) } >
90
+ < div className = { classNames ( styles . wrap , ! link && 'soon' , linkCompleted && styles . completed ) } >
84
91
< div className = { styles . cardHeader } >
85
92
< CourseBadge type = { props . certification . trackType ?? 'DEV' } />
86
93
< div className = { styles . cardHeaderTitleWrap } >
@@ -101,7 +108,7 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
101
108
</ div >
102
109
103
110
< div className = { styles . cardHeaderDividerWrap } >
104
- { courseProgress === undefined ? (
111
+ { courseProgress === undefined ? linkCompleted ? undefined : (
105
112
< div className = { styles . cardHeaderDivider } />
106
113
) : (
107
114
< ProgressBar progress = { courseProgress } />
@@ -124,6 +131,14 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
124
131
route = { link }
125
132
/>
126
133
) }
134
+ { linkCompleted && (
135
+ < Button
136
+ buttonStyle = 'secondary'
137
+ size = 'xs'
138
+ label = 'Details'
139
+ route = { linkCompleted }
140
+ />
141
+ ) }
127
142
{ ! courseEnabled && (
128
143
< h4 className = 'details' > Coming Soon</ h4 >
129
144
) }
0 commit comments