richie-education 2.25.0-b2.dev173 → 2.25.0-b2.dev176
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/PurchaseButton/index.tsx +0 -1
- package/js/components/TeacherDashboardCourseList/index.tsx +15 -7
- package/js/hooks/useLearnerCoursesSearch/index.tsx +0 -1
- package/js/pages/DashboardCertificates/index.tsx +4 -3
- package/js/pages/DashboardContracts/index.tsx +4 -1
- package/js/pages/DashboardCourses/index.tsx +14 -20
- package/js/pages/TeacherDashboardCoursesLoader/index.tsx +1 -1
- package/js/pages/TeacherDashboardOrganizationCourseLoader/index.tsx +1 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/CourseProductItemFooter/index.tsx +1 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/_styles.scss +7 -2
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import { Spinner } from 'components/Spinner';
|
|
|
7
7
|
import context from 'utils/context';
|
|
8
8
|
import { useIntersectionObserver } from 'hooks/useIntersectionObserver';
|
|
9
9
|
import { CourseListItem, CourseProductRelation } from 'types/Joanie';
|
|
10
|
+
import Banner from 'components/Banner';
|
|
10
11
|
|
|
11
12
|
const messages = defineMessages({
|
|
12
13
|
loading: {
|
|
@@ -33,7 +34,7 @@ interface TeacherDashboardCourseListProps {
|
|
|
33
34
|
courseAndProductList?: (CourseListItem | CourseProductRelation)[];
|
|
34
35
|
isLoadingMore?: boolean;
|
|
35
36
|
hasMore?: boolean;
|
|
36
|
-
|
|
37
|
+
isNewSearchLoading?: boolean;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
const TeacherDashboardCourseList = ({
|
|
@@ -41,7 +42,7 @@ const TeacherDashboardCourseList = ({
|
|
|
41
42
|
organizationId,
|
|
42
43
|
loadMore,
|
|
43
44
|
courseAndProductList = [],
|
|
44
|
-
|
|
45
|
+
isNewSearchLoading = false,
|
|
45
46
|
isLoadingMore = false,
|
|
46
47
|
hasMore = false,
|
|
47
48
|
}: TeacherDashboardCourseListProps) => {
|
|
@@ -55,27 +56,34 @@ const TeacherDashboardCourseList = ({
|
|
|
55
56
|
|
|
56
57
|
return (
|
|
57
58
|
<div
|
|
58
|
-
className={classNames('dashboard-course-list', {
|
|
59
|
+
className={classNames('dashboard-course-list', {
|
|
60
|
+
'dashboard-course-list--fade': isNewSearchLoading,
|
|
61
|
+
})}
|
|
59
62
|
>
|
|
60
63
|
{titleTranslated && (
|
|
61
64
|
<h2 className="dashboard-course-list__title dashboard__page_title">{titleTranslated}</h2>
|
|
62
65
|
)}
|
|
63
|
-
|
|
66
|
+
|
|
67
|
+
{courseAndProductList.length > 0 && (
|
|
64
68
|
<CourseGlimpseList
|
|
65
69
|
courses={getCourseGlimpseListProps(courseAndProductList, intl, organizationId)}
|
|
66
70
|
context={context}
|
|
67
71
|
className="dashboard__course-glimpse-list"
|
|
68
72
|
/>
|
|
69
|
-
) : (
|
|
70
|
-
<FormattedMessage {...messages.emptyList} />
|
|
71
73
|
)}
|
|
72
74
|
|
|
73
|
-
{
|
|
75
|
+
{(isNewSearchLoading && courseAndProductList.length === 0) || isLoadingMore ? (
|
|
74
76
|
<Spinner aria-labelledby="loading-courses-data">
|
|
75
77
|
<span id="loading-courses-data">
|
|
76
78
|
<FormattedMessage {...messages.loading} />
|
|
77
79
|
</span>
|
|
78
80
|
</Spinner>
|
|
81
|
+
) : (
|
|
82
|
+
courseAndProductList.length === 0 && (
|
|
83
|
+
<div className="dashboard__courses__empty">
|
|
84
|
+
<Banner message={intl.formatMessage(messages.emptyList)} />
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
79
87
|
)}
|
|
80
88
|
|
|
81
89
|
{hasMore && (
|
|
@@ -36,11 +36,12 @@ export const DashboardCertificates = () => {
|
|
|
36
36
|
}
|
|
37
37
|
}, [certificates.meta?.pagination?.count]);
|
|
38
38
|
|
|
39
|
+
if (certificates.states.error) {
|
|
40
|
+
return <Banner message={certificates.states.error} type={BannerType.ERROR} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
return (
|
|
40
44
|
<div className="dashboard-certificates">
|
|
41
|
-
{certificates.states.error && (
|
|
42
|
-
<Banner message={certificates.states.error} type={BannerType.ERROR} />
|
|
43
|
-
)}
|
|
44
45
|
{certificates.items.length === 0 && certificates.states.fetching ? (
|
|
45
46
|
<Spinner aria-labelledby="loading-certificates-data">
|
|
46
47
|
<span id="loading-certificates-data">
|
|
@@ -39,9 +39,12 @@ export const DashboardContracts = () => {
|
|
|
39
39
|
}
|
|
40
40
|
}, [count]);
|
|
41
41
|
|
|
42
|
+
if (error) {
|
|
43
|
+
return <Banner message={error} type={BannerType.ERROR} />;
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
return (
|
|
43
47
|
<div className="dashboard-contracts">
|
|
44
|
-
{error && <Banner message={error} type={BannerType.ERROR} />}
|
|
45
48
|
{contracts.length === 0 && fetching ? (
|
|
46
49
|
<Spinner aria-labelledby="loading-contract-data">
|
|
47
50
|
<span id="loading-contract-data">
|
|
@@ -32,18 +32,8 @@ const messages = defineMessages({
|
|
|
32
32
|
|
|
33
33
|
export const DashboardCourses = () => {
|
|
34
34
|
const intl = useIntl();
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
query,
|
|
38
|
-
isLoadingMore,
|
|
39
|
-
isNewSearchLoading,
|
|
40
|
-
next,
|
|
41
|
-
hasMore,
|
|
42
|
-
submitSearch,
|
|
43
|
-
count,
|
|
44
|
-
error,
|
|
45
|
-
} = useLearnerCoursesSearch();
|
|
46
|
-
|
|
35
|
+
const { data, isLoadingMore, isNewSearchLoading, next, hasMore, submitSearch, count, error } =
|
|
36
|
+
useLearnerCoursesSearch();
|
|
47
37
|
const loadMoreButtonRef = useRef<HTMLButtonElement & HTMLAnchorElement>(null);
|
|
48
38
|
useIntersectionObserver({
|
|
49
39
|
target: loadMoreButtonRef,
|
|
@@ -61,11 +51,7 @@ export const DashboardCourses = () => {
|
|
|
61
51
|
<SearchBar onSubmit={submitSearch} />
|
|
62
52
|
<SearchResultsCount nbResults={count} />
|
|
63
53
|
</SearchBar.Container>
|
|
64
|
-
|
|
65
|
-
<div className="dashboard__courses__empty">
|
|
66
|
-
<Banner message={intl.formatMessage(messages.emptyList)} />
|
|
67
|
-
</div>
|
|
68
|
-
)}
|
|
54
|
+
|
|
69
55
|
<div
|
|
70
56
|
className={classNames('dashboard__courses__list', {
|
|
71
57
|
'dashboard-course-list--fade': isNewSearchLoading,
|
|
@@ -82,13 +68,21 @@ export const DashboardCourses = () => {
|
|
|
82
68
|
</div>
|
|
83
69
|
))}
|
|
84
70
|
</div>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
|
|
72
|
+
{(isNewSearchLoading && data.length === 0) || isLoadingMore ? (
|
|
73
|
+
<Spinner aria-labelledby="loading-courses-data">
|
|
74
|
+
<span id="loading-courses-data">
|
|
88
75
|
<FormattedMessage {...messages.loading} />
|
|
89
76
|
</span>
|
|
90
77
|
</Spinner>
|
|
78
|
+
) : (
|
|
79
|
+
data.length === 0 && (
|
|
80
|
+
<div className="dashboard__courses__empty">
|
|
81
|
+
<Banner message={intl.formatMessage(messages.emptyList)} />
|
|
82
|
+
</div>
|
|
83
|
+
)
|
|
91
84
|
)}
|
|
85
|
+
|
|
92
86
|
{hasMore && (
|
|
93
87
|
<Button
|
|
94
88
|
onClick={() => next()}
|
|
@@ -62,7 +62,7 @@ const CourseProductItemFooter = ({
|
|
|
62
62
|
orderGroup={orderGroup}
|
|
63
63
|
buttonProps={{ fullWidth: true }}
|
|
64
64
|
/>
|
|
65
|
-
<p>
|
|
65
|
+
<p className="product-widget__footer__message">
|
|
66
66
|
<FormattedMessage
|
|
67
67
|
{...messages.nbSeatsAvailable}
|
|
68
68
|
values={{ nb: orderGroup.nb_available_seats }}
|
|
@@ -143,14 +143,19 @@
|
|
|
143
143
|
gap: 0.5rem;
|
|
144
144
|
|
|
145
145
|
&__message {
|
|
146
|
+
color: r-theme-val(product-item, base-color);
|
|
146
147
|
text-align: center;
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
&__order-group {
|
|
150
151
|
text-align: center;
|
|
151
152
|
|
|
152
|
-
|
|
153
|
-
margin
|
|
153
|
+
.product-widget__footer__message {
|
|
154
|
+
margin: 0.5rem 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&:last-child {
|
|
158
|
+
margin-bottom: -1rem;
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
}
|