aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-07-30 16:20:12 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-07-30 16:20:12 -0500
commitad6cc2bd1327fa8ca078171133e3e6e357860ec7 (patch)
tree22e68e2cf685de7f3546ecb54815ede82a1e99bc /src/client/views/collections
parentda018ee4a1aa1b6f7f5e7c6cc13cb3d445033350 (diff)
parenta9ec139961b0262698851cd7e2dd3430a0acddd7 (diff)
merge w master
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionMenu.tsx13
-rw-r--r--src/client/views/collections/CollectionSubView.tsx2
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx4
3 files changed, 13 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 14ab35a63..1ac8798bd 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -29,6 +29,7 @@ import RichTextMenu from "../nodes/formattedText/RichTextMenu";
import { RichTextField } from "../../../fields/RichTextField";
import { ScriptField } from "../../../fields/ScriptField";
import { IconProp } from '@fortawesome/fontawesome-svg-core';
+import { DocUtils } from "../../documents/Documents";
@observer
export default class CollectionMenu extends AntimodeMenu {
@@ -330,13 +331,19 @@ export class CollectionViewBaseChrome extends React.Component<CollectionMenuProp
<div className="collectionViewBaseChrome">
{this.props.type === CollectionViewType.Invalid ||
this.props.type === CollectionViewType.Docking || this.isText ? (null) : this.viewModes}
- {this.props.type === CollectionViewType.Invalid ||
- this.props.type === CollectionViewType.Docking || this.isText ? (null) : this.templateChrome}
+ {this.props.type === CollectionViewType.Docking || this.isText ? (null) : this.templateChrome}
<div className="collectionViewBaseChrome-viewSpecs" title="filter documents to show" style={{ display: "grid" }}>
<button className={"antimodeMenu-button"} onClick={this.toggleViewSpecs} >
<FontAwesomeIcon icon="filter" size="lg" />
</button>
</div>
+
+ {this.props.docView.props.ContainingCollectionDoc?._viewType !== CollectionViewType.Freeform ? (null) : <button className={"antimodeMenu-button"} key="float"
+ style={{ backgroundColor: !this.props.docView.layoutDoc.isAnnotating ? "121212" : undefined, borderRight: "1px solid gray" }}
+ title="Toggle Overlay Layer"
+ onClick={() => DocumentView.FloatDoc(this.props.docView)}>
+ <FontAwesomeIcon icon={["fab", "buffer"]} size={"lg"} />
+ </button>}
</div>
{this.subChrome}
</div>
@@ -572,7 +579,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
<FontAwesomeIcon icon={"caret-right"} size={"lg"} />
</div> : null}
- {!this.props.isOverlay || this.isText ? (null) :
+ {!this.props.isOverlay || this.document.type !== DocumentType.WEB || this.isText ? (null) :
<button className={"antimodeMenu-button"} key="hypothesis"
style={{
backgroundColor: !this.props.docView.layoutDoc.isAnnotating ? "121212" : undefined,
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index a89fcc703..9f78c15eb 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -127,7 +127,7 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
const docs = rawdocs.filter(d => !(d instanceof Promise)).map(d => d as Doc);
const docFilters = this.docFilters();
- const viewSpecScript = Cast(this.props.Document.viewSpecScript, ScriptField);
+ const viewSpecScript = ScriptCast(this.props.Document.viewSpecScript);
const docRangeFilters = this.props.ignoreFields?.includes("_docRangeFilters") ? [] : Cast(this.props.Document._docRangeFilters, listSpec("string"), []);
return this.props.Document.dontRegisterView ? docs : DocUtils.FilterDocs(docs, docFilters, docRangeFilters, viewSpecScript);
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 44414fa2b..d6203e7da 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -103,8 +103,8 @@ class TreeView extends React.Component<TreeViewProps> {
childDocList(field: string) {
const layout = Doc.LayoutField(this.doc) instanceof Doc ? Doc.LayoutField(this.doc) as Doc : undefined;
return ((this.props.dataDoc ? DocListCast(this.props.dataDoc[field]) : undefined) || // if there's a data doc for an expanded template, use it's data field
- (layout ? Cast(layout[field], listSpec(Doc)) : undefined) || // else if there's a layout doc, display it's fields
- Cast(this.doc[field], listSpec(Doc))) as Doc[]; // otherwise use the document's data field
+ (layout ? DocListCast(layout[field]) : undefined) || // else if there's a layout doc, display it's fields
+ DocListCast(this.doc[field])) as Doc[]; // otherwise use the document's data field
}
@computed get childDocs() { return this.childDocList(this.fieldKey); }
@computed get childLinks() { return this.childDocList("links"); }