Skip to content

Commit

Permalink
feat: Add action to launch gradebook
Browse files Browse the repository at this point in the history
  • Loading branch information
AuraAlba committed Nov 29, 2024
1 parent 77603fd commit 6248444
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/features/Classes/Class/ClassPage/Actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const Actions = ({ previousPage }) => {
const classes = useSelector((state) => state.classes.allClasses.data);
const deletionState = useSelector((state) => state.courses.newClass.status);
const selectedInstitution = useSelector((state) => state.main.selectedInstitution);
const gradebookUrl = getConfig().GRADEBOOK_MICROFRONTEND_URL || getConfig().LMS_BASE_URL;

const [deletionClassState, setDeletionState] = useState(initialDeletionClassState);

Expand Down Expand Up @@ -67,6 +68,10 @@ const Actions = ({ previousPage }) => {
history.push(addQueryParam(`/manage-instructors/${courseId}/${classId}?previous=${previousPage}`));
};

const handleGradebookButton = () => {
window.open(`${gradebookUrl}/gradebook/${classIdDecoded}`, '_blank', 'noopener,noreferrer');
};

const handleResetDeletion = () => {
setDeletionState(initialDeletionClassState);
dispatch(resetClassState());
Expand Down Expand Up @@ -132,6 +137,10 @@ const Actions = ({ previousPage }) => {
<i className="fa-regular fa-pencil mr-2 mb-1" />
Edit class
</Dropdown.Item>
<Dropdown.Item onClick={handleGradebookButton}>
<i className="fa-regular fa-book mr-2 mb-1" />
Gradebook
</Dropdown.Item>
<Dropdown.Item onClick={handleOpenDeleteModal} className="text-danger">
<i className="fa-regular fa-trash mr-2 mb-1" />
Delete class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe('ClassesPage', () => {
expect(getByText('Assign instructor')).toBeInTheDocument();
expect(getByText('Edit Class')).toBeInTheDocument();
expect(getByText('Delete Class')).toBeInTheDocument();
expect(getByText('Gradebook')).toBeInTheDocument();
});
});
});

0 comments on commit 6248444

Please sign in to comment.