fix: show/hide "new library" button based on separate v1/v2 permissions (#1545)
This commit is contained in:
@@ -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"
|
||||
>
|
||||
|
||||
@@ -67,6 +67,7 @@ module.exports = {
|
||||
requestCourseCreatorUrl: '/request_course_creator',
|
||||
rerunCreatorStatus: true,
|
||||
showNewLibraryButton: true,
|
||||
showNewLibraryV2Button: true,
|
||||
splitStudioHome: false,
|
||||
studioName: 'Studio',
|
||||
studioShortName: 'Studio',
|
||||
|
||||
@@ -37,6 +37,7 @@ export const generateGetStudioHomeDataApiResponse = () => ({
|
||||
requestCourseCreatorUrl: '/request_course_creator',
|
||||
rerunCreatorStatus: true,
|
||||
showNewLibraryButton: true,
|
||||
showNewLibraryV2Button: true,
|
||||
splitStudioHome: false,
|
||||
studioName: 'Studio',
|
||||
studioShortName: 'Studio',
|
||||
|
||||
Reference in New Issue
Block a user