limit collections to show to 24 (#147)

* limit collections to show to 24

A user had many collections. 
Since we have a search field, we can limit to 24.

* const
This commit is contained in:
jessopb 2021-10-29 10:53:56 -04:00 committed by GitHub
parent f956f9d2fe
commit 0aa6cc7e5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ const ALL = 'All';
const PRIVATE = 'Private';
const PUBLIC = 'Public';
const COLLECTION_FILTERS = [ALL, PRIVATE, PUBLIC];
const COLLECTION_SHOW_COUNT = 24;
export default function CollectionsListMine(props: Props) {
const {
@ -53,16 +54,18 @@ export default function CollectionsListMine(props: Props) {
let filteredCollections;
if (searchText && collectionsToShow) {
filteredCollections = collectionsToShow.filter((id) => {
filteredCollections = collectionsToShow
.filter((id) => {
return (
(unpublishedCollections[id] &&
unpublishedCollections[id].name.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())) ||
(publishedCollections[id] &&
publishedCollections[id].name.toLocaleLowerCase().includes(searchText.toLocaleLowerCase()))
);
});
})
.slice(0, COLLECTION_SHOW_COUNT);
} else {
filteredCollections = collectionsToShow || [];
filteredCollections = collectionsToShow.slice(0, COLLECTION_SHOW_COUNT) || [];
}
const watchLater = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.WATCH_LATER_ID);