-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add lib v2/legacy tabs in studio home (#1050)
This PR adds a new configuration flag that shows/hides tabs in studio home along with some new functionality around to V1 and V2 Libraries. When the new LIBRARY_MODE flag is set to "mixed" (default in dev) it will show "Libraries" and "Legacy Libraries" tabs that correspond to v1 and v2 tabs respectively. When the new LIBRARY_MODE flag is set to "v1 only" (default in production) or "v2 only", only one tab "Libraries" is shown and only the respective libraries are fetched when the tab is clicked. In addition to the above changes, the URL/route now updates when clicking on the tabs, and navigating to it directly would open up that tab as well as a new placeholder page that you will be redirected to when clicking on a v2 library if the library authoring MFE is not enabled.
- Loading branch information
1 parent
e2ed3bc
commit 088a01d
Showing
24 changed files
with
755 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,4 @@ INVITE_STUDENTS_EMAIL_TO="[email protected]" | |
ENABLE_HOME_PAGE_COURSE_API_V2=true | ||
ENABLE_CHECKLIST_QUALITY=true | ||
ENABLE_GRADING_METHOD_IN_PROBLEMS=false | ||
LIBRARY_MODE="mixed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as studioHomeMock } from './studioHomeMock'; | ||
export { default as listStudioHomeV2LibrariesMock } from './listStudioHomeV2LibrariesMock'; |
44 changes: 44 additions & 0 deletions
44
src/studio-home/__mocks__/listStudioHomeV2LibrariesMock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module.exports = { | ||
next: null, | ||
previous: null, | ||
count: 2, | ||
num_pages: 1, | ||
current_page: 1, | ||
start: 0, | ||
results: [ | ||
{ | ||
id: 'lib:SampleTaxonomyOrg1:AL1', | ||
type: 'complex', | ||
org: 'SampleTaxonomyOrg1', | ||
slug: 'AL1', | ||
title: 'Another Library 2', | ||
description: '', | ||
num_blocks: 0, | ||
version: 0, | ||
last_published: null, | ||
allow_lti: false, | ||
allow_public_learning: false, | ||
allow_public_read: false, | ||
has_unpublished_changes: false, | ||
has_unpublished_deletes: false, | ||
license: '', | ||
}, | ||
{ | ||
id: 'lib:SampleTaxonomyOrg1:TL1', | ||
type: 'complex', | ||
org: 'SampleTaxonomyOrg1', | ||
slug: 'TL1', | ||
title: 'Test Library 1', | ||
description: '', | ||
num_blocks: 0, | ||
version: 0, | ||
last_published: null, | ||
allow_lti: false, | ||
allow_public_learning: false, | ||
allow_public_read: false, | ||
has_unpublished_changes: false, | ||
has_unpublished_deletes: false, | ||
license: '', | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { getStudioHomeLibrariesV2 } from './api'; | ||
|
||
/** | ||
* Builds the query to fetch list of V2 Libraries | ||
*/ | ||
const useListStudioHomeV2Libraries = (customParams) => ( | ||
useQuery({ | ||
queryKey: ['listV2Libraries', customParams], | ||
queryFn: () => getStudioHomeLibrariesV2(customParams), | ||
}) | ||
); | ||
|
||
export default useListStudioHomeV2Libraries; |
Oops, something went wrong.