aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionDockingView.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-04-25 15:36:32 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-04-25 15:36:32 -0400
commitc318c6cb44b26b780e94e0f0854e5ec4c14634a9 (patch)
tree5c6bcb413f771988bd89efe3551007bd6d0f160c /src/client/views/collections/CollectionDockingView.tsx
parente1a65c5fa52dd094cc48c0c85b3c92ae8789666d (diff)
parent430dfa3afbfd38fe0db869b962da45903b888264 (diff)
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web into newDocs
Diffstat (limited to 'src/client/views/collections/CollectionDockingView.tsx')
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 86ee7cea9..ec5f823b0 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -5,7 +5,7 @@ import { action, observable, reaction, trace } from "mobx";
import { observer } from "mobx-react";
import * as ReactDOM from 'react-dom';
import Measure from "react-measure";
-import { Utils, returnTrue, emptyFunction, returnOne } from "../../../Utils";
+import { Utils, returnTrue, emptyFunction, returnOne, returnZero } from "../../../Utils";
import { Server } from "../../Server";
import { undoBatch } from "../../util/UndoManager";
import { DocumentView } from "../nodes/DocumentView";
@@ -16,9 +16,10 @@ import { ServerUtils } from "../../../server/ServerUtil";
import { DragManager, DragLinksAsDocuments } from "../../util/DragManager";
import { Transform } from '../../util/Transform';
import { Doc, Id, Opt, Field, FieldId } from "../../../new_fields/Doc";
-import { Cast } from "../../../new_fields/Types";
+import { Cast, NumCast } from "../../../new_fields/Types";
import { List } from "../../../new_fields/List";
import { DocServer } from "../../DocServer";
+import { listSpec } from "../../../new_fields/Schema";
@observer
export class CollectionDockingView extends React.Component<SubCollectionViewProps> {
@@ -256,8 +257,8 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
if (tfield !== undefined) {
tab.titleElement[0].textContent = f.Title;
}
- const lf = await Cast(f.linkedFromDocs, List);
- const lt = await Cast(f.linkedToDocs, List);
+ const lf = await Cast(f.linkedFromDocs, listSpec(Doc));
+ const lt = await Cast(f.linkedToDocs, listSpec(Doc));
let count = (lf ? lf.length : 0) + (lt ? lt.length : 0);
let counter: any = this.htmlToElement(`<div class="messageCounter">${count}</div>`);
tab.element.append(counter);
@@ -322,8 +323,8 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
DocServer.GetRefField(this.props.documentId).then(action((f: Opt<Field>) => this._document = f as Doc));
}
- nativeWidth = () => Cast(this._document!.nativeWidth, "number", this._panelWidth);
- nativeHeight = () => Cast(this._document!.nativeHeight, "number", this._panelHeight);
+ nativeWidth = () => NumCast(this._document!.nativeWidth, this._panelWidth);
+ nativeHeight = () => NumCast(this._document!.nativeHeight, this._panelHeight);
contentScaling = () => {
const nativeH = this.nativeHeight();
const nativeW = this.nativeWidth();
@@ -349,6 +350,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
<div className="collectionDockingView-content" ref={this._mainCont}
style={{ transform: `translate(${this.previewPanelCenteringOffset}px, 0px)` }}>
<DocumentView key={this._document![Id]} Document={this._document!}
+ toggleMinimized={emptyFunction}
addDocument={undefined}
removeDocument={undefined}
ContentScaling={this.contentScaling}
@@ -361,7 +363,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
whenActiveChanged={emptyFunction}
focus={emptyFunction}
ContainingCollectionView={undefined} />
- </div>);
+ </div >);
}
render() {