aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-09-19 16:38:37 -0400
committerbob <bcz@cs.brown.edu>2019-09-19 16:38:37 -0400
commit13e3611f87a941fe29ff0256890cdf3c74351bab (patch)
tree3585253140731387551ba4a2cfa0e00e8755c482 /src/client/views/collections
parente95a771cb0bcc3add66ebd28344d6a303e7b2bca (diff)
fixes to button bar
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx18
-rw-r--r--src/client/views/collections/ParentDocumentSelector.scss11
-rw-r--r--src/client/views/collections/ParentDocumentSelector.tsx46
3 files changed, 66 insertions, 9 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 277fa0066..5ace1048d 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -28,8 +28,8 @@ import { MainView } from '../MainView';
import { DocumentView } from "../nodes/DocumentView";
import "./CollectionDockingView.scss";
import { SubCollectionViewProps } from "./CollectionSubView";
-import { ParentDocSelector } from './ParentDocumentSelector';
import React = require("react");
+import { ButtonSelector } from './ParentDocumentSelector';
library.add(faFile);
@observer
@@ -401,6 +401,10 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
dragSpan.style.bottom = "6px";
dragSpan.style.paddingLeft = "4px";
dragSpan.style.paddingRight = "2px";
+ let gearSpan = document.createElement("span");
+ gearSpan.style.position = "relative";
+ gearSpan.style.paddingLeft = "0px";
+ gearSpan.style.paddingRight = "12px";
let upDiv = document.createElement("span");
const stack = tab.contentItem.parent;
// shifts the focus to this tab when another tab is dragged over it
@@ -421,12 +425,14 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
hideSource: false
});
}}><FontAwesomeIcon icon="file" size="lg" /></span>, dragSpan);
- ReactDOM.render(<ParentDocSelector Document={doc} addDocTab={(doc, data, where) => {
- where === "onRight" ? CollectionDockingView.AddRightSplit(doc, dataDoc) : CollectionDockingView.Instance.AddTab(stack, doc, dataDoc);
- return true;
- }} />, upDiv);
- tab.reactComponents = [dragSpan, upDiv];
+ ReactDOM.render(<ButtonSelector Document={doc} Stack={stack} />, gearSpan);
+ // ReactDOM.render(<ParentDocSelector Document={doc} addDocTab={(doc, data, where) => {
+ // where === "onRight" ? CollectionDockingView.AddRightSplit(doc, dataDoc) : CollectionDockingView.Instance.AddTab(stack, doc, dataDoc);
+ // return true;
+ // }} />, upDiv);
+ tab.reactComponents = [dragSpan, gearSpan, upDiv];
tab.element.append(dragSpan);
+ tab.element.append(gearSpan);
tab.element.append(upDiv);
tab.reactionDisposer = reaction(() => [doc.title, Doc.IsBrushedDegree(doc)], () => {
tab.titleElement[0].textContent = doc.title, { fireImmediately: true };
diff --git a/src/client/views/collections/ParentDocumentSelector.scss b/src/client/views/collections/ParentDocumentSelector.scss
index 2dd3e49f2..6f71bcc79 100644
--- a/src/client/views/collections/ParentDocumentSelector.scss
+++ b/src/client/views/collections/ParentDocumentSelector.scss
@@ -1,5 +1,5 @@
.PDS-flyout {
- position: absolute;
+ position: relative;
z-index: 9999;
background-color: #eeeeee;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
@@ -19,4 +19,13 @@
border-right: 0px;
border-left: 0px;
}
+}
+.parentDocumentSelector-button {
+ pointer-events: all;
+}
+.buttonSelector {
+ position: absolute;
+ display: inline-block;
+ padding-left: 5px;
+ padding-right: 5px;
} \ No newline at end of file
diff --git a/src/client/views/collections/ParentDocumentSelector.tsx b/src/client/views/collections/ParentDocumentSelector.tsx
index d8475a467..7f2913214 100644
--- a/src/client/views/collections/ParentDocumentSelector.tsx
+++ b/src/client/views/collections/ParentDocumentSelector.tsx
@@ -8,8 +8,15 @@ import { SearchUtil } from "../../util/SearchUtil";
import { CollectionDockingView } from "./CollectionDockingView";
import { NumCast } from "../../../new_fields/Types";
import { CollectionViewType } from "./CollectionBaseView";
+import { DocumentButtonBar } from "../DocumentButtonBar";
+import { DocumentManager } from "../../util/DocumentManager";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faEdit } from "@fortawesome/free-solid-svg-icons";
+import { library } from "@fortawesome/fontawesome-svg-core";
-type SelectorProps = { Document: Doc, addDocTab(doc: Doc, dataDoc: Doc | undefined, location: string): void };
+library.add(faEdit);
+
+type SelectorProps = { Document: Doc, Stack?: any, addDocTab(doc: Doc, dataDoc: Doc | undefined, location: string): void };
@observer
export class SelectorContextMenu extends React.Component<SelectorProps> {
@observable private _docs: { col: Doc, target: Doc }[] = [];
@@ -83,7 +90,7 @@ export class ParentDocSelector extends React.Component<SelectorProps> {
);
}
return (
- <span style={{ position: "relative", display: "inline-block", paddingLeft: "5px", paddingRight: "5px" }}
+ <span className="parentDocumentSelector-button" style={{ position: "relative", display: "inline-block", paddingLeft: "5px", paddingRight: "5px" }}
onMouseEnter={this.onMouseEnter}
onMouseLeave={this.onMouseLeave}>
<p>^</p>
@@ -92,3 +99,38 @@ export class ParentDocSelector extends React.Component<SelectorProps> {
);
}
}
+
+@observer
+export class ButtonSelector extends React.Component<{ Document: Doc, Stack: any }> {
+ @observable hover = false;
+
+ @action
+ onMouseLeave = () => {
+ this.hover = false;
+ }
+
+ @action
+ onMouseEnter = () => {
+ this.hover = true;
+ }
+
+ render() {
+ let flyout;
+ if (this.hover) {
+ let view = DocumentManager.Instance.getDocumentView(this.props.Document);
+ flyout = !view ? (null) : (
+ <div className="PDS-flyout" title=" " onMouseLeave={this.onMouseLeave}>
+ <DocumentButtonBar views={[view]} stack={this.props.Stack} />
+ </div>
+ );
+ }
+ return (
+ <span className="buttonSelector"
+ onMouseEnter={this.onMouseEnter}
+ onMouseLeave={this.onMouseLeave}>
+ {this.hover ? (null) : <FontAwesomeIcon icon={faEdit} size={"sm"} />}
+ {flyout}
+ </span>
+ );
+ }
+}