diff --git a/src/course-home/data/__snapshots__/redux.test.js.snap b/src/course-home/data/__snapshots__/redux.test.js.snap
index 6e66374c..73431279 100644
--- a/src/course-home/data/__snapshots__/redux.test.js.snap
+++ b/src/course-home/data/__snapshots__/redux.test.js.snap
@@ -429,6 +429,7 @@ Object {
"hasVisitedCourse": false,
"url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+Test+Block@12345abcde",
},
+ "timeOffsetMillis": 0,
"verifiedMode": Object {
"accessExpirationDate": "2050-01-01T12:00:00",
"currency": "USD",
diff --git a/src/course-home/outline-tab/widgets/UpgradeCard.jsx b/src/course-home/outline-tab/widgets/UpgradeCard.jsx
index 2635e8b3..61880b5f 100644
--- a/src/course-home/outline-tab/widgets/UpgradeCard.jsx
+++ b/src/course-home/outline-tab/widgets/UpgradeCard.jsx
@@ -4,17 +4,17 @@ import { faCheck } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { sendTrackEvent, sendTrackingLogEvent } from '@edx/frontend-platform/analytics';
-import { FormattedDate, FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n';
+import { FormattedDate, FormattedMessage, injectIntl } from '@edx/frontend-platform/i18n';
import { getConfig } from '@edx/frontend-platform';
import { useModel } from '../../../generic/model-store';
import { UpgradeButton } from '../../../generic/upgrade-button';
-function UpsellNoFBECardContent(){
+function UpsellNoFBECardContent() {
return (
-
-
+
-
-
+
-
-
+
graded assignments
+ graded assignments
),
}}
/>
-
-
+
-
-
+
@@ -105,13 +105,15 @@ function UpsellFBESoonCardContent({accessExpirationDate, timezoneFormatArgs}) {
defaultMessage="You will lose all access to this course, {includingAnyProgress}, on {date}."
values={{
includingAnyProgress: (including any progress),
- date: (),
+ />
+ ),
}}
/>
@@ -120,7 +122,7 @@ function UpsellFBESoonCardContent({accessExpirationDate, timezoneFormatArgs}) {
id="learning.outline.alert.upgradecard.expirationVerifiedCert"
defaultMessage="Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the {benefitsOfUpgrading}."
values={{
- benefitsOfUpgrading: ( benefits of upgrading),
+ benefitsOfUpgrading: (benefits of upgrading),
}}
/>
@@ -132,60 +134,71 @@ UpsellFBESoonCardContent.propTypes = {
accessExpirationDate: PropTypes.PropTypes.instanceOf(Date).isRequired,
timezoneFormatArgs: PropTypes.shape({
timeZone: PropTypes.string,
- })
+ }),
};
-function ExpirationCountdown({hoursToExpiration}){
- let expirationText;
- console.log(hoursToExpiration)
+UpsellFBESoonCardContent.defaultProps = {
+ timezoneFormatArgs: {},
+};
- if(hoursToExpiration >= 24){
- expirationText == 24) {
+ expirationText = (
+
- } else if (hoursToExpiration >= 1){
- expirationText=
+ );
+ } else if (hoursToExpiration >= 1) {
+ expirationText = (
+
+ );
} else {
- expirationText =
+ expirationText = (
+
+ );
}
- return({expirationText}
)
+ return ({expirationText}
);
}
ExpirationCountdown.propTypes = {
hoursToExpiration: PropTypes.number.isRequired,
};
-function AccessExpirationDateBanner({accessExpirationDate, timezoneFormatArgs}){
+function AccessExpirationDateBanner({ accessExpirationDate, timezoneFormatArgs }) {
return (
),
+ />
+ ),
}}
/>
@@ -196,7 +209,11 @@ AccessExpirationDateBanner.propTypes = {
accessExpirationDate: PropTypes.PropTypes.instanceOf(Date).isRequired,
timezoneFormatArgs: PropTypes.shape({
timeZone: PropTypes.string,
- })
+ }),
+};
+
+AccessExpirationDateBanner.defaultProps = {
+ timezoneFormatArgs: {},
};
function UpgradeCard({ courseId }) {
@@ -217,7 +234,6 @@ function UpgradeCard({ courseId }) {
const timezoneFormatArgs = userTimezone ? { timeZone: userTimezone } : {};
const correctedTime = new Date(Date.now() + timeOffsetMillis);
-
if (!verifiedMode) {
return null;
}
@@ -256,9 +272,8 @@ function UpgradeCard({ courseId }) {
});
};
-
- /*
- There are 4 parts that change in the upgrade card:
+ /*
+ There are 4 parts that change in the upgrade card:
upgradeCardHeaderText
expirationBanner
upsellMessage
@@ -269,61 +284,76 @@ function UpgradeCard({ courseId }) {
let upsellMessage;
let offerCode;
- if(!!accessExpiration && !!contentTypeGatingEnabled){
- if(!!offer){ // if there's a first purchase discount, show it
+ if (!!accessExpiration && !!contentTypeGatingEnabled) {
+ if (offer) { // if there's a first purchase discount, show it
+ const hoursToDiscountExpiration = Math.floor((new Date(offer.expirationDate) - correctedTime) / 1000 / 60 / 60);
- const hoursToDiscountExpiration = Math.floor((new Date(offer.expirationDate) - correctedTime) /1000/ 60 /60)
-
- upgradeCardHeaderText =
-
- expirationBanner =
- upsellMessage =
- offerCode =
- {offer.code}),
- }}
- />
-
-
+ );
+ expirationBanner = ;
+ upsellMessage = ;
+ offerCode = (
+
+ {offer.code}),
+ }}
+ />
+
+ );
} else {
- const accessExpirationDate = new Date(accessExpiration.expirationDate)
- const hoursToAccessExpiration = Math.floor((accessExpirationDate - correctedTime) /1000/ 60 /60)
+ const accessExpirationDate = new Date(accessExpiration.expirationDate);
+ const hoursToAccessExpiration = Math.floor((accessExpirationDate - correctedTime) / 1000 / 60 / 60);
- if(hoursToAccessExpiration >= (7*24)) {
- upgradeCardHeaderText = = (7 * 24)) {
+ upgradeCardHeaderText = (
+
- expirationBanner =
- upsellMessage =
- } else { // more urgent messaging if there's less than 7 days left
- upgradeCardHeaderText =
+ );
+ upsellMessage = ;
+ } else { // more urgent messaging if there's less than 7 days left
+ upgradeCardHeaderText = (
+
- expirationBanner =
- upsellMessage =
- }
+ );
+ expirationBanner = ;
+ upsellMessage = (
+
+ );
}
- } else { //FBE is turned off
- upgradeCardHeaderText =
- upsellMessage =
+ );
+ upsellMessage = ();
}
-
-
return (