aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionBaseView.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-04-13 14:10:28 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-04-13 14:10:28 -0400
commit75b82b3bd936f99e7df78a202371093404c5626a (patch)
treef097cd13b221f2c6a2b7de0173789fbb558640f1 /src/client/views/collections/CollectionBaseView.tsx
parentc4ce158bd87ee837b54f5b7b7a4d7610296c214b (diff)
parented9bb54c6307e809c6c6aa40c7d77cd3480e7e73 (diff)
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/collections/CollectionBaseView.tsx')
-rw-r--r--src/client/views/collections/CollectionBaseView.tsx12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx
index ac320eda3..b5eaab349 100644
--- a/src/client/views/collections/CollectionBaseView.tsx
+++ b/src/client/views/collections/CollectionBaseView.tsx
@@ -8,8 +8,6 @@ import { ListField } from '../../../fields/ListField';
import { NumberField } from '../../../fields/NumberField';
import { ContextMenu } from '../ContextMenu';
import { FieldViewProps } from '../nodes/FieldView';
-import { CompileScript } from '../../util/Scripting';
-import { ScriptField } from '../../../fields/ScriptField';
export enum CollectionViewType {
Invalid,
@@ -34,19 +32,18 @@ export interface CollectionViewProps extends FieldViewProps {
contentRef?: React.Ref<HTMLDivElement>;
}
-export const COLLECTION_BORDER_WIDTH = 1;
@observer
export class CollectionBaseView extends React.Component<CollectionViewProps> {
- get collectionViewType(): CollectionViewType {
+ get collectionViewType(): CollectionViewType | undefined {
let Document = this.props.Document;
let viewField = Document.GetT(KeyStore.ViewType, NumberField);
if (viewField === FieldWaiting) {
- return CollectionViewType.Invalid;
+ return undefined;
} else if (viewField) {
return viewField.Data;
} else {
- return CollectionViewType.Freeform;
+ return CollectionViewType.Invalid;
}
}
@@ -182,9 +179,10 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
active: this.active,
onActiveChanged: this.onActiveChanged,
};
+ const viewtype = this.collectionViewType;
return (
<div className={this.props.className || "collectionView-cont"} onContextMenu={this.props.onContextMenu} ref={this.props.contentRef}>
- {this.props.children(this.collectionViewType, props)}
+ {viewtype !== undefined ? this.props.children(viewtype, props) : (null)}
</div>
);
}