diff --git a/client/src/components/settings/certification.tsx b/client/src/components/settings/certification.tsx index 7896c55bc52..baa93347523 100644 --- a/client/src/components/settings/certification.tsx +++ b/client/src/components/settings/certification.tsx @@ -138,6 +138,113 @@ type CertificationSettingsProps = { } & ClaimedCertifications & Pick; +const LegacyFullStack = (props: CertificationSettingsProps) => { + const { + isFullStackCert, + username, + isHonest, + createFlashMessage, + verifyCert, + is2018DataVisCert, + isApisMicroservicesCert, + isFrontEndLibsCert, + isInfosecQaCert, + isJsAlgoDataStructCert, + isRespWebDesignCert, + t + } = props; + + const fullStackClaimable = + is2018DataVisCert && + isApisMicroservicesCert && + isFrontEndLibsCert && + isInfosecQaCert && + isJsAlgoDataStructCert && + isRespWebDesignCert; + + // Keep the settings page certSlug as full-stack rather than + // legacy-full-stack so we don't break existing links + const certSlug = 'full-stack'; + const certLocation = `/certification/${username}/${certSlug}`; + + const buttonStyle = { + marginBottom: '30px', + padding: '6px 12px', + fontSize: '18px' + }; + + const createClickHandler = + (certSlug: keyof typeof certSlugTypeMap) => + (e: MouseEvent) => { + e.preventDefault(); + if (isFullStackCert) { + return navigate(certLocation); + } + return isHonest + ? verifyCert(certSlug) + : createFlashMessage(honestyInfoMessage); + }; + return ( + + +

+ {t('certification.title.Legacy Full Stack Certification')} +

+
+

+ {t('settings.claim-legacy', { + cert: t('certification.title.Legacy Full Stack Certification') + })} +

+
    +
  • {t('certification.title.Responsive Web Design')}
  • +
  • + {t('certification.title.JavaScript Algorithms and Data Structures')} +
  • +
  • {t('certification.title.Front End Development Libraries')}
  • +
  • {t('certification.title.Data Visualization')}
  • +
  • {t('certification.title.Back End Development and APIs')}
  • +
  • + {t( + 'certification.title.Legacy Information Security and Quality Assurance' + )} +
  • +
+
+ +
+ {fullStackClaimable ? ( + + ) : ( + + )} +
+ +
+ ); +}; + function CertificationSettings(props: CertificationSettingsProps) { const [projectTitle, setProjectTitle] = useState(''); const [challengeFiles, setChallengeFiles] = useState< @@ -288,117 +395,6 @@ function CertificationSettings(props: CertificationSettingsProps) { ]); } - const renderLegacyFullStack = () => { - const { - isFullStackCert, - username, - isHonest, - createFlashMessage, - verifyCert, - is2018DataVisCert, - isApisMicroservicesCert, - isFrontEndLibsCert, - isInfosecQaCert, - isJsAlgoDataStructCert, - isRespWebDesignCert, - t - } = props; - - const fullStackClaimable = - is2018DataVisCert && - isApisMicroservicesCert && - isFrontEndLibsCert && - isInfosecQaCert && - isJsAlgoDataStructCert && - isRespWebDesignCert; - - // Keep the settings page certSlug as full-stack rather than - // legacy-full-stack so we don't break existing links - const certSlug = 'full-stack'; - const certLocation = `/certification/${username}/${certSlug}`; - - const buttonStyle = { - marginBottom: '30px', - padding: '6px 12px', - fontSize: '18px' - }; - - const createClickHandler = - (certSlug: keyof typeof certSlugTypeMap) => - (e: MouseEvent) => { - e.preventDefault(); - if (isFullStackCert) { - return navigate(certLocation); - } - return isHonest - ? verifyCert(certSlug) - : createFlashMessage(honestyInfoMessage); - }; - return ( - - -

- {t('certification.title.Legacy Full Stack Certification')} -

-
-

- {t('settings.claim-legacy', { - cert: t('certification.title.Legacy Full Stack Certification') - })} -

-
    -
  • {t('certification.title.Responsive Web Design')}
  • -
  • - {t( - 'certification.title.JavaScript Algorithms and Data Structures' - )} -
  • -
  • {t('certification.title.Front End Development Libraries')}
  • -
  • {t('certification.title.Data Visualization')}
  • -
  • {t('certification.title.Back End Development and APIs')}
  • -
  • - {t( - 'certification.title.Legacy Information Security and Quality Assurance' - )} -
  • -
-
- -
- {fullStackClaimable ? ( - - ) : ( - - )} -
- -
- ); - }; - const { t } = props; return ( @@ -409,7 +405,7 @@ function CertificationSettings(props: CertificationSettingsProps) { ))} {t('settings.headings.legacy-certs')} - {renderLegacyFullStack()} + {legacyCertifications.map(certName => ( ))}