@@ -20,22 +20,33 @@ import { HelpSidebar } from './HelpSidebar';
2020import { ImportedCourseCard } from './ImportedCourseCard' ;
2121import messages from './messages' ;
2222
23+ const ImportCourseButton = ( ) => {
24+ const navigate = useNavigate ( ) ;
25+
26+ if ( getConfig ( ) . ENABLE_COURSE_IMPORT_IN_LIBRARY === 'true' ) {
27+ return (
28+ < Button iconBefore = { Add } onClick = { ( ) => navigate ( 'courses' ) } >
29+ < FormattedMessage { ...messages . importCourseButton } />
30+ </ Button >
31+ ) ;
32+ }
33+
34+ return null ;
35+ } ;
36+
2337const EmptyState = ( ) => (
2438 < Container size = "md" className = "py-6" >
2539 < Card >
2640 < Stack direction = "horizontal" gap = { 3 } className = "my-6 justify-content-center" >
2741 < FormattedMessage { ...messages . emptyStateText } />
28- < Button iconBefore = { Add } disabled >
29- < FormattedMessage { ...messages . emptyStateButtonText } />
30- </ Button >
42+ < ImportCourseButton />
3143 </ Stack >
3244 </ Card >
3345 </ Container >
3446) ;
3547
3648export const CourseImportHomePage = ( ) => {
3749 const intl = useIntl ( ) ;
38- const navigate = useNavigate ( ) ;
3950 const { libraryId, libraryData, readOnly } = useLibraryContext ( ) ;
4051 const { data : courseImports } = useCourseImports ( libraryId ) ;
4152
@@ -66,13 +77,7 @@ export const CourseImportHomePage = () => {
6677 title = { intl . formatMessage ( messages . pageTitle ) }
6778 subtitle = { intl . formatMessage ( messages . pageSubtitle ) }
6879 hideBorder
69- headerActions = {
70- getConfig ( ) . ENABLE_COURSE_IMPORT_IN_LIBRARY === 'true' && (
71- < Button onClick = { ( ) => navigate ( 'courses' ) } >
72- { intl . formatMessage ( messages . importCourseButton ) }
73- </ Button >
74- )
75- }
80+ headerActions = { < ImportCourseButton /> }
7681 />
7782 </ div >
7883 < Layout xs = { [ { span : 9 } , { span : 3 } ] } >
0 commit comments