From 0408a5437269e1f29e6db4bdbf8c84aa37b7e2ff Mon Sep 17 00:00:00 2001
From: Maxwell Frank <92897870+MaxFrank13@users.noreply.github.com>
Date: Tue, 15 Oct 2024 15:04:52 -0400
Subject: [PATCH] refactor: plugin slot implementation (#465)
---
.../CoursesPanel/CourseList/index.jsx | 19 +++---
.../CoursesPanel/CourseList/index.test.jsx | 2 +-
.../__snapshots__/index.test.jsx.snap | 28 ++++----
src/containers/CoursesPanel/index.jsx | 20 +-----
src/containers/Dashboard/DashboardLayout.jsx | 4 +-
.../Dashboard/DashboardLayout.test.jsx | 4 +-
.../DashboardLayout.test.jsx.snap | 8 +--
.../__snapshots__/index.test.jsx.snap | 15 -----
.../WidgetContainers/WidgetSidebar/index.jsx | 23 -------
src/plugin-slots/CourseListSlot/README.md | 60 ++++++++++++++++++
.../images/course_list_slot.png | Bin 0 -> 231861 bytes
.../images/readme_custom_course_list.png | Bin 0 -> 21370 bytes
src/plugin-slots/CourseListSlot/index.jsx | 16 +++++
src/plugin-slots/NoCoursesViewSlot/README.md | 47 ++++++++++++++
.../images/no_course_view_slot.png | Bin 0 -> 80231 bytes
.../images/readme_custom_no_courses.png | Bin 0 -> 24510 bytes
src/plugin-slots/NoCoursesViewSlot/index.jsx | 12 ++++
src/plugin-slots/README.md | 3 +
src/plugin-slots/WidgetSidebarSlot/README.md | 58 +++++++++++++++++
.../__snapshots__/index.test.jsx.snap | 9 +++
.../images/readme_custom_sidebar.png | Bin 0 -> 171627 bytes
.../images/widget_sidebar_slot.png | Bin 0 -> 222284 bytes
src/plugin-slots/WidgetSidebarSlot/index.jsx | 13 ++++
.../WidgetSidebarSlot}/index.test.jsx | 4 +-
src/test/app.test.jsx | 2 +-
.../LookingForChallengeWidget/index.jsx | 8 ++-
.../LookingForChallengeWidget/track.js | 5 ++
27 files changed, 266 insertions(+), 94 deletions(-)
delete mode 100644 src/containers/WidgetContainers/WidgetSidebar/__snapshots__/index.test.jsx.snap
delete mode 100644 src/containers/WidgetContainers/WidgetSidebar/index.jsx
create mode 100644 src/plugin-slots/CourseListSlot/README.md
create mode 100644 src/plugin-slots/CourseListSlot/images/course_list_slot.png
create mode 100644 src/plugin-slots/CourseListSlot/images/readme_custom_course_list.png
create mode 100644 src/plugin-slots/CourseListSlot/index.jsx
create mode 100644 src/plugin-slots/NoCoursesViewSlot/README.md
create mode 100644 src/plugin-slots/NoCoursesViewSlot/images/no_course_view_slot.png
create mode 100644 src/plugin-slots/NoCoursesViewSlot/images/readme_custom_no_courses.png
create mode 100644 src/plugin-slots/NoCoursesViewSlot/index.jsx
create mode 100644 src/plugin-slots/WidgetSidebarSlot/README.md
create mode 100644 src/plugin-slots/WidgetSidebarSlot/__snapshots__/index.test.jsx.snap
create mode 100644 src/plugin-slots/WidgetSidebarSlot/images/readme_custom_sidebar.png
create mode 100644 src/plugin-slots/WidgetSidebarSlot/images/widget_sidebar_slot.png
create mode 100644 src/plugin-slots/WidgetSidebarSlot/index.jsx
rename src/{containers/WidgetContainers/WidgetSidebar => plugin-slots/WidgetSidebarSlot}/index.test.jsx (81%)
diff --git a/src/containers/CoursesPanel/CourseList/index.jsx b/src/containers/CoursesPanel/CourseList/index.jsx
index 2f6111a..2b178b2 100644
--- a/src/containers/CoursesPanel/CourseList/index.jsx
+++ b/src/containers/CoursesPanel/CourseList/index.jsx
@@ -9,9 +9,10 @@ import CourseCard from 'containers/CourseCard';
import { useIsCollapsed } from './hooks';
-export const CourseList = ({
- filterOptions, setPageNumber, numPages, showFilters, visibleList,
-}) => {
+export const CourseList = ({ courseListData }) => {
+ const {
+ filterOptions, setPageNumber, numPages, showFilters, visibleList,
+ } = courseListData;
const isCollapsed = useIsCollapsed();
return (
<>
@@ -38,14 +39,16 @@ export const CourseList = ({
);
};
-CourseList.propTypes = {
+export const courseListDataShape = PropTypes.shape({
showFilters: PropTypes.bool.isRequired,
- // eslint-disable-next-line react/forbid-prop-types
- visibleList: PropTypes.arrayOf(PropTypes.object).isRequired,
- // eslint-disable-next-line react/forbid-prop-types
- filterOptions: PropTypes.object.isRequired,
+ visibleList: PropTypes.arrayOf(PropTypes.shape()).isRequired,
+ filterOptions: PropTypes.shape().isRequired,
numPages: PropTypes.number.isRequired,
setPageNumber: PropTypes.func.isRequired,
+});
+
+CourseList.propTypes = {
+ courseListData: courseListDataShape,
};
export default CourseList;
diff --git a/src/containers/CoursesPanel/CourseList/index.test.jsx b/src/containers/CoursesPanel/CourseList/index.test.jsx
index a2e09b3..0584eda 100644
--- a/src/containers/CoursesPanel/CourseList/index.test.jsx
+++ b/src/containers/CoursesPanel/CourseList/index.test.jsx
@@ -23,7 +23,7 @@ describe('CourseList', () => {
useIsCollapsed.mockReturnValue(false);
const createWrapper = (courseListData = defaultCourseListData) => (
- shallow(
+ {courseData.course.courseName} +
+ ))} +1IhC;T(*o}S6`Hp
z|9Mqtz7D5QF(xq$+RZO9gYPXGO}<6wf7xp*qle&`O3x?GHdZsPcW;yBTSmM>fL*w;
zyBWNQaMSK $9&O7619P)2F(#tXivj2lNY!NaXeWe6o3c!?K+;VJ$q+xuxY4x}mnTh_)R&KVx
zo^LMP4YiRpo{MhM<5O$9T0|5YEnt(giG%{gydVGC#+ C%w;VYZz=QI6FjtHplwoQs=#Ypfqe>KWEh*x`c0
zQJ+g~in3e3!X;1fX#sOV%`IZTdgZLq*Ng|?j{;Z>XBW9i!ATaQRb6@ef8Twtx8ENQ
z52mOe`Qp|08C^&kpZ}Atjp;3|G3VO<-dFHyo8XCL>V
9*UFAH{=RHuyQs}_t;17{qzTyuw6rxP%MByIWT5-K;k@Iv13D(>pGl-5-04;h4
z=>q&V#Rq(Lzd}&veiDWjI_h$A*o77{