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