WIP: Dashboard tabs

This commit is contained in:
Tom Moor
2018-08-09 23:14:51 -07:00
parent d222a311ad
commit 2f681b1ce8
9 changed files with 182 additions and 147 deletions

View File

@@ -29,10 +29,8 @@ class DocumentsStore extends BaseStore {
ui: UiStore;
/* Computed */
@computed
get recentlyViewed(): Array<Document> {
get recentlyViewed(): Document[] {
const docs = [];
this.recentlyViewedIds.forEach(id => {
const doc = this.getById(id);
@@ -51,6 +49,17 @@ class DocumentsStore extends BaseStore {
return docs;
}
owned(userId: string): Document[] {
return _.orderBy(
_.filter(
this.data.values(),
document => document.createdBy.id === userId
),
'updatedAt',
'desc'
);
}
pinnedInCollection(collectionId: string): Document[] {
return _.filter(
this.recentlyEditedInCollection(collectionId),
@@ -152,6 +161,11 @@ class DocumentsStore extends BaseStore {
await this.fetchPage('pinned', options);
};
@action
fetchOwned = async (options: ?PaginationParams): Promise<*> => {
await this.fetchPage('owned', options);
};
@action
search = async (
query: string,