diff --git a/client/src/client-only-routes/show-certification.tsx b/client/src/client-only-routes/show-certification.tsx
index 234c1eb665d..5f8d6c9bd52 100644
--- a/client/src/client-only-routes/show-certification.tsx
+++ b/client/src/client-only-routes/show-certification.tsx
@@ -123,6 +123,157 @@ const mapDispatchToProps = (dispatch: Dispatch) =>
dispatch
);
+const DonationCloseBtn = ({ onClick }: { onClick: () => void }) => {
+ const { t } = useTranslation();
+
+ return (
+
+
+
+ );
+};
+
+const DonationSection = ({
+ isDonationSubmitted,
+ handleProcessing,
+ hideDonationSection
+}: {
+ isDonationSubmitted: boolean;
+ handleProcessing: () => void;
+ hideDonationSection: () => void;
+}) => {
+ const { t } = useTranslation();
+
+ return (
+
+
+ {!isDonationSubmitted && (
+
+
+
+ {t('donate.only-you')}
+
+
+
+ )}
+
+
+
+
+
+
+
+
+ {isDonationSubmitted && (
+
+ )}
+
+
+
+
+ );
+};
+
+const ShareCertBtns = ({
+ username,
+ certDate,
+ certTitle,
+ certSlug,
+ certURL
+}: {
+ username: string;
+ certDate: Date;
+ certTitle: string;
+ certSlug: CertSlug;
+ certURL: string;
+}) => {
+ const { t } = useTranslation();
+
+ const certYear = certDate.getFullYear();
+ const certMonth = certDate.getMonth();
+ const urlFriendlyCertTitle = encodeURIComponent(certTitle);
+ const linkedInCredentialId = `${username}-${linkedInCredentialIds[certSlug]}`;
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
const ShowCertification = (props: ShowCertificationProps): JSX.Element => {
const { t } = useTranslation();
const [isDonationSubmitted, setIsDonationSubmitted] = useState(false);
@@ -230,135 +381,22 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => {
const displayName = userFullName ?? username;
const certDate = new Date(date);
- const certYear = certDate.getFullYear();
- const certMonth = certDate.getMonth();
+
const certURL = `https://freecodecamp.org${pathname}`;
- const donationCloseBtn = (
-
-
-
- );
-
- const donationSection = (
-
-
- {!isDonationSubmitted && (
-
-
-
- {t('donate.only-you')}
-
-
-
- )}
-
-
-
-
-
-
-
-
- {isDonationSubmitted && donationCloseBtn}
-
-
-
-
- );
-
- const urlFriendlyCertTitle = encodeURIComponent(certTitle);
- const linkedInCredentialId = `${username}-${linkedInCredentialIds[certSlug]}`;
-
- const shareCertBtns = (
-
-
-
-
-
-
-
-
-
-
-
-
- );
-
const isMicrosoftCert = certSlug === Certification.FoundationalCSharp;
return (
- {isDonationDisplayed && !isDonationClosed ? donationSection : ''}
+ {isDonationDisplayed && !isDonationClosed ? (
+
+ ) : (
+ ''
+ )}
{
data-playwright-test-label='cert-links'
>
- {signedInUserName === username ? shareCertBtns : ''}
+ {signedInUserName === username ? (
+
+ ) : (
+ ''
+ )}