Use computed for atlas detection
This commit is contained in:
@@ -77,6 +77,11 @@ class DocumentScene extends React.Component {
|
||||
if (doc) {
|
||||
actions = (
|
||||
<div className={ styles.actions }>
|
||||
{ store.isAtlas ? (
|
||||
<HeaderAction>
|
||||
<Link to={ `/documents/${doc.id}/new` }>New document</Link>
|
||||
</HeaderAction>
|
||||
) : null }
|
||||
<HeaderAction>
|
||||
<Link to={ `/documents/${doc.id}/edit` }>Edit</Link>
|
||||
</HeaderAction>
|
||||
@@ -106,7 +111,7 @@ class DocumentScene extends React.Component {
|
||||
</CenteredContent>
|
||||
) : (
|
||||
<Flex flex={ true }>
|
||||
{ doc.atlas.type === 'atlas' ? (
|
||||
{ store.isAtlas ? (
|
||||
<div className={ styles.sidebar }>
|
||||
<Tree
|
||||
paddingLeft={20}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { observable, action } from 'mobx';
|
||||
import { observable, action, computed } from 'mobx';
|
||||
import { client } from 'utils/ApiClient';
|
||||
import { browserHistory } from 'react-router';
|
||||
|
||||
@@ -8,6 +8,13 @@ const store = new class DocumentSceneStore {
|
||||
@observable isFetching = true;
|
||||
@observable isDeleting;
|
||||
|
||||
/* Computed */
|
||||
|
||||
@computed get isAtlas() {
|
||||
console.log(this.document.atlas.type)
|
||||
return this.document.atlas.type === 'atlas';
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
|
||||
@action fetchDocument = async (id) => {
|
||||
|
||||
Reference in New Issue
Block a user