diff --git a/src/features/Classes/Class/ClassPage/Actions.jsx b/src/features/Classes/Class/ClassPage/Actions.jsx index b38f7d5f..482c5484 100644 --- a/src/features/Classes/Class/ClassPage/Actions.jsx +++ b/src/features/Classes/Class/ClassPage/Actions.jsx @@ -32,7 +32,7 @@ const Actions = ({ previousPage }) => { const handleEnrollStudentModal = () => setIsEnrollModalOpen(!isEnrollModalOpen); - const handeManageButton = () => { + const handleManageButton = () => { history.push(`/manage-instructors/${courseId}/${classId}?classId=${queryClassId}&previous=${previousPage}`); }; @@ -41,7 +41,7 @@ const Actions = ({ previousPage }) => { diff --git a/src/features/Dashboard/InstructorAssignSection/ClassCard.jsx b/src/features/Dashboard/InstructorAssignSection/ClassCard.jsx index d65bbc24..3901d21b 100644 --- a/src/features/Dashboard/InstructorAssignSection/ClassCard.jsx +++ b/src/features/Dashboard/InstructorAssignSection/ClassCard.jsx @@ -1,52 +1,40 @@ import React from 'react'; -import { useDispatch } from 'react-redux'; +import { useHistory } from 'react-router-dom'; import PropTypes from 'prop-types'; import { Button } from 'react-paragon-topaz'; -import { useToggle } from '@edx/paragon'; -import AssignInstructors from 'features/Instructors/AssignInstructors'; -import { updateClassSelected } from 'features/Instructors/data/slice'; - -import { formatUTCDate } from 'helpers'; +import { formatDateRange } from 'helpers'; import 'features/Dashboard/InstructorAssignSection/index.scss'; const ClassCard = ({ data }) => { - const dispatch = useDispatch(); - const [isOpen, open, close] = useToggle(false); - const fullDate = formatUTCDate(data.startDate, 'PP'); + const history = useHistory(); - const handleAssignModal = () => { - dispatch(updateClassSelected(data.classId)); // eslint-disable-line react/prop-types - open(); + const handleManageButton = () => { + history.push(`/manage-instructors/${data?.masterCourseName}/${data?.className}?classId=${data?.classId}&previous=dashboard`); }; return ( - <> - -
-

{data?.className}

-

{data?.masterCourseName}

-

{fullDate}

- -
- - +
+

{data?.className}

+

{data?.masterCourseName}

+

{formatDateRange(data.startDate, data?.endDate)}

+ +
); }; ClassCard.propTypes = { data: PropTypes.shape({ + classId: PropTypes.string, className: PropTypes.string, masterCourseName: PropTypes.string, startDate: PropTypes.string, + endDate: PropTypes.string, }), }; diff --git a/src/features/Dashboard/InstructorAssignSection/_test_/index.test.jsx b/src/features/Dashboard/InstructorAssignSection/_test_/index.test.jsx index 550a14c5..55eadfb4 100644 --- a/src/features/Dashboard/InstructorAssignSection/_test_/index.test.jsx +++ b/src/features/Dashboard/InstructorAssignSection/_test_/index.test.jsx @@ -39,6 +39,6 @@ describe('Instructor Assign component', () => { expect(getByText('ccx 1')).toBeInTheDocument(); expect(getByText('Demo Course 1')).toBeInTheDocument(); expect(getByText('Jan 23, 2024')).toBeInTheDocument(); - expect(getByText('Assign instructor')).toBeInTheDocument(); + expect(getByText('Manage instructor')).toBeInTheDocument(); }); });