fix: show/hide "new library" button based on separate v1/v2 permissions (#1545)

This commit is contained in:
Rômulo Penido
2024-12-06 15:40:45 -03:00
committed by GitHub
parent a0f6f4357e
commit 2f1263ab5a
3 changed files with 4 additions and 2 deletions

View File

@@ -57,6 +57,7 @@ const StudioHome = () => {
studioShortName,
studioRequestEmail,
showNewLibraryButton,
showNewLibraryV2Button,
} = studioHomeData;
const getHeaderButtons = useCallback(() => {
@@ -86,7 +87,7 @@ const StudioHome = () => {
);
}
if (showNewLibraryButton || showV2LibraryURL) {
if ((showNewLibraryButton && !showV2LibraryURL) || (showV2LibraryURL && showNewLibraryV2Button)) {
const newLibraryClick = () => {
if (showV2LibraryURL) {
navigate('/library/create');
@@ -101,7 +102,6 @@ const StudioHome = () => {
variant="outline-primary"
iconBefore={AddIcon}
size="sm"
disabled={showNewCourseContainer}
onClick={newLibraryClick}
data-testid="new-library-button"
>

View File

@@ -67,6 +67,7 @@ module.exports = {
requestCourseCreatorUrl: '/request_course_creator',
rerunCreatorStatus: true,
showNewLibraryButton: true,
showNewLibraryV2Button: true,
splitStudioHome: false,
studioName: 'Studio',
studioShortName: 'Studio',

View File

@@ -37,6 +37,7 @@ export const generateGetStudioHomeDataApiResponse = () => ({
requestCourseCreatorUrl: '/request_course_creator',
rerunCreatorStatus: true,
showNewLibraryButton: true,
showNewLibraryV2Button: true,
splitStudioHome: false,
studioName: 'Studio',
studioShortName: 'Studio',