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:
parent
f956f9d2fe
commit
0aa6cc7e5a
1 changed files with 12 additions and 9 deletions
|
@ -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) => {
|
||||
return (
|
||||
(unpublishedCollections[id] &&
|
||||
unpublishedCollections[id].name.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())) ||
|
||||
(publishedCollections[id] &&
|
||||
publishedCollections[id].name.toLocaleLowerCase().includes(searchText.toLocaleLowerCase()))
|
||||
);
|
||||
});
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue