Link sidebar directly to entry document

This commit is contained in:
Jori Lallo committed 2017-06-30 00:00:05 -07:00
1 parent 37ed973322
commit 4df0a69ee6
2 files changed
+8 -2

No files matched your search

@@ -17,7 +17,7 @@ const SidebarCollectionList = observer(({ collections }: Props) => {
<Flex column>
<Header>Collections</Header>
{collections.data.map(collection => (
<SidebarLink key={collection.id} to={collection.url}>
<SidebarLink key={collection.id} to={collection.entryUrl}>
{collection.name}
</SidebarLink>
))}
+7 -1
View File
@@ -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 () => {