From 2e4ab06f38323bba06a4d77c04da1507bac5657f Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 24 Aug 2020 18:09:48 -0400 Subject: moved contexts from properties button to properties view section --- .../views/collections/ParentDocumentSelector.tsx | 18 +++++------- .../collectionFreeForm/PropertiesView.scss | 34 ++++++++++++++++++++++ .../collectionFreeForm/PropertiesView.tsx | 18 ++++++++++++ 3 files changed, 59 insertions(+), 11 deletions(-) (limited to 'src/client/views/collections') diff --git a/src/client/views/collections/ParentDocumentSelector.tsx b/src/client/views/collections/ParentDocumentSelector.tsx index a6de32145..6556e7889 100644 --- a/src/client/views/collections/ParentDocumentSelector.tsx +++ b/src/client/views/collections/ParentDocumentSelector.tsx @@ -19,6 +19,7 @@ export const Flyout = higflyout.default; type SelectorProps = { Document: Doc, Stack?: any, + hideTitle?: boolean, addDocTab(doc: Doc, location: string): void }; @@ -35,20 +36,15 @@ export class SelectorContextMenu extends React.Component { this._reaction?.(); } async fetchDocuments() { - const aliases = (await SearchUtil.GetAliasesOfDocument(this.props.Document)); - const containerProtoSets = await Promise.all(aliases.map(async alias => - ((await SearchUtil.Search("", true, { fq: `data_l:"${alias[Id]}"` })).docs))); + const aliases = await SearchUtil.GetAliasesOfDocument(this.props.Document); + const containerProtoSets = await Promise.all(aliases.map(async alias => ((await SearchUtil.Search("", true, { fq: `data_l:"${alias[Id]}"` })).docs))); const containerProtos = containerProtoSets.reduce((p, set) => { set.map(s => p.add(s)); return p; }, new Set()); - const containerSets = await Promise.all(Array.from(containerProtos.keys()).map(async container => { - return (SearchUtil.GetAliasesOfDocument(container)); - })); + const containerSets = await Promise.all(Array.from(containerProtos.keys()).map(async container => SearchUtil.GetAliasesOfDocument(container))); const containers = containerSets.reduce((p, set) => { set.map(s => p.add(s)); return p; }, new Set()); - const doclayoutSets = await Promise.all(Array.from(containers.keys()).map(async (dp) => { - return (SearchUtil.GetAliasesOfDocument(dp)); - })); + const doclayoutSets = await Promise.all(Array.from(containers.keys()).map(async (dp) => SearchUtil.GetAliasesOfDocument(dp))); const doclayouts = Array.from(doclayoutSets.reduce((p, set) => { set.map(s => p.add(s)); return p; }, new Set()).keys()); runInAction(() => { - this._docs = doclayouts.filter(doc => !Doc.AreProtosEqual(doc, CollectionDockingView.Instance.props.Document)).map(doc => ({ col: doc, target: this.props.Document })); + this._docs = doclayouts.filter(doc => !Doc.AreProtosEqual(doc, CollectionDockingView.Instance.props.Document)).filter(doc => !Doc.IsSystem(doc)).map(doc => ({ col: doc, target: this.props.Document })); this._otherDocs = []; }); } @@ -68,7 +64,7 @@ export class SelectorContextMenu extends React.Component { render() { return
-

Contexts:

+ {this.props.hideTitle ? (null) :

Contexts:

} {this._docs.map(doc =>

{doc.col.title?.toString()}

)} {this._otherDocs.length ?
: null} {this._otherDocs.map(doc =>

{doc.col.title?.toString()}

)} diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.scss b/src/client/views/collections/collectionFreeForm/PropertiesView.scss index e3ced887d..254afeb0a 100644 --- a/src/client/views/collections/collectionFreeForm/PropertiesView.scss +++ b/src/client/views/collections/collectionFreeForm/PropertiesView.scss @@ -394,6 +394,40 @@ cursor: auto; } } + .propertiesView-contexts { + + .propertiesView-contexts-title { + font-weight: bold; + font-size: 12.5px; + padding: 4px; + display: flex; + color: white; + padding-left: 8px; + background-color: rgb(51, 51, 51); + + &:hover { + cursor: pointer; + } + + .propertiesView-contexts-title-icon { + float: right; + justify-items: right; + align-items: flex-end; + margin-left: auto; + margin-right: 9px; + + &:hover { + cursor: pointer; + } + } + } + + .propertiesView-contexts-content { + overflow: hidden; + padding: 10px; + } + + } .propertiesView-layout { diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx index c5d396859..f3e3c77f7 100644 --- a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx +++ b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx @@ -25,6 +25,8 @@ import { PropertiesButtons } from "../../PropertiesButtons"; import { FormatShapePane } from "./FormatShapePane"; import "./FormatShapePane.scss"; import "./PropertiesView.scss"; +import { CollectionDockingView } from "../CollectionDockingView"; +import { ParentDocSelector, SelectorContextMenu } from "../ParentDocumentSelector"; const higflyout = require("@hig/flyout"); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -64,6 +66,7 @@ export class PropertiesView extends React.Component { @observable openSharing: boolean = true; @observable openFields: boolean = true; @observable openLayout: boolean = true; + @observable openContexts: boolean = true; @observable openAppearance: boolean = true; @observable openTransform: boolean = true; // @observable selectedUser: string = ""; @@ -251,6 +254,10 @@ export class PropertiesView extends React.Component { ref && observer.observe(ref); } + @computed get contexts() { + return !this.selectedDoc ? (null) : CollectionDockingView.AddRightSplit(doc)} />; + } + previewBackground = () => "lightgrey"; @computed get layoutPreview() { if (this.selectedDoc) { @@ -959,6 +966,17 @@ export class PropertiesView extends React.Component { {novice ? this.noviceFields : this.expandedField}
} +
+
this.openContexts = !this.openContexts)} + style={{ backgroundColor: this.openContexts ? "black" : "" }}> + Contexts +
+ +
+
+ {this.openContexts ?
{this.contexts}
: null} +
this.openLayout = !this.openLayout)} -- cgit v1.2.3-70-g09d2