diff --git a/src/App.scss b/src/App.scss index 747472b..d87087d 100755 --- a/src/App.scss +++ b/src/App.scss @@ -12,6 +12,7 @@ $input-focus-box-shadow: $input-box-shadow; // hack to get upgrade to paragon 4. @import "~@edx/frontend-component-footer/dist/_footer"; #root { + // Removing a odd 1.5 scaling on checkboxes.: input[type=checkbox] { transform: none; } diff --git a/src/containers/Dashboard/index.jsx b/src/containers/Dashboard/index.jsx index 4e59824..a184fac 100644 --- a/src/containers/Dashboard/index.jsx +++ b/src/containers/Dashboard/index.jsx @@ -23,6 +23,7 @@ export const Dashboard = () => { const hasCourses = appHooks.useHasCourses(); const hasAvailableDashboards = appHooks.useHasAvailableDashboards(); + const showSelectSessionModal = appHooks.useShowSelectSessionModal(); return (
{hasAvailableDashboards && } @@ -30,7 +31,7 @@ export const Dashboard = () => { <>
- + {showSelectSessionModal && ()}
diff --git a/src/containers/SelectSessionModal/index.jsx b/src/containers/SelectSessionModal/index.jsx index edc7d59..640f109 100644 --- a/src/containers/SelectSessionModal/index.jsx +++ b/src/containers/SelectSessionModal/index.jsx @@ -40,7 +40,7 @@ export const SelectSessionModal = () => { {hint} {entitlementSessions?.map((session) => ( - + {dateFormatter(formatDate, session.startDate)} - {dateFormatter(formatDate, session.endDate)} ))} diff --git a/src/data/redux/app/selectors.js b/src/data/redux/app/selectors.js index ae27dfb..73f2ee0 100644 --- a/src/data/redux/app/selectors.js +++ b/src/data/redux/app/selectors.js @@ -28,6 +28,10 @@ export const hasAvailableDashboards = createSelector( [module.simpleSelectors.enterpriseDashboards], (data) => !!data.availableDashboards, ); +export const showSelectSessionModal = createSelector( + [module.simpleSelectors.selectSessionModal], + (data) => data.cardId != null, +); export const courseCardData = (state, cardId) => ( module.simpleSelectors.courseData(state)[cardId] @@ -130,29 +134,30 @@ export const currentList = (state, { pageSize, }) => { let list = Object.values(module.simpleSelectors.courseData(state)); + const hasFilter = filters.reduce((obj, filter) => ({ ...obj, [filter]: true }), {}); if (filters.length) { list = list.filter(course => { - if (filters.includes(FilterKeys.notEnrolled)) { + if (hasFilter[FilterKeys.notEnrolled]) { if (course.enrollment.isEnrolled) { return false; } } - if (filters.includes(FilterKeys.done)) { + if (hasFilter[FilterKeys.done]) { if (!course.enrollment.hasFinished) { return false; } } - if (filters.includes(FilterKeys.upgraded)) { + if (hasFilter[FilterKeys.upgraded]) { if (!course.enrollment.isVerified) { return false; } } - if (filters.includes(FilterKeys.inProgress)) { + if (hasFilter[FilterKeys.inProgress]) { if (!course.enrollment.hasStarted) { return false; } } - if (filters.includes(FilterKeys.notStarted)) { + if (hasFilter[FilterKeys.notStarted]) { if (course.enrollment.hasStarted) { return false; } @@ -189,4 +194,5 @@ export default StrictDict({ currentList, hasCourses, hasAvailableDashboards, + showSelectSessionModal, }); diff --git a/src/data/redux/hooks.js b/src/data/redux/hooks.js index b1d33e0..b4f1d16 100644 --- a/src/data/redux/hooks.js +++ b/src/data/redux/hooks.js @@ -17,6 +17,7 @@ export const useHasAvailableDashboards = () => useSelector(appSelectors.hasAvail export const useCurrentCourseList = (opts) => useSelector( state => appSelectors.currentList(state, opts), ); +export const useShowSelectSessionModal = () => useSelector(appSelectors.showSelectSessionModal); // eslint-disable-next-line export const useCourseCardData = (selector) => (cardId) => useSelector( diff --git a/src/data/services/lms/fakeData/courses.js b/src/data/services/lms/fakeData/courses.js index 9e89fa4..581e3ed 100644 --- a/src/data/services/lms/fakeData/courses.js +++ b/src/data/services/lms/fakeData/courses.js @@ -141,15 +141,8 @@ export const availableSessions = [ { startDate: '1/2/2000', endDate: '1/2/2020', courseId: genCourseId(1000) }, { startDate: '2/3/2000', endDate: '2/3/2020', courseId: genCourseId(1001) }, { startDate: '3/4/2000', endDate: '3/4/2020', courseId: genCourseId(1002) }, - { startDate: '1/2/2000', endDate: '1/2/2020', courseId: genCourseId(1000) }, - { startDate: '2/3/2000', endDate: '2/3/2020', courseId: genCourseId(1001) }, - { startDate: '3/4/2000', endDate: '3/4/2020', courseId: genCourseId(1002) }, - { startDate: '1/2/2000', endDate: '1/2/2020', courseId: genCourseId(1000) }, - { startDate: '2/3/2000', endDate: '2/3/2020', courseId: genCourseId(1001) }, - { startDate: '3/4/2000', endDate: '3/4/2020', courseId: genCourseId(1002) }, - { startDate: '1/2/2000', endDate: '1/2/2020', courseId: genCourseId(1000) }, - { startDate: '2/3/2000', endDate: '2/3/2020', courseId: genCourseId(1001) }, - { startDate: '3/4/2000', endDate: '3/4/2020', courseId: genCourseId(1002) }, + { startDate: '4/5/2000', endDate: '4/6/2020', courseId: genCourseId(1003) }, + { startDate: '5/6/2000', endDate: '5/7/2020', courseId: genCourseId(1004) }, ]; export const courseRuns = [