@@ -24,6 +24,7 @@ import {
2424 TCACertificationProviderData ,
2525 useGetTCACertification ,
2626 useGetTCACertificationProgress ,
27+ useTcaCertificationModal ,
2728} from '../../learn-lib'
2829import { perks } from '../certification-details-modal/certif-details-content/data'
2930import { PerksSection } from '../perks-section'
@@ -65,6 +66,11 @@ const EnrollmentPage: FC<{}> = () => {
6566
6667 const ready : boolean = profileReady && certificationReady && progressReady && ! ! profile
6768
69+ const tcaCertificationCompletedModal : ReactNode = useTcaCertificationModal (
70+ progress ? certification . dashedName : undefined ,
71+ navToCertificationDetails ,
72+ )
73+
6874 if ( ready && profile && ! userInfo . current ) {
6975 userInfo . current = { ...profile }
7076 }
@@ -95,9 +101,15 @@ const EnrollmentPage: FC<{}> = () => {
95101 } )
96102 } , [ certification ?. id , profile , setCertificateProgress ] )
97103
104+ function navToCertificationDetails ( ) : void {
105+ navigate ( getTCACertificationPath ( certification . dashedName ) )
106+ }
107+
98108 function closeEnrolledModal ( ) : void {
99109 setIsEnrolledModalOpen ( false )
100- navigate ( getTCACertificationPath ( certification . dashedName ) )
110+ if ( ! tcaCertificationCompletedModal ) {
111+ navToCertificationDetails ( )
112+ }
101113 }
102114
103115 function renderMainContent ( ) : ReactNode {
@@ -114,6 +126,7 @@ const EnrollmentPage: FC<{}> = () => {
114126 certification = { certification }
115127 onClose = { closeEnrolledModal }
116128 />
129+ { ! isEnrolledModalOpen && tcaCertificationCompletedModal }
117130 </ >
118131 ) : null
119132 }
0 commit comments