WIP: Dashboard tabs
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user