diff --git a/src/hooks.ts b/src/hooks.ts index 1984625cb..d9cde4a80 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -50,11 +50,11 @@ export const useLoadOnScroll = ( useEffect(() => { if (enabled) { const canFetchNextPage = hasNextPage && !isFetchingNextPage; + // Used `loadLimit` to fetch next page before reach the end of the screen. + const loadLimit = 300; const onscroll = () => { // Verify the position of the scroll to implement an infinite scroll. - // Used `loadLimit` to fetch next page before reach the end of the screen. - const loadLimit = 300; const scrolledTo = window.scrollY + window.innerHeight; const scrollDiff = document.body.scrollHeight - scrolledTo; const isNearToBottom = scrollDiff <= loadLimit; @@ -65,7 +65,7 @@ export const useLoadOnScroll = ( window.addEventListener('scroll', onscroll); // If the content is less than the screen height, fetch the next page. - const hasNoScroll = document.body.scrollHeight <= window.innerHeight; + const hasNoScroll = (document.body.scrollHeight - loadLimit) <= window.innerHeight; if (hasNoScroll && canFetchNextPage) { fetchNextPage(); } diff --git a/src/library-authoring/LibraryAuthoringPage.tsx b/src/library-authoring/LibraryAuthoringPage.tsx index 01fc146b6..e10098e81 100644 --- a/src/library-authoring/LibraryAuthoringPage.tsx +++ b/src/library-authoring/LibraryAuthoringPage.tsx @@ -4,6 +4,7 @@ import classNames from 'classnames'; import { StudioFooter } from '@edx/frontend-component-footer'; import { useIntl } from '@edx/frontend-platform/i18n'; import { + ActionRow, Alert, Badge, Breadcrumb, @@ -57,12 +58,10 @@ const HeaderActions = () => { const { componentPickerMode } = useComponentPickerContext(); - const infoSidebarIsOpen = () => ( - sidebarComponentInfo?.type === SidebarBodyComponentId.Info - ); + const infoSidebarIsOpen = sidebarComponentInfo?.type === SidebarBodyComponentId.Info; const handleOnClickInfoSidebar = () => { - if (infoSidebarIsOpen()) { + if (infoSidebarIsOpen) { closeLibrarySidebar(); } else { openInfoSidebar(); @@ -73,8 +72,8 @@ const HeaderActions = () => {
-
- ); -}; - -const SubHeaderTitle = ({ - title, - infoClickHandler, -}: { - title: string; - infoClickHandler: () => void; -}) => { - const intl = useIntl(); - - const { componentPickerMode } = useComponentPickerContext(); - const { readOnly } = useLibraryContext(); - - const showReadOnlyBadge = readOnly && !componentPickerMode; - - return ( - - - {title} - - - {showReadOnlyBadge && ( -
- - {intl.formatMessage(messages.readOnlyBadge)} - -
+ {!componentPickerMode && ( + )} -
+ ); }; @@ -181,6 +178,7 @@ const LibraryCollectionPage = () => { return (
+ {libraryData.title} | {process.env.SITE_NAME} {!componentPickerMode && (
{ org={libraryData.org} contextId={libraryId} isLibrary + containerProps={{ + size: undefined, + }} /> )} - + openCollectionInfoSidebar(collectionId)} - /> - )} + title={} breadcrumbs={breadcumbs} headerActions={} + hideBorder /> - -
+ + -
+ -
+
- + {!componentPickerMode && }
{!!sidebarComponentInfo?.type && (
diff --git a/src/library-authoring/collections/messages.ts b/src/library-authoring/collections/messages.ts index 1dfaecd4a..ab8cbbc21 100644 --- a/src/library-authoring/collections/messages.ts +++ b/src/library-authoring/collections/messages.ts @@ -76,11 +76,6 @@ const messages = defineMessages({ defaultMessage: 'Collection Info', description: 'Alt text for collection info button besides the collection title', }, - readOnlyBadge: { - id: 'course-authoring.library-authoring.collections.badge.read-only', - defaultMessage: 'Read Only', - description: 'Text in badge when the user has read only access in collections page', - }, allCollections: { id: 'course-authoring.library-authoring.all-collections.text', defaultMessage: 'All Collections', @@ -91,11 +86,6 @@ const messages = defineMessages({ defaultMessage: 'Navigation breadcrumbs', description: 'Aria label for navigation breadcrumbs', }, - searchPlaceholder: { - id: 'course-authoring.library-authoring.search.placeholder.text', - defaultMessage: 'Search Collection', - description: 'Search placeholder text in collections page.', - }, noSearchResultsCollections: { id: 'course-authoring.library-authoring.no-search-results-collections', defaultMessage: 'No matching collections found in this library.', diff --git a/src/search-manager/FilterByBlockType.tsx b/src/search-manager/FilterByBlockType.tsx index cd887e3cc..98410be18 100644 --- a/src/search-manager/FilterByBlockType.tsx +++ b/src/search-manager/FilterByBlockType.tsx @@ -262,6 +262,8 @@ const FilterByBlockType: React.FC> = () => { blockType => ({ label: }), ); + const hiddenBlockTypes = blockTypesFilter.filter(blockType => !Object.keys(blockTypes).includes(blockType)); + return ( > = () => { value={blockTypesFilter} > + { + // Show applied filter items for block types that are not in the current search results + hiddenBlockTypes.map(blockType => ) + } { Object.entries(sortedBlockTypes).map(([blockType, count]) => ( @@ -282,7 +288,7 @@ const FilterByBlockType: React.FC> = () => { } { // Show a message if there are no options at all to avoid the impression that the dropdown isn't working - Object.keys(sortedBlockTypes).length === 0 ? ( + Object.keys(sortedBlockTypes).length === 0 && hiddenBlockTypes.length === 0 ? ( ) : null }