From e18d6f0daecc6d3511ea49ac7cdcdddba16c9fa1 Mon Sep 17 00:00:00 2001 From: "Albert (AJ) St. Aubin" Date: Thu, 20 May 2021 16:27:34 -0400 Subject: [PATCH] refactor: Updating the messages for certificate availability. [MICROBA-678] --- .../CertificateAvailableAlert.jsx | 36 ++++++------------- .../certificate-available-alert/hooks.js | 2 +- .../course/course-exit/CourseCelebration.jsx | 15 ++++---- src/courseware/course/course-exit/messages.js | 2 +- 4 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/course-home/outline-tab/alerts/certificate-available-alert/CertificateAvailableAlert.jsx b/src/course-home/outline-tab/alerts/certificate-available-alert/CertificateAvailableAlert.jsx index 70b59b11..0fe2a76c 100644 --- a/src/course-home/outline-tab/alerts/certificate-available-alert/CertificateAvailableAlert.jsx +++ b/src/course-home/outline-tab/alerts/certificate-available-alert/CertificateAvailableAlert.jsx @@ -1,50 +1,34 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { getConfig } from '@edx/frontend-platform'; -import { FormattedMessage, FormattedRelative } from '@edx/frontend-platform/i18n'; -import { Hyperlink } from '@edx/paragon'; +import { FormattedDate, FormattedMessage } from '@edx/frontend-platform/i18n'; import { Alert, ALERT_TYPES } from '../../../../generic/user-messages'; function CertificateAvailableAlert({ payload }) { const { certDate, - username, - userTimezone, + courseEndDate, } = payload; - const timezoneFormatArgs = userTimezone ? { timeZone: userTimezone } : {}; + const certificateAvailableDate = ; + const courseEndDateFormatted = ; return ( - +
- - - ), - timeRemaining: ( - - ), + courseEndDateFormatted, + certificateAvailableDate }} />
diff --git a/src/course-home/outline-tab/alerts/certificate-available-alert/hooks.js b/src/course-home/outline-tab/alerts/certificate-available-alert/hooks.js index ea83d37b..a176572f 100644 --- a/src/course-home/outline-tab/alerts/certificate-available-alert/hooks.js +++ b/src/course-home/outline-tab/alerts/certificate-available-alert/hooks.js @@ -18,7 +18,6 @@ function useCertificateAvailableAlert(courseId) { } = useModel('outline', courseId); const authenticatedUser = getAuthenticatedUser(); const username = authenticatedUser ? authenticatedUser.username : ''; - const certBlock = courseDateBlocks.find(b => b.dateType === 'certificate-available-date'); const endBlock = courseDateBlocks.find(b => b.dateType === 'course-end-date'); const endDate = endBlock ? new Date(endBlock.date) : null; @@ -26,6 +25,7 @@ function useCertificateAvailableAlert(courseId) { const isVisible = isEnrolled && certBlock && hasEnded; // only show if we're between end and cert dates const payload = { certDate: certBlock && certBlock.date, + courseEndDate: endBlock && endBlock.date, username, userTimezone, }; diff --git a/src/courseware/course/course-exit/CourseCelebration.jsx b/src/courseware/course/course-exit/CourseCelebration.jsx index 6272fa66..0d724882 100644 --- a/src/courseware/course/course-exit/CourseCelebration.jsx +++ b/src/courseware/course/course-exit/CourseCelebration.jsx @@ -60,6 +60,7 @@ function CourseCelebration({ intl }) { certStatus, certWebViewUrl, downloadUrl, + certificateAvailableDate, } = certificateData || {}; /** [WS-1681 experiment] */ @@ -125,24 +126,22 @@ function CourseCelebration({ intl }) { break; case 'earned_but_not_available': { const endDate = ; + const certAvailableDate = ; certHeader = intl.formatMessage(messages.certificateHeaderNotAvailable); message = ( <>

@@ -294,7 +293,7 @@ function CourseCelebration({ intl }) {
{certHeader && ( - +
{certHeader}
{message} diff --git a/src/courseware/course/course-exit/messages.js b/src/courseware/course/course-exit/messages.js index 58cf4360..e0dca551 100644 --- a/src/courseware/course/course-exit/messages.js +++ b/src/courseware/course/course-exit/messages.js @@ -13,7 +13,7 @@ const messages = defineMessages({ }, certificateHeaderNotAvailable: { id: 'courseCelebration.certificateHeader.notAvailable', - defaultMessage: 'Your certificate will be available soon!', + defaultMessage: 'Your grade and certificate will be ready soon!', description: 'Text displayed when course certificate is not yet available to be viewed', }, certificateHeaderUnverified: {