diff --git a/client/src/assets/icons/CertificationIcon.js b/client/src/assets/icons/CertificationIcon.js new file mode 100644 index 0000000000..00aeff4406 --- /dev/null +++ b/client/src/assets/icons/CertificationIcon.js @@ -0,0 +1,69 @@ +/* eslint-disable max-len */ +import React from 'react'; + +function CertificationIcon() { + return ( + + + + + + + + + + + + + + + + + + + + + ); +} + +CertificationIcon.displayName = 'CertificationIcon'; + +export default CertificationIcon; diff --git a/client/src/components/profile/components/Certifications.js b/client/src/components/profile/components/Certifications.js index 5582a9d63b..35a2d26d2b 100644 --- a/client/src/components/profile/components/Certifications.js +++ b/client/src/components/profile/components/Certifications.js @@ -6,89 +6,19 @@ import { createSelector } from 'reselect'; import { connect } from 'react-redux'; import { Row, Col } from '@freecodecamp/react-bootstrap'; -import { userByNameSelector } from '../../../redux'; +import { certificatesByNameSelector } from '../../../redux'; import FullWidthRow from '../../helpers/FullWidthRow'; import { ButtonSpacer, Spacer } from '../../helpers'; import './certifications.css'; const mapStateToProps = (state, props) => createSelector( - userByNameSelector(props.username), - ({ - isRespWebDesignCert, - is2018DataVisCert, - isFrontEndLibsCert, - isJsAlgoDataStructCert, - isApisMicroservicesCert, - isInfosecQaCert, - isFrontEndCert, - isBackEndCert, - isDataVisCert, - isFullStackCert - }) => ({ - hasModernCert: - isRespWebDesignCert || - is2018DataVisCert || - isFrontEndLibsCert || - isJsAlgoDataStructCert || - isApisMicroservicesCert || - isInfosecQaCert || - isFullStackCert, - hasLegacyCert: isFrontEndCert || isBackEndCert || isDataVisCert, - currentCerts: [ - { - show: isFullStackCert, - title: 'Full Stack Certification', - showURL: 'full-stack' - }, - { - show: isRespWebDesignCert, - title: 'Responsive Web Design Certification', - showURL: 'responsive-web-design' - }, - { - show: isJsAlgoDataStructCert, - title: 'JavaScript Algorithms and Data Structures Certification', - showURL: 'javascript-algorithms-and-data-structures' - }, - { - show: isFrontEndLibsCert, - title: 'Front End Libraries Certification', - showURL: 'front-end-libraries' - }, - { - show: is2018DataVisCert, - title: 'Data Visualization Certification', - showURL: 'data-visualization' - }, - { - show: isApisMicroservicesCert, - title: 'APIs and Microservices Certification', - showURL: 'apis-and-microservices' - }, - { - show: isInfosecQaCert, - title: 'Information Security and Quality Assurance Certification', - showURL: 'information-security-and-quality-assurance' - } - ], - legacyCerts: [ - { - show: isFrontEndCert, - title: 'Front End Certification', - showURL: 'legacy-front-end' - }, - { - show: isBackEndCert, - title: 'Back End Certification', - showURL: 'legacy-back-end' - }, - { - show: isDataVisCert, - title: 'Data Visualization Certification', - showURL: 'legacy-data-visualization' - } - ] + certificatesByNameSelector(props.username), + ({ hasModernCert, hasLegacyCert, currentCerts, legacyCerts }) => ({ + hasModernCert, + hasLegacyCert, + currentCerts, + legacyCerts }) )(state, props); diff --git a/client/src/components/profile/components/TimeLine.js b/client/src/components/profile/components/TimeLine.js index be93b87895..fb9dbd6dac 100644 --- a/client/src/components/profile/components/TimeLine.js +++ b/client/src/components/profile/components/TimeLine.js @@ -8,7 +8,13 @@ import { Link, useStaticQuery, graphql } from 'gatsby'; import TimelinePagination from './TimelinePagination'; import { FullWidthRow } from '../../helpers'; import SolutionViewer from '../../settings/SolutionViewer'; -import { challengeTypes } from '../../../../utils/challengeTypes'; +import { + getCertIds, + getPathFromID, + getTitleFromId +} from '../../../../../utils'; +import CertificationIcon from '../../../assets/icons/CertificationIcon'; + // Items per page in timeline. const ITEMS_PER_PAGE = 15; @@ -73,13 +79,23 @@ class TimelineInner extends Component { } renderCompletion(completed) { - const { idToNameMap } = this.props; + const { idToNameMap, username } = this.props; const { id, completedDate } = completed; - const { challengeTitle, challengePath } = idToNameMap.get(id); + const { challengeTitle, challengePath, certPath } = idToNameMap.get(id); return ( - {challengeTitle} + {certPath ? ( + + {challengeTitle} + + + ) : ( + {challengeTitle} + )}