fix: product requests and mock data updates
This commit is contained in:
0
documentation/0001_redux_hooks.md
Normal file
0
documentation/0001_redux_hooks.md
Normal file
0
documentation/0002_local_pagination.md
Normal file
0
documentation/0002_local_pagination.md
Normal file
@@ -25,7 +25,7 @@ exports[`EmailSettingsModal render snapshot: emails disabled, show: false 1`] =
|
||||
Course emails are on
|
||||
</Form.Switch>
|
||||
<p>
|
||||
Course emailsi include important information about your course.
|
||||
Course emails include important information about your course.
|
||||
</p>
|
||||
<ActionRow>
|
||||
<Button
|
||||
@@ -69,7 +69,7 @@ exports[`EmailSettingsModal render snapshot: emails disabled, show: true 1`] = `
|
||||
Course emails are on
|
||||
</Form.Switch>
|
||||
<p>
|
||||
Course emailsi include important information about your course.
|
||||
Course emails include important information about your course.
|
||||
</p>
|
||||
<ActionRow>
|
||||
<Button
|
||||
@@ -113,7 +113,7 @@ exports[`EmailSettingsModal render snapshot: emails enabled, show: true 1`] = `
|
||||
Course emails are off
|
||||
</Form.Switch>
|
||||
<p>
|
||||
Course emailsi include important information about your course.
|
||||
Course emails include important information about your course.
|
||||
</p>
|
||||
<ActionRow>
|
||||
<Button
|
||||
|
||||
@@ -20,7 +20,7 @@ export const messages = StrictDict({
|
||||
description: {
|
||||
id: 'learner-dash.emailSettings.description',
|
||||
description: 'Description for email settings modal',
|
||||
defaultMessage: 'Course emailsi include important information about your course.',
|
||||
defaultMessage: 'Course emails include important information about your course.',
|
||||
},
|
||||
nevermind: {
|
||||
id: 'learner-dash.emailSettings.nevermind',
|
||||
|
||||
@@ -23,7 +23,7 @@ export const AuthenticatedUserDropdown = ({ username }) => {
|
||||
</Dropdown.Toggle>
|
||||
<Dropdown.Menu className="dropdown-menu-right">
|
||||
<Dropdown.Header>SWITCH DASHBOARD</Dropdown.Header>
|
||||
<Dropdown.Item as="a" href="/dashboard">Personal</Dropdown.Item>
|
||||
<Dropdown.Item as="a" href="localhost:1993/edx-dashboard" className="active">Personal</Dropdown.Item>
|
||||
{availableDashboards && availableDashboards.map((dashboard) => (
|
||||
<Dropdown.Item
|
||||
as="a"
|
||||
|
||||
@@ -24,7 +24,7 @@ exports[`RelatedProgramsModal snapshot: closed 1`] = `
|
||||
hookProps.courseTitle
|
||||
</ModalDialog.Header>
|
||||
<ModalDialog.Body
|
||||
className="pl-0"
|
||||
className="pl-0 overflow-hidden"
|
||||
>
|
||||
<p>
|
||||
Are you looking to expand your knowledge? Enrolling in a Program lets you take a series of courses in the subject that you're interested in
|
||||
@@ -100,7 +100,7 @@ exports[`RelatedProgramsModal snapshot: open 1`] = `
|
||||
hookProps.courseTitle
|
||||
</ModalDialog.Header>
|
||||
<ModalDialog.Body
|
||||
className="pl-0"
|
||||
className="pl-0 overflow-hidden"
|
||||
>
|
||||
<p>
|
||||
Are you looking to expand your knowledge? Enrolling in a Program lets you take a series of courses in the subject that you're interested in
|
||||
|
||||
@@ -34,7 +34,7 @@ export const RelatedProgramsModal = ({
|
||||
<ModalDialog.Header as="h4" className="programs-header p-0">
|
||||
{courseTitle}
|
||||
</ModalDialog.Header>
|
||||
<ModalDialog.Body className="pl-0">
|
||||
<ModalDialog.Body className="pl-0 overflow-hidden">
|
||||
<p>{formatMessage(messages.description)}</p>
|
||||
<CardGrid
|
||||
columnSizes={{ lg: 6, xlg: 4, xs: 12 }}
|
||||
|
||||
@@ -27,7 +27,7 @@ export const WidgetSidebar = () => (
|
||||
src={moreCoursesSVG}
|
||||
srcAlt="course side widget"
|
||||
/>
|
||||
<Card.Body>
|
||||
<Card.Body className="m-auto pr-2">
|
||||
<h3>
|
||||
<FormattedMessage {...messages.lookingForChallengePrompt} />
|
||||
</h3>
|
||||
|
||||
@@ -117,9 +117,10 @@ export const genEnrollmentData = (data = {}) => ({
|
||||
canUpgrade: (data.isVerified ? null : true),
|
||||
hasFinished: false,
|
||||
hasStarted: false,
|
||||
isAudit: !data.isVerified || data.isEnrolled,
|
||||
isAudit: !data.isVerified && (data.isEnrolled !== false),
|
||||
isAuditAccessExpired: data.isVerified ? null : false,
|
||||
isEmailEnabled: false,
|
||||
hasOptedOutOfEmail: false,
|
||||
isEnrolled: true,
|
||||
isVerified: false,
|
||||
...data,
|
||||
@@ -146,44 +147,114 @@ export const availableSessions = [
|
||||
];
|
||||
|
||||
export const courseRuns = [
|
||||
// audit, can upgrade, course not started,
|
||||
// audit, course run not started
|
||||
{},
|
||||
// audit, can upgrade, course started
|
||||
// audit, course run started
|
||||
{
|
||||
courseRun: { isStarted: true },
|
||||
},
|
||||
// audit, can upgrade, course started, learner started
|
||||
{
|
||||
courseRun: { isStarted: true },
|
||||
enrollment: { hasStarted: true },
|
||||
},
|
||||
// audit, can upgrade, course started, learner started, not passing
|
||||
{
|
||||
courseRun: { isStarted: true },
|
||||
enrollment: { hasStarted: true },
|
||||
grades: { isPassing: false },
|
||||
},
|
||||
// audit, access expired, can upgrade, course started, learner started
|
||||
{
|
||||
courseRun: { isStarted: true },
|
||||
enrollment: {
|
||||
hasStarted: true,
|
||||
isAuditAccessExpired: true,
|
||||
accessExpirationDate: pastDate,
|
||||
},
|
||||
},
|
||||
// audit, access expired, cannot upgrade, course started, learner started
|
||||
// audit, course run started, access expired, learner not started
|
||||
{
|
||||
courseRun: { isStarted: true },
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
isAuditAccessExpired: true,
|
||||
hasStarted: true,
|
||||
},
|
||||
},
|
||||
// audit, course run started, access expired, cannot upgrade, learner not started
|
||||
{
|
||||
courseRun: { isStarted: true },
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
canUpgrade: false,
|
||||
isAuditAccessExpired: true,
|
||||
},
|
||||
},
|
||||
|
||||
// verified, course not started
|
||||
// audit, course run ended, access expired, cannot upgrade, learner not started
|
||||
{
|
||||
courseRun: {
|
||||
endDate: pastDate,
|
||||
isStarted: true,
|
||||
},
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
isAuditAccessExpired: true,
|
||||
},
|
||||
},
|
||||
// audit, course run archived, access expired, cannot upgrade, learner not started
|
||||
{
|
||||
courseRun: {
|
||||
endDate: pastDate,
|
||||
isArchived: true,
|
||||
isStarted: true,
|
||||
},
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
isAuditAccessExpired: true,
|
||||
},
|
||||
},
|
||||
// audit, course run and learner started, passing
|
||||
{
|
||||
courseRun: { isStarted: true },
|
||||
enrollment: { isStarted: true },
|
||||
},
|
||||
// audit, course run and learner started, access expired
|
||||
{
|
||||
courseRun: {
|
||||
courseRun: { isStarted: true },
|
||||
},
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
isAuditAccessExpired: true,
|
||||
isStarted: true,
|
||||
},
|
||||
},
|
||||
// audit, course run and learner started, access expired, cannot upgrade
|
||||
{
|
||||
courseRun: {
|
||||
courseRun: { isStarted: true },
|
||||
},
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
canUpgrade: false,
|
||||
isAuditAccessExpired: true,
|
||||
isStarted: true,
|
||||
},
|
||||
},
|
||||
// audit, course run ended, learner started, expired, cannot upgraded, not passing
|
||||
{
|
||||
courseRun: {
|
||||
courseRun: {
|
||||
isStarted: true,
|
||||
endDate: pastDate,
|
||||
},
|
||||
},
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
canUpgrade: false,
|
||||
isAuditAccessExpired: true,
|
||||
isStarted: true,
|
||||
},
|
||||
grade: { isPassing: false },
|
||||
},
|
||||
// audit, course run archived, learner started, expired, cannot upgrade, not passing
|
||||
{
|
||||
courseRun: {
|
||||
courseRun: {
|
||||
isStarted: true,
|
||||
isArchived: true,
|
||||
endDate: pastDate,
|
||||
},
|
||||
},
|
||||
enrollment: {
|
||||
accessExpirationDate: pastDate,
|
||||
canUpgrade: false,
|
||||
isAuditAccessExpired: true,
|
||||
isStarted: true,
|
||||
},
|
||||
grade: { isPassing: false },
|
||||
},
|
||||
// verified, course not started, learner not started
|
||||
{ enrollment: { isVerified: true } },
|
||||
// verified, course started, learner not started
|
||||
{
|
||||
@@ -201,12 +272,7 @@ export const courseRuns = [
|
||||
grades: { isPassing: false },
|
||||
enrollment: { hasStarted: true, isVerified: true },
|
||||
},
|
||||
// verified, learner started, not finished, not passing
|
||||
{
|
||||
enrollment: { hasStarted: true, isVerified: true },
|
||||
grades: { isPassing: false },
|
||||
},
|
||||
// verified, learner finished, passing, restricted
|
||||
// verified, learner finished, not passing, cert not earned
|
||||
{
|
||||
enrollment: {
|
||||
hasFinished: true,
|
||||
@@ -214,7 +280,10 @@ export const courseRuns = [
|
||||
isVerified: true,
|
||||
},
|
||||
courseRun: { isStarted: true },
|
||||
certificates: { isRestricted: true },
|
||||
grades: { isPassing: false },
|
||||
certificates: {
|
||||
isEarned: false,
|
||||
},
|
||||
},
|
||||
// verified, learner finished, passing, cert earned but not available
|
||||
{
|
||||
@@ -230,6 +299,16 @@ export const courseRuns = [
|
||||
isAvailable: false,
|
||||
},
|
||||
},
|
||||
// verified, learner finished, passing, restricted
|
||||
{
|
||||
enrollment: {
|
||||
hasFinished: true,
|
||||
hasStarted: true,
|
||||
isVerified: true,
|
||||
},
|
||||
courseRun: { isStarted: true },
|
||||
certificates: { isRestricted: true },
|
||||
},
|
||||
// verified, learner finished, cert earned, downloadable (web + link)
|
||||
{
|
||||
enrollment: {
|
||||
@@ -247,14 +326,17 @@ export const courseRuns = [
|
||||
certPreviewUrl: logos.edx,
|
||||
},
|
||||
},
|
||||
// verified, learner finished, cert earned, downloadable (link only)
|
||||
// verified, course ended, learner finished, cert earned, downloadable (link only),
|
||||
{
|
||||
enrollment: {
|
||||
hasFinished: true,
|
||||
hasStarted: true,
|
||||
isVerified: true,
|
||||
},
|
||||
courseRun: { isStarted: true },
|
||||
courseRun: {
|
||||
isStarted: true,
|
||||
endDate: pastDate,
|
||||
},
|
||||
certificates: {
|
||||
isEarned: true,
|
||||
isAvailable: true,
|
||||
@@ -284,13 +366,7 @@ export const courseRuns = [
|
||||
certPreviewUrl: logos.edx,
|
||||
},
|
||||
},
|
||||
// verified, course archived, learner started, not finished, not passing
|
||||
{
|
||||
enrollment: { hasStarted: true, isVerified: true },
|
||||
grades: { isPassing: false },
|
||||
courseRun: { isArchived: true, endDate: pastDate },
|
||||
},
|
||||
// Entitlement Course Run - Cannot view yet
|
||||
// Entitlement - not started
|
||||
{
|
||||
enrollment: { isVerified: true },
|
||||
courseRun: { isStarted: false },
|
||||
@@ -299,13 +375,12 @@ export const courseRuns = [
|
||||
isFulfilled: true,
|
||||
isRefundable: true,
|
||||
canViewCourse: false,
|
||||
canChange: true,
|
||||
changeDeadline: futureDate,
|
||||
isExpired: false,
|
||||
availableSessions,
|
||||
},
|
||||
},
|
||||
// Entitlement Course Run - Can View and Change
|
||||
// Entitlement - Course run started, learner not started
|
||||
{
|
||||
enrollment: { isVerified: true },
|
||||
courseRun: { isStarted: true },
|
||||
@@ -314,38 +389,133 @@ export const courseRuns = [
|
||||
isFulfilled: true,
|
||||
isRefundable: true,
|
||||
canViewCourse: true,
|
||||
canChange: true,
|
||||
changeDeadline: futureDate,
|
||||
isExpired: false,
|
||||
availableSessions,
|
||||
},
|
||||
},
|
||||
// Entitlement Course Run - Can View but not Change
|
||||
// Entitlement - Course run started, learner started, not passing
|
||||
{
|
||||
enrollment: { isVerified: true },
|
||||
enrollment: {
|
||||
isVerified: true,
|
||||
hasStarted: true,
|
||||
},
|
||||
courseRun: { isStarted: true },
|
||||
entitlements: {
|
||||
isEntitlement: true,
|
||||
isFulfilled: true,
|
||||
isRefundable: true,
|
||||
canViewCourse: true,
|
||||
changeDeadline: futureDate,
|
||||
isExpired: false,
|
||||
availableSessions,
|
||||
},
|
||||
grades: { isPassing: false },
|
||||
},
|
||||
// Entitlement - Course run started, learner started, passing, cannot change
|
||||
{
|
||||
enrollment: {
|
||||
isVerified: true,
|
||||
hasStarted: true,
|
||||
},
|
||||
courseRun: { isStarted: true },
|
||||
entitlements: {
|
||||
isEntitlement: true,
|
||||
isFulfilled: true,
|
||||
isRefundable: true,
|
||||
canViewCourse: true,
|
||||
canChange: false,
|
||||
changeDeadline: pastDate,
|
||||
isExpired: false,
|
||||
availableSessions,
|
||||
},
|
||||
},
|
||||
// Entitlement Course Run - Expired
|
||||
// Entitlement - Learner finished, but did not pass
|
||||
{
|
||||
enrollment: { isVerified: true },
|
||||
courseRun: { isStarted: true, isArchived: true, endDate: pastDate },
|
||||
enrollment: {
|
||||
isVerified: true,
|
||||
hasFinished: false,
|
||||
},
|
||||
courseRun: { isStarted: true },
|
||||
entitlements: {
|
||||
isEntitlement: true,
|
||||
isFulfilled: true,
|
||||
isRefundable: false,
|
||||
canViewCourse: true,
|
||||
canChange: false,
|
||||
changeDeadline: pastDate,
|
||||
isExpired: true,
|
||||
isExpired: false,
|
||||
},
|
||||
grades: { isPassing: false },
|
||||
},
|
||||
// Entitlement - Learner finished, and passed. cannot refund. previewable cert.
|
||||
{
|
||||
enrollment: {
|
||||
isVerified: true,
|
||||
hasFinished: false,
|
||||
},
|
||||
courseRun: { isStarted: true },
|
||||
entitlements: {
|
||||
isEntitlement: true,
|
||||
isFulfilled: true,
|
||||
isRefundable: false,
|
||||
canViewCourse: true,
|
||||
changeDeadline: pastDate,
|
||||
isExpired: false,
|
||||
},
|
||||
certificates: {
|
||||
isEarned: true,
|
||||
isAvailable: true,
|
||||
isDownloadable: true,
|
||||
availableDate: pastDate,
|
||||
certDownloadUrl: logos.social,
|
||||
certPreviewUrl: logos.edx,
|
||||
},
|
||||
},
|
||||
// Entitlement - Learner finished and failed. cannot refund. course ended.
|
||||
{
|
||||
enrollment: {
|
||||
isVerified: true,
|
||||
hasFinished: false,
|
||||
},
|
||||
courseRun: {
|
||||
isStarted: true,
|
||||
endDate: pastDate,
|
||||
},
|
||||
entitlements: {
|
||||
isEntitlement: true,
|
||||
isFulfilled: true,
|
||||
isRefundable: false,
|
||||
canViewCourse: true,
|
||||
changeDeadline: pastDate,
|
||||
isExpired: false,
|
||||
},
|
||||
grades: { isPassing: false },
|
||||
},
|
||||
// Entitlement - Learner finished and passed. cannot refund. course archived. cert downloadable
|
||||
{
|
||||
enrollment: {
|
||||
isVerified: true,
|
||||
hasFinished: false,
|
||||
},
|
||||
courseRun: {
|
||||
isArchived: true,
|
||||
isStarted: true,
|
||||
endDate: pastDate,
|
||||
},
|
||||
entitlements: {
|
||||
isEntitlement: true,
|
||||
isFulfilled: true,
|
||||
isRefundable: false,
|
||||
canViewCourse: false,
|
||||
changeDeadline: pastDate,
|
||||
isExpired: false,
|
||||
},
|
||||
certificates: {
|
||||
isEarned: true,
|
||||
isAvailable: true,
|
||||
isDownloadable: true,
|
||||
availableDate: pastDate,
|
||||
certDownloadUrl: logos.social,
|
||||
certPreviewUrl: logos.edx,
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -363,7 +533,6 @@ export const entitlementCourses = [
|
||||
isFulfilled: false,
|
||||
canViewCourse: false,
|
||||
changeDeadline: futureDate,
|
||||
canChange: true,
|
||||
isExpired: false,
|
||||
},
|
||||
}, {
|
||||
@@ -374,7 +543,6 @@ export const entitlementCourses = [
|
||||
isFulfilled: false,
|
||||
canViewCourse: false,
|
||||
changeDeadline: soonDateStr,
|
||||
canChange: true,
|
||||
isExpired: false,
|
||||
},
|
||||
}, {
|
||||
@@ -385,7 +553,6 @@ export const entitlementCourses = [
|
||||
isFulfilled: false,
|
||||
canViewCourse: false,
|
||||
changeDeadline: pastDate,
|
||||
canChange: false,
|
||||
isExpired: false,
|
||||
},
|
||||
}, {
|
||||
@@ -396,7 +563,6 @@ export const entitlementCourses = [
|
||||
isFulfilled: false,
|
||||
canViewCourse: false,
|
||||
changeDeadline: pastDate,
|
||||
canChange: false,
|
||||
isExpired: true,
|
||||
},
|
||||
},
|
||||
@@ -417,18 +583,21 @@ export const courseRunData = courseRuns.map(
|
||||
lastEnrolled.setDate(lastEnrolled.getDate() - index);
|
||||
const iteratedData = [
|
||||
{
|
||||
provider: providers.edx,
|
||||
course: { title, bannerUrl: logos.edx, courseNumber },
|
||||
emailSettings: { isEmailEnabled: false, hasOptedOutOfEmail: false },
|
||||
relatedPrograms,
|
||||
provider: providers.edx,
|
||||
},
|
||||
{
|
||||
provider: providers.mit,
|
||||
course: { title, bannerUrl: logos.science, courseNumber },
|
||||
emailSettings: { isEmailEnabled: true, hasOptedOutOfEmail: false },
|
||||
provider: providers.mit,
|
||||
relatedPrograms: [relatedPrograms[0]],
|
||||
},
|
||||
{
|
||||
provider: null,
|
||||
course: { title, bannerUrl: logos.social, courseNumber },
|
||||
emailSettings: { isEmailEnabled: true, hasOptedOutOfEmail: true },
|
||||
provider: null,
|
||||
relatedPrograms: [],
|
||||
},
|
||||
];
|
||||
@@ -441,10 +610,13 @@ export const courseRunData = courseRuns.map(
|
||||
enrollment: genEnrollmentData(data.enrollment),
|
||||
courseRun: genCourseRunData({
|
||||
...data.courseRun,
|
||||
...iteratedData.emailSettings,
|
||||
courseId,
|
||||
lastEnrolled,
|
||||
}),
|
||||
...iteratedData[providerIndex],
|
||||
provider: iteratedData[providerIndex].provider,
|
||||
course: iteratedData[providerIndex].course,
|
||||
relatedPrograms: iteratedData[providerIndex].relatedPrograms,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user