Added: Recently published view to collection

Added: Infinite scroll to collection
This commit is contained in:
Tom Moor
2019-01-07 23:14:43 -08:00
parent 74515e0b19
commit e6e89dc243
10 changed files with 87 additions and 25 deletions

View File

@@ -67,6 +67,18 @@ export default class DocumentsStore extends BaseStore<Document> {
);
}
recentlyPublishedInCollection(collectionId: string): Document[] {
return orderBy(
filter(
Array.from(this.data.values()),
document =>
document.collectionId === collectionId && !!document.publishedAt
),
'publishedAt',
'desc'
);
}
@computed
get starred(): Document[] {
return filter(this.orderedData, d => d.starred);
@@ -126,6 +138,15 @@ export default class DocumentsStore extends BaseStore<Document> {
return data;
};
@action
fetchRecentlyPublished = async (options: ?PaginationParams): Promise<*> => {
return this.fetchNamedPage('list', {
sort: 'publishedAt',
direction: 'DESC',
...options,
});
};
@action
fetchRecentlyViewed = async (options: ?PaginationParams): Promise<*> => {
const data = await this.fetchNamedPage('viewed', options);