@@ -6,15 +6,17 @@ import {
66 Alert ,
77 Button ,
88} from '@openedx/paragon' ;
9+ import { getConfig } from '@edx/frontend-platform' ;
910import { useIntl } from '@edx/frontend-platform/i18n' ;
1011import { Error } from '@openedx/paragon/icons' ;
1112
12- import { useContentLibraryV2List } from '../../.. /library-authoring' ;
13- import { LoadingSpinner } from '../../.. /generic/Loading' ;
14- import AlertMessage from '../../.. /generic/alert-message' ;
13+ import { useContentLibraryV2List } from '@src /library-authoring' ;
14+ import { LoadingSpinner } from '@src /generic/Loading' ;
15+ import AlertMessage from '@src /generic/alert-message' ;
1516import CardItem from '../../card-item' ;
1617import messages from '../messages' ;
1718import LibrariesV2Filters from './libraries-v2-filters' ;
19+ import { WelcomeLibrariesV2Alert } from './WelcomeLibrariesV2Alert' ;
1820
1921type Props = Record < never , never > ;
2022
@@ -37,35 +39,23 @@ const LibrariesV2Tab: React.FC<Props> = () => {
3739
3840 const {
3941 data,
40- isLoading ,
42+ isPending ,
4143 isError,
4244 } = useContentLibraryV2List ( { page : currentPage , ...filterParams } ) ;
4345
44- if ( isLoading && ! isFiltered ) {
46+ if ( isPending && ! isFiltered ) {
4547 return (
4648 < Row className = "m-0 mt-4 justify-content-center" >
4749 < LoadingSpinner />
4850 </ Row >
4951 ) ;
5052 }
5153
52- const hasV2Libraries = ! isLoading && ! isError && ( ( data ! . results . length || 0 ) > 0 ) ;
53-
54- // TODO: update this link when tutorial is ready.
55- const librariesTutorialLink = (
56- < Alert . Link href = "https://docs.openedx.org" >
57- { intl . formatMessage ( messages . librariesV2TabBetaTutorialLinkText ) }
58- </ Alert . Link >
59- ) ;
54+ const hasV2Libraries = ! isPending && ! isError && ( ( data ! . results . length || 0 ) > 0 ) ;
6055
6156 return (
6257 < >
63- < Alert variant = "info" >
64- { intl . formatMessage (
65- messages . librariesV2TabBetaText ,
66- { link : librariesTutorialLink } ,
67- ) }
68- </ Alert >
58+ { getConfig ( ) . ENABLE_LEGACY_LIBRARY_MIGRATOR === 'true' && ( < WelcomeLibrariesV2Alert /> ) }
6959
7060 { isError ? (
7161 < AlertMessage
@@ -81,24 +71,24 @@ const LibrariesV2Tab: React.FC<Props> = () => {
8171 < div className = "courses-tab-container" >
8272 < div className = "d-flex flex-row justify-content-between my-4" >
8373 < LibrariesV2Filters
84- isLoading = { isLoading }
74+ isPending = { isPending }
8575 isFiltered = { isFiltered }
8676 filterParams = { filterParams }
8777 setFilterParams = { setFilterParams }
8878 setCurrentPage = { setCurrentPage }
8979 />
90- { ! isLoading && ! isError
91- && (
92- < p >
93- { intl . formatMessage ( messages . coursesPaginationInfo , {
94- length : data ! . results . length ,
95- total : data ! . count ,
96- } ) }
97- </ p >
98- ) }
80+ { ! isPending && ! isError
81+ && (
82+ < p >
83+ { intl . formatMessage ( messages . coursesPaginationInfo , {
84+ length : data . results . length ,
85+ total : data . count ,
86+ } ) }
87+ </ p >
88+ ) }
9989 </ div >
10090
101- { hasV2Libraries
91+ { hasV2Libraries
10292 ? data ! . results . map ( ( {
10393 id, org, slug, title,
10494 } ) => (
@@ -110,7 +100,7 @@ const LibrariesV2Tab: React.FC<Props> = () => {
110100 number = { slug }
111101 path = { `/library/${ id } ` }
112102 />
113- ) ) : isFiltered && ! isLoading && (
103+ ) ) : isFiltered && ! isPending && (
114104 < Alert className = "mt-4" >
115105 < Alert . Heading >
116106 { intl . formatMessage ( messages . librariesV2TabLibraryNotFoundAlertTitle ) }
0 commit comments