aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreperelm2 <emily_perelman@brown.edu>2023-06-06 17:03:25 -0400
committereperelm2 <emily_perelman@brown.edu>2023-06-06 17:03:25 -0400
commitc48b9015da3f68e83179fea9cb03cfe9fe7d1331 (patch)
tree6baadd301841e42413ae73b27c895681eb9c9d2f /src
parent3d30bdaf6dcf4972593f10b9b0f2fabd79c7062b (diff)
Context and link message is back
Diffstat (limited to 'src')
-rw-r--r--src/client/views/PropertiesView.tsx31
1 files changed, 28 insertions, 3 deletions
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<PropertiesViewProps> {
private _widthUndo?: UndoManager.Batch;
@@ -244,11 +245,33 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
return !this.selectedDoc ? null : <PropertiesDocContextSelector DocView={this.selectedDocumentView} hideTitle={true} addDocTab={this.props.addDocTab} />;
}
+ @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 : <PropertiesDocBacklinksSelector Document={selAnchor} hideTitle={true} addDocTab={this.props.addDocTab} />;
}
+ @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<PropertiesViewProps> {
<FontAwesomeIcon icon={this.openContexts ? 'caret-down' : 'caret-right'} size="lg" color="white" />
</div>
</div>
- {this.openContexts ? <div className="propertiesView-contexts-content">{this.contexts}</div> : null}
+ {!this.openContexts ? null : this.contextCount > 0 ? <div className="propertiesView-contexts-content">{this.contexts}</div> : <div className="propertiesView-contexts-content">There are no other contexts.</div>}
</div>
);
}
@computed get linksSubMenu() {
+
return (
<div className="propertiesView-contexts">
+
<div className="propertiesView-contexts-title" onPointerDown={action(() => (this.openLinks = !this.openLinks))} style={{ backgroundColor: this.openLinks ? 'black' : '' }}>
Linked To
<div className="propertiesView-contexts-title-icon">
<FontAwesomeIcon icon={this.openLinks ? 'caret-down' : 'caret-right'} size="lg" color="white" />
</div>
</div>
- {this.openLinks ? <div className="propertiesView-contexts-content">{this.links}</div> : null}
+ {!this.openLinks ? null : this.linkCount > 0 ? <div className="propertiesView-contexts-content">{this.links}</div> : <div className="propertiesView-contexts-content">There are no current links.</div>}
</div>
);
}