richie-education 3.1.3-dev17 → 3.1.3-dev23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/components/CourseGlimpse/index.spec.tsx +2 -0
- package/js/components/CourseGlimpse/index.tsx +2 -0
- package/js/components/CourseGlimpse/utils.ts +6 -0
- package/js/types/Course.ts +2 -0
- package/js/types/Joanie.ts +2 -0
- package/js/types/index.ts +4 -2
- package/js/utils/test/factories/joanie.ts +2 -0
- package/js/utils/test/factories/richie.ts +6 -2
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/_styles.scss +7 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/CourseRunList.tsx +2 -2
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/_styles.scss +9 -0
- package/package.json +1 -1
|
@@ -59,6 +59,8 @@ describe('widgets/Search/components/CourseGlimpse', () => {
|
|
|
59
59
|
certificate_offer: CourseCertificateOffer.FREE,
|
|
60
60
|
certificate_price: null,
|
|
61
61
|
price_currency: 'EUR',
|
|
62
|
+
discounted_price: null,
|
|
63
|
+
discount: null,
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
const contextProps: CommonDataProps['context'] = RichieContextFactory().one();
|
|
@@ -53,6 +53,8 @@ const getCourseGlimpsePropsFromOffering = (
|
|
|
53
53
|
offering.product.type === ProductType.CERTIFICATE ? offering.product.price : null,
|
|
54
54
|
price: offering.product.type === ProductType.CREDENTIAL ? offering.product.price : null,
|
|
55
55
|
price_currency: offering.product.price_currency,
|
|
56
|
+
discounted_price: offering.product.discounted_price || null,
|
|
57
|
+
discount: offering.product.discount || null,
|
|
56
58
|
};
|
|
57
59
|
};
|
|
58
60
|
|
|
@@ -77,6 +79,8 @@ const getCourseGlimpsePropsFromRichieCourse = (course: RichieCourse): CourseGlim
|
|
|
77
79
|
certificate_offer: course.certificate_offer,
|
|
78
80
|
offer: course.offer,
|
|
79
81
|
certificate_price: course.certificate_price,
|
|
82
|
+
discounted_price: course.discounted_price,
|
|
83
|
+
discount: course.discount,
|
|
80
84
|
});
|
|
81
85
|
|
|
82
86
|
const getCourseGlimpsePropsFromJoanieCourse = (
|
|
@@ -114,6 +118,8 @@ const getCourseGlimpsePropsFromJoanieCourse = (
|
|
|
114
118
|
certificate_offer: null,
|
|
115
119
|
offer: null,
|
|
116
120
|
certificate_price: null,
|
|
121
|
+
discounted_price: null,
|
|
122
|
+
discount: null,
|
|
117
123
|
};
|
|
118
124
|
};
|
|
119
125
|
|
package/js/types/Course.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface Course extends Resource {
|
|
|
47
47
|
certificate_price: Nullable<number>;
|
|
48
48
|
price: Nullable<number>;
|
|
49
49
|
price_currency: string;
|
|
50
|
+
discounted_price: Nullable<number>;
|
|
51
|
+
discount: Nullable<string>;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
export function isRichieCourse(course: Course | JoanieCourse): course is Course {
|
package/js/types/Joanie.ts
CHANGED
|
@@ -149,6 +149,8 @@ export interface Product {
|
|
|
149
149
|
state: CourseState;
|
|
150
150
|
instructions: Nullable<string>;
|
|
151
151
|
contract_definition?: ContractDefinition;
|
|
152
|
+
discounted_price: Nullable<number>;
|
|
153
|
+
discount: Nullable<string>;
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
export interface CredentialProduct extends Product {
|
package/js/types/index.ts
CHANGED
|
@@ -35,11 +35,13 @@ export interface CourseRun {
|
|
|
35
35
|
title?: string;
|
|
36
36
|
snapshot?: string;
|
|
37
37
|
display_mode: CourseRunDisplayMode;
|
|
38
|
-
price?: number
|
|
38
|
+
price?: Nullable<number>;
|
|
39
39
|
price_currency?: string;
|
|
40
40
|
offer?: string;
|
|
41
|
-
certificate_price?: number
|
|
41
|
+
certificate_price?: Nullable<number>;
|
|
42
42
|
certificate_offer?: string;
|
|
43
|
+
discounted_price: Nullable<number>;
|
|
44
|
+
discount: Nullable<string>;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export enum Priority {
|
|
@@ -205,6 +205,8 @@ export const CredentialProductFactory = factory((): CredentialProduct => {
|
|
|
205
205
|
remaining_order_count: faker.number.int({ min: 1, max: 100 }),
|
|
206
206
|
state: CourseStateFactory().one(),
|
|
207
207
|
instructions: null,
|
|
208
|
+
discounted_price: null,
|
|
209
|
+
discount: null,
|
|
208
210
|
};
|
|
209
211
|
});
|
|
210
212
|
|
|
@@ -60,11 +60,11 @@ export const CourseRunFactory = factory<CourseRun>(() => {
|
|
|
60
60
|
certificateOfferValues[Math.floor(Math.random() * certificateOfferValues.length)];
|
|
61
61
|
const currency = faker.finance.currency().code;
|
|
62
62
|
const price = [OfferType.FREE, OfferType.PARTIALLY_FREE].includes(offer)
|
|
63
|
-
?
|
|
63
|
+
? null
|
|
64
64
|
: parseFloat(faker.finance.amount({ min: 1, max: 100, symbol: currency, autoFormat: true }));
|
|
65
65
|
const certificatePrice =
|
|
66
66
|
certificateOffer === OfferType.FREE
|
|
67
|
-
?
|
|
67
|
+
? null
|
|
68
68
|
: parseFloat(faker.finance.amount({ min: 1, max: 100, symbol: currency, autoFormat: true }));
|
|
69
69
|
return {
|
|
70
70
|
id: faker.number.int(),
|
|
@@ -83,6 +83,8 @@ export const CourseRunFactory = factory<CourseRun>(() => {
|
|
|
83
83
|
offer,
|
|
84
84
|
certificate_price: certificatePrice,
|
|
85
85
|
certificate_offer: certificateOffer,
|
|
86
|
+
discounted_price: null,
|
|
87
|
+
discount: null,
|
|
86
88
|
};
|
|
87
89
|
});
|
|
88
90
|
|
|
@@ -244,5 +246,7 @@ export const CourseLightFactory = factory<Course>(() => {
|
|
|
244
246
|
certificate_price: null,
|
|
245
247
|
price: null,
|
|
246
248
|
price_currency: 'EUR',
|
|
249
|
+
discounted_price: null,
|
|
250
|
+
discount: null,
|
|
247
251
|
};
|
|
248
252
|
});
|
|
@@ -67,6 +67,11 @@
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
& .product-widget__header-main {
|
|
71
|
+
display: flex;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
70
75
|
& .product-widget__title {
|
|
71
76
|
color: r-theme-val(product-item, light-color);
|
|
72
77
|
font-size: 1.5rem;
|
|
@@ -76,7 +81,7 @@
|
|
|
76
81
|
background-color: r-theme-val(product-item, light-color);
|
|
77
82
|
border-radius: 100vw;
|
|
78
83
|
color: r-theme-val(product-item, base-border);
|
|
79
|
-
font-size:
|
|
84
|
+
font-size: 1rem;
|
|
80
85
|
margin-bottom: 0.3rem;
|
|
81
86
|
padding: 0.375rem 0.81rem;
|
|
82
87
|
white-space: nowrap;
|
|
@@ -90,6 +95,7 @@
|
|
|
90
95
|
|
|
91
96
|
&-discount {
|
|
92
97
|
color: r-theme-val(product-item, feedback-color);
|
|
98
|
+
text-decoration: none;
|
|
93
99
|
}
|
|
94
100
|
}
|
|
95
101
|
|
|
@@ -68,7 +68,7 @@ const CourseRunList = ({ courseRuns }: Props) => {
|
|
|
68
68
|
</strong>
|
|
69
69
|
<span
|
|
70
70
|
data-testid={`course-run-${courseRun.id}-enrollment-dates`}
|
|
71
|
-
className="course-runs-item__metadata"
|
|
71
|
+
className="course-runs-item__metadata course-runs-item__enrollment-date"
|
|
72
72
|
>
|
|
73
73
|
<EnrollmentDate
|
|
74
74
|
enrollment_start={courseRun.enrollment_start}
|
|
@@ -77,7 +77,7 @@ const CourseRunList = ({ courseRuns }: Props) => {
|
|
|
77
77
|
</span>
|
|
78
78
|
<span
|
|
79
79
|
data-testid={`course-run-${courseRun.id}-languages`}
|
|
80
|
-
className="course-runs-item__metadata"
|
|
80
|
+
className="course-runs-item__metadata course-runs-item__languages"
|
|
81
81
|
>
|
|
82
82
|
<FormattedMessage
|
|
83
83
|
{...sharedMessages.language}
|
|
@@ -113,6 +113,15 @@
|
|
|
113
113
|
line-height: 1.4em;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
&__enrollment-date {
|
|
117
|
+
font-weight: bold;
|
|
118
|
+
color: #03317f;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__languages {
|
|
122
|
+
font-weight: bold;
|
|
123
|
+
}
|
|
124
|
+
|
|
116
125
|
&__feedback {
|
|
117
126
|
color: r-theme-val(product-item, feedback-color);
|
|
118
127
|
}
|