From c48b9015da3f68e83179fea9cb03cfe9fe7d1331 Mon Sep 17 00:00:00 2001 From: eperelm2 Date: Tue, 6 Jun 2023 17:03:25 -0400 Subject: Context and link message is back --- src/client/views/PropertiesView.tsx | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index 5c3ed39a4..0007ac84f 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -7,7 +7,7 @@ import { intersection } from 'lodash'; import { action, computed, Lambda, observable } from 'mobx'; import { observer } from 'mobx-react'; import { ColorState, SketchPicker } from 'react-color'; -import { AclAdmin, AclSym, DataSym, Doc, Field, FieldResult, HeightSym, HierarchyMapping, NumListCast, Opt, StrListCast, WidthSym } from '../../fields/Doc'; +import { AclAdmin, AclSym, DataSym, Doc, DocListCast, Field, FieldResult, HeightSym, HierarchyMapping, NumListCast, Opt, StrListCast, WidthSym } from '../../fields/Doc'; import { Id } from '../../fields/FieldSymbols'; import { InkField } from '../../fields/InkField'; import { List } from '../../fields/List'; @@ -46,6 +46,7 @@ interface PropertiesViewProps { addDocTab: (doc: Doc, where: OpenWhere) => boolean; } + @observer export class PropertiesView extends React.Component { private _widthUndo?: UndoManager.Batch; @@ -244,11 +245,33 @@ export class PropertiesView extends React.Component { return !this.selectedDoc ? null : ; } + @computed get contextCount(){ + if (this.selectedDoc != undefined){ + const aliases = DocListCast(this.selectedDoc.aliases) + return aliases.length + } else{ + return 0; + } + } + @computed get links() { + console.log("this is selected doc" + this.selectedDoc) + // console.log("this is selected doc" + this.selectedDoc) const selAnchor = this.selectedDocumentView?.anchorViewDoc ?? LinkManager.currentLinkAnchor ?? this.selectedDoc; + console.log("this is selAnchor" + selAnchor) return !selAnchor ? null : ; } + @computed get linkCount(){ + const selAnchor = this.selectedDocumentView?.anchorViewDoc ?? LinkManager.currentLinkAnchor ?? this.selectedDoc; + if (selAnchor != undefined){ + const links = DocListCast(selAnchor.links) + return links.length + } else{ + return 0 + } + } + @computed get layoutPreview() { if (SelectionManager.Views().length > 1) { return '-- multiple selected --'; @@ -1118,21 +1141,23 @@ export class PropertiesView extends React.Component { - {this.openContexts ?
{this.contexts}
: null} + {!this.openContexts ? null : this.contextCount > 0 ?
{this.contexts}
:
There are no other contexts.
} ); } @computed get linksSubMenu() { + return (
+
(this.openLinks = !this.openLinks))} style={{ backgroundColor: this.openLinks ? 'black' : '' }}> Linked To
- {this.openLinks ?
{this.links}
: null} + {!this.openLinks ? null : this.linkCount > 0 ?
{this.links}
:
There are no current links.
}
); } -- cgit v1.2.3-70-g09d2