import React from 'react'; import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { Alert, Button, Hyperlink } from '@openedx/paragon'; import certImage from '../../../generic/assets/edX_certificate.png'; import messages from './messages'; /** * Note for Open edX developers: * There are pieces of this component that are hard-coded and specific to edX that may not apply to your organization. * This includes mentions of our edX program types (MicroMasters, MicroBachelors, Professional Certificate, and * XSeries), along with their respective support article URLs and image variable names. * * Currently, this component will not render unless the learner's completed course has a related program of one of the * four aforementioned types. This will not impact the parent components (i.e. CourseCelebration will render normally). */ const programTypes = ['microbachelors', 'micromasters', 'professional-certificate', 'xseries']; const ProgramCompletion = ({ progress, title, type, url, }) => { const intl = useIntl(); if (!programTypes.includes(type) || progress.notStarted !== 0 || progress.inProgress !== 0) { return null; } const programLink = ( {intl.formatMessage(messages.dashboardLink)} ); return (
{intl.formatMessage(messages.programsLastCourseHeader, { title })}

{type === 'microbachelors' && ( <>

{intl.formatMessage(messages.microBachelorsLearnMore)}

)} {type === 'micromasters' && (

{intl.formatMessage(messages.microMastersMessage)} {' '} {intl.formatMessage(messages.microMastersLearnMore)}

)}
{`${intl.formatMessage(messages.certificateImage)}`}
); }; ProgramCompletion.propTypes = { progress: PropTypes.shape({ completed: PropTypes.number.isRequired, inProgress: PropTypes.number.isRequired, notStarted: PropTypes.number.isRequired, }).isRequired, title: PropTypes.string.isRequired, type: PropTypes.string.isRequired, url: PropTypes.string.isRequired, }; export default ProgramCompletion;