feat(client): add quick superblock cert claim steps (#42031)
* feat(client): add quick superblock cert claim steps * remove comments
This commit is contained in:
@@ -554,5 +554,14 @@
|
|||||||
"Neural Network SMS Text Classifier": "Neural Network SMS Text Classifier"
|
"Neural Network SMS Text Classifier": "Neural Network SMS Text Classifier"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"certification-card": {
|
||||||
|
"title": "Steps to Claim Your Certification",
|
||||||
|
"intro": "Complete the following steps to claim and view your {{i18nCertText}}",
|
||||||
|
"complete-project": "Complete {{i18nCertText}} Projects",
|
||||||
|
"accept-honesty": "Accept our Academic Honesty Policy",
|
||||||
|
"set-name": "Set your name, and make it public",
|
||||||
|
"set-certs-public": "Set your certificication settings to public",
|
||||||
|
"set-profile-public": "Set your profile settings to public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ const Honesty = ({ isHonest, updateIsHonest }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<section className='honesty-policy'>
|
<section className='honesty-policy' id='honesty-policy'>
|
||||||
<SectionHeader>{t('settings.headings.honesty')}</SectionHeader>
|
<SectionHeader>{t('settings.headings.honesty')}</SectionHeader>
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<Panel className='honesty-panel'>
|
<Panel className='honesty-panel'>
|
||||||
|
@@ -66,7 +66,7 @@ class PrivacySettings extends Component {
|
|||||||
} = user.profileUI;
|
} = user.profileUI;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='privacy-settings'>
|
<div className='privacy-settings' id='privacy-settings'>
|
||||||
<SectionHeader>{t('settings.headings.privacy')}</SectionHeader>
|
<SectionHeader>{t('settings.headings.privacy')}</SectionHeader>
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<p>{t('settings.privacy')}</p>
|
<p>{t('settings.privacy')}</p>
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
exports[`<Honesty /> <Honesty /> snapshot when isHonest is false: Honesty 1`] = `
|
exports[`<Honesty /> <Honesty /> snapshot when isHonest is false: Honesty 1`] = `
|
||||||
<section
|
<section
|
||||||
className="honesty-policy"
|
className="honesty-policy"
|
||||||
|
id="honesty-policy"
|
||||||
>
|
>
|
||||||
<SectionHeader>
|
<SectionHeader>
|
||||||
settings.headings.honesty
|
settings.headings.honesty
|
||||||
@@ -31,6 +32,7 @@ exports[`<Honesty /> <Honesty /> snapshot when isHonest is false: Honesty 1`] =
|
|||||||
exports[`<Honesty /> <Honesty /> snapshot when isHonest is true: HonestyAccepted 1`] = `
|
exports[`<Honesty /> <Honesty /> snapshot when isHonest is true: HonestyAccepted 1`] = `
|
||||||
<section
|
<section
|
||||||
className="honesty-policy"
|
className="honesty-policy"
|
||||||
|
id="honesty-policy"
|
||||||
>
|
>
|
||||||
<SectionHeader>
|
<SectionHeader>
|
||||||
settings.headings.honesty
|
settings.headings.honesty
|
||||||
|
@@ -15,6 +15,7 @@ import {
|
|||||||
certSlugTypeMap,
|
certSlugTypeMap,
|
||||||
superBlockCertTypeMap
|
superBlockCertTypeMap
|
||||||
} from '../../../../../config/certification-settings';
|
} from '../../../../../config/certification-settings';
|
||||||
|
import CertificationCard from './CertificationCard';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentCerts: CurrentCertsType,
|
currentCerts: CurrentCertsType,
|
||||||
@@ -57,6 +58,10 @@ export class CertChallenge extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='block'>
|
<div className='block'>
|
||||||
|
<CertificationCard
|
||||||
|
i18nCertText={i18nCertText}
|
||||||
|
superBlock={superBlock}
|
||||||
|
/>
|
||||||
<button
|
<button
|
||||||
className={`map-cert-title ${
|
className={`map-cert-title ${
|
||||||
isCertified ? 'map-is-cert' : 'no-cursor'
|
isCertified ? 'map-is-cert' : 'no-cursor'
|
||||||
|
@@ -0,0 +1,64 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
import ScrollableAnchor from 'react-scrollable-anchor';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import ClaimCertSteps from './ClaimCertSteps';
|
||||||
|
import Caret from '../../../assets/icons/Caret';
|
||||||
|
|
||||||
|
const propTypes = {
|
||||||
|
i18nCertText: PropTypes.string,
|
||||||
|
superBlock: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
|
const CertificationCard = ({ superBlock, i18nCertText }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [isExpanded, setIsExpanded] = useState(true);
|
||||||
|
|
||||||
|
const handleBlockClick = () => {
|
||||||
|
setIsExpanded(!isExpanded);
|
||||||
|
};
|
||||||
|
|
||||||
|
const {
|
||||||
|
expand: expandText,
|
||||||
|
collapse: collapseText,
|
||||||
|
courses: coursesText
|
||||||
|
} = t('intro:misc-text');
|
||||||
|
return (
|
||||||
|
<ScrollableAnchor id='claim-cert-block'>
|
||||||
|
<div className={`block ${isExpanded ? 'open' : ''}`}>
|
||||||
|
<div className='block-title-wrapper'>
|
||||||
|
<a className='block-link' href='#claim-cert-block'>
|
||||||
|
<h3 className='big-block-title'>
|
||||||
|
{t('certification-card.title')}
|
||||||
|
<span className='block-link-icon'>#</span>
|
||||||
|
</h3>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div className='block-description'>
|
||||||
|
{t('certification-card.intro', { i18nCertText })}
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
aria-expanded={isExpanded}
|
||||||
|
className='map-title'
|
||||||
|
onClick={handleBlockClick}
|
||||||
|
>
|
||||||
|
<Caret />
|
||||||
|
<h4 className='course-title'>
|
||||||
|
{`${
|
||||||
|
isExpanded ? collapseText : expandText
|
||||||
|
} ${coursesText.toLowerCase()}`}
|
||||||
|
</h4>
|
||||||
|
</button>
|
||||||
|
{isExpanded && (
|
||||||
|
<ClaimCertSteps i18nCertText={i18nCertText} superBlock={superBlock} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</ScrollableAnchor>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
CertificationCard.displayName = 'CertStatus';
|
||||||
|
CertificationCard.propTypes = propTypes;
|
||||||
|
|
||||||
|
export default CertificationCard;
|
@@ -0,0 +1,51 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Link } from 'gatsby';
|
||||||
|
import { withTranslation, useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
const propTypes = {
|
||||||
|
i18nCertText: PropTypes.string,
|
||||||
|
superBlock: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
|
const ClaimCertSteps = ({ i18nCertText, superBlock }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const settingsLink = '/settings#privacy-settings';
|
||||||
|
const honestyPolicyAnchor = '/settings#honesty-policy';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ul className='map-challenges-ul'>
|
||||||
|
<li className='map-challenge-title map-challenge-wrap'>
|
||||||
|
<Link to={honestyPolicyAnchor}>
|
||||||
|
{t('certification-card.accept-honesty')}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
<li className='map-challenge-title map-challenge-wrap'>
|
||||||
|
<a href={`#${superBlock}-projects`}>
|
||||||
|
{t('certification-card.complete-project', {
|
||||||
|
i18nCertText
|
||||||
|
})}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li className='map-challenge-title map-challenge-wrap'>
|
||||||
|
<Link to={settingsLink}>
|
||||||
|
{t('certification-card.set-profile-public')}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
<li className='map-challenge-title map-challenge-wrap'>
|
||||||
|
<Link to={settingsLink}>
|
||||||
|
{t('certification-card.set-certs-public')}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
<li className='map-challenge-title map-challenge-wrap'>
|
||||||
|
<Link to={settingsLink}>{t('certification-card.set-name')}</Link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
ClaimCertSteps.displayName = 'ClaimCertSteps';
|
||||||
|
ClaimCertSteps.propTypes = propTypes;
|
||||||
|
|
||||||
|
export default withTranslation()(ClaimCertSteps);
|
Reference in New Issue
Block a user