diff --git a/src/studio-home/StudioHome.jsx b/src/studio-home/StudioHome.jsx index 8348aaca34..45d7c8fb05 100644 --- a/src/studio-home/StudioHome.jsx +++ b/src/studio-home/StudioHome.jsx @@ -49,6 +49,7 @@ const StudioHome = ({ intl }) => { studioRequestEmail, libraryAuthoringMfeUrl, redirectToLibraryAuthoringMfe, + showNewLibraryButton, } = studioHomeData; function getHeaderButtons() { @@ -78,23 +79,25 @@ const StudioHome = ({ intl }) => { ); } - let libraryHref = `${getConfig().STUDIO_BASE_URL}/home_library`; - if (redirectToLibraryAuthoringMfe) { - libraryHref = `${libraryAuthoringMfeUrl}/create`; - } + if (showNewLibraryButton) { + let libraryHref = `${getConfig().STUDIO_BASE_URL}/home_library`; + if (redirectToLibraryAuthoringMfe) { + libraryHref = `${libraryAuthoringMfeUrl}/create`; + } - headerButtons.push( - , - ); + headerButtons.push( + , + ); + } return headerButtons; } diff --git a/src/studio-home/StudioHome.test.jsx b/src/studio-home/StudioHome.test.jsx index 8385c6d9b1..ad02f4373f 100644 --- a/src/studio-home/StudioHome.test.jsx +++ b/src/studio-home/StudioHome.test.jsx @@ -171,6 +171,15 @@ describe('', async () => { }); }); + it('do not render new library button if showNewLibraryButton is False', () => { + useSelector.mockReturnValue({ + ...studioHomeMock, + showNewLibraryButton: false, + }); + const { queryByTestId } = render(); + expect(queryByTestId('new-library-button')).not.toBeInTheDocument(); + }); + it('should render create new course container', async () => { useSelector.mockReturnValue({ ...studioHomeMock,