From 4df0a69ee678c12911a0a5a9f39b3dccadeef5f2 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Fri, 30 Jun 2017 00:00:05 -0700 Subject: [PATCH] Link sidebar directly to entry document --- .../SidebarCollectionList/SidebarCollectionList.js | 2 +- frontend/models/Collection.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/components/Layout/components/SidebarCollectionList/SidebarCollectionList.js b/frontend/components/Layout/components/SidebarCollectionList/SidebarCollectionList.js index 0115ec66..b2880ff6 100644 --- a/frontend/components/Layout/components/SidebarCollectionList/SidebarCollectionList.js +++ b/frontend/components/Layout/components/SidebarCollectionList/SidebarCollectionList.js @@ -17,7 +17,7 @@ const SidebarCollectionList = observer(({ collections }: Props) => {
Collections
{collections.data.map(collection => ( - + {collection.name} ))} diff --git a/frontend/models/Collection.js b/frontend/models/Collection.js index 4b89f27c..adc663c4 100644 --- a/frontend/models/Collection.js +++ b/frontend/models/Collection.js @@ -1,5 +1,5 @@ // @flow -import { extendObservable, action, runInAction } from 'mobx'; +import { extendObservable, action, computed, runInAction } from 'mobx'; import invariant from 'invariant'; import _ from 'lodash'; @@ -21,6 +21,12 @@ class Collection { client: ApiClient; errors: ErrorsStore; + /* Computed */ + + @computed get entryUrl(): string { + return this.type === 'atlas' ? this.documents[0].url : this.url; + } + /* Actions */ @action update = async () => {