aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackingView.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-05-21 20:49:49 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-05-21 20:49:49 -0400
commitab001ffd9749814c3f0b0f30e9f86f65e2f8ac0c (patch)
treecff5fefec854832cda432ebd436854f02fc5876a /src/client/views/collections/CollectionStackingView.tsx
parentb08e28ac279c0199d7f828d05e6e346865579592 (diff)
"Rebased" Stanley's image upload changes
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
new file mode 100644
index 000000000..a1cb73123
--- /dev/null
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -0,0 +1,54 @@
+import React = require("react");
+import { observer } from "mobx-react";
+import { CollectionSubView } from "./CollectionSubView";
+import Measure from "react-measure";
+import { Doc, WidthSym, HeightSym } from "../../../new_fields/Doc";
+import { DocumentView } from "../nodes/DocumentView";
+import { Transform } from "../../util/Transform";
+import { emptyFunction, returnOne } from "../../../Utils";
+import "./CollectionStackingView.scss";
+import { runInAction, action, observable, computed } from "mobx";
+import { StrCast } from "../../../new_fields/Types";
+
+@observer
+export class CollectionStackingView extends CollectionSubView(doc => doc) {
+ getPreviewTransform = (): Transform => this.props.ScreenToLocalTransform();
+
+ @action
+ moveDocument = (doc: Doc, targetCollection: Doc, addDocument: (document: Doc) => boolean): boolean => {
+ this.props.removeDocument(doc);
+ addDocument(doc);
+ return true;
+ }
+
+ render() {
+ const docs = this.childDocs;
+ return (
+ <div className="collectionStackingView" onWheel={(e: React.WheelEvent) => e.stopPropagation()}>
+ <div className="collectionStackingView-description">{StrCast(this.props.Document.documentText, StrCast(this.props.Document.title, "stacking collection"))}</div>
+ <div className="collectionStackingView-flexCont">
+ {docs.map(d => {
+ return (<div className="collectionStackingView-docView-container">
+ <DocumentView Document={d}
+ addDocument={this.props.addDocument} removeDocument={this.props.removeDocument}
+ moveDocument={this.moveDocument}
+ ContainingCollectionView={this.props.CollectionView}
+ isTopMost={false}
+ ScreenToLocalTransform={this.getPreviewTransform}
+ focus={emptyFunction}
+ ContentScaling={returnOne}
+ PanelWidth={d[WidthSym]}
+ PanelHeight={d[HeightSym]}
+ selectOnLoad={false}
+ parentActive={this.props.active}
+ addDocTab={this.props.addDocTab}
+ bringToFront={emptyFunction}
+ toggleMinimized={emptyFunction}
+ whenActiveChanged={this.props.active} />
+ </div>);
+ })}
+ </div>
+ </div>
+ );
+ }
+} \ No newline at end of file