diff options
| author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-05-13 02:09:08 -0400 |
|---|---|---|
| committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-05-13 02:09:08 -0400 |
| commit | 2767d6b439dd9e90543f955c68e521e03c690af0 (patch) | |
| tree | 63a912270dc6dc9ba71db4aa4691d7f2839f3b70 /src/client/views/collections | |
| parent | f52f5a408c62b93ae79eb690ff86538a6fbf60ed (diff) | |
Added "find aliases" and "see collections that contain me"
Diffstat (limited to 'src/client/views/collections')
| -rw-r--r-- | src/client/views/collections/ParentDocumentSelector.tsx | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/client/views/collections/ParentDocumentSelector.tsx b/src/client/views/collections/ParentDocumentSelector.tsx index 1fdb9d4d9..dd1516da7 100644 --- a/src/client/views/collections/ParentDocumentSelector.tsx +++ b/src/client/views/collections/ParentDocumentSelector.tsx @@ -2,7 +2,34 @@ import * as React from "react"; import './ParentDocumentSelector.scss'; import { Doc } from "../../../new_fields/Doc"; import { observer } from "mobx-react"; -import { observable, action } from "mobx"; +import { observable, action, runInAction } from "mobx"; +import { Id } from "../../../new_fields/RefField"; +import { SearchUtil } from "../../util/SearchUtil"; +import { CollectionDockingView } from "./CollectionDockingView"; + +@observer +export class SelectorContextMenu extends React.Component<{ Document: Doc }> { + @observable private _docs: Doc[] = []; + + constructor(props: { Document: Doc }) { + super(props); + + this.fetchDocuments(); + } + + async fetchDocuments() { + const docs = await SearchUtil.Search(`data_l:${this.props.Document[Id]}`, true); + runInAction(() => this._docs = docs); + } + + render() { + return ( + <> + {this._docs.map(doc => <p><a onClick={() => CollectionDockingView.Instance.AddRightSplit(doc)}>{doc.title}</a></p>)} + </> + ); + } +} @observer export class ParentDocSelector extends React.Component<{ Document: Doc }> { @@ -23,7 +50,7 @@ export class ParentDocSelector extends React.Component<{ Document: Doc }> { if (this.hover) { flyout = ( <div className="PDS-flyout"> - <p>Hello world</p> + <SelectorContextMenu Document={this.props.Document} /> </div> ); } |
