forked from openedx/frontend-app-authoring
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jill/FAL-3758-sort-components' into rpenido/bkp/fal-376…
…4-before-squash
- Loading branch information
Showing
13 changed files
with
485 additions
and
60 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
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,35 @@ | ||
import React from 'react'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
|
||
import { SearchContextProvider, useSearchContext } from '../search-manager'; | ||
import { SearchSortOption } from '../search-manager/data/api'; | ||
import LibraryComponents from './components/LibraryComponents'; | ||
import LibrarySection from './components/LibrarySection'; | ||
import messages from './messages'; | ||
|
||
const RecentlyModified: React.FC<{ libraryId: string }> = ({ libraryId }) => { | ||
const intl = useIntl(); | ||
const { totalHits: componentCount } = useSearchContext(); | ||
|
||
return componentCount > 0 | ||
? ( | ||
<LibrarySection | ||
title={intl.formatMessage(messages.recentlyModifiedSectionTitle)} | ||
contentCount={componentCount} | ||
> | ||
<LibraryComponents libraryId={libraryId} variant="preview" /> | ||
</LibrarySection> | ||
) | ||
: null; | ||
}; | ||
|
||
const LibraryRecentlyModified: React.FC<{ libraryId: string }> = ({ libraryId }) => ( | ||
<SearchContextProvider | ||
extraFilter={`context_key = "${libraryId}"`} | ||
overrideSearchSortOrder={SearchSortOption.RECENTLY_MODIFIED} | ||
> | ||
<RecentlyModified libraryId={libraryId} /> | ||
</SearchContextProvider> | ||
); | ||
|
||
export default LibraryRecentlyModified; |
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
Oops, something went wrong.