From ed74b8b6d6c65a24803c4e0e68aa192a750d60fa Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Fri, 3 Jul 2020 18:47:48 -0500 Subject: restructure --- src/client/documents/Documents.ts | 5 ---- src/client/views/MainView.tsx | 27 ++--------------- .../views/collections/CollectionLinearView.scss | 34 ++++++++++++++++++---- .../views/collections/CollectionLinearView.tsx | 32 ++++---------------- src/client/views/linking/LinkMenuItem.scss | 34 ++++++++++++---------- src/client/views/nodes/DocumentLinksButton.tsx | 24 +++++++++------ src/client/views/nodes/DocumentView.tsx | 22 ++++++++------ src/client/views/nodes/LinkCreatedBox.scss | 21 +++++++++++++ src/client/views/nodes/LinkCreatedBox.tsx | 31 ++++++++++++++++++++ 9 files changed, 134 insertions(+), 96 deletions(-) create mode 100644 src/client/views/nodes/LinkCreatedBox.scss create mode 100644 src/client/views/nodes/LinkCreatedBox.tsx (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 0f434d616..f81c25bab 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -50,7 +50,6 @@ import { DashWebRTCVideo } from "../views/webcam/DashWebRTCVideo"; import { DocumentType } from "./DocumentTypes"; import { Networking } from "../Network"; import { Upload } from "../../server/SharedMediaTypes"; -import { MainView } from "../views/MainView"; const path = require('path'); export interface DocumentOptions { @@ -868,10 +867,6 @@ export namespace DocUtils { DocUtils.ActiveRecordings.map(d => DocUtils.MakeLink({ doc: doc }, { doc: d }, "audio link", "audio timeline")); } - function stopLinkCreated() { - MainView.linkCreated = false; - } - export function MakeLink(source: { doc: Doc }, target: { doc: Doc }, linkRelationship: string = "", id?: string) { const sv = DocumentManager.Instance.getDocumentView(source.doc); if (sv && sv.props.ContainingCollectionDoc === target.doc) return; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 3d47d09c8..15f818d1f 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -60,6 +60,7 @@ import { DocumentLinksButton } from './nodes/DocumentLinksButton'; import { LinkMenu } from './linking/LinkMenu'; import { LinkDocPreview } from './nodes/LinkDocPreview'; import { Fade } from '@material-ui/core'; +import { LinkCreatedBox } from './nodes/LinkCreatedBox'; @observer export class MainView extends React.Component { @@ -83,11 +84,6 @@ export class MainView extends React.Component { public isPointerDown = false; - @observable public static linkCreated: boolean = false; - @observable public static popupX: number = 600; - @observable public static popupY: number = 250; - - componentDidMount() { DocServer.setPlaygroundFields(["dataTransition", "_viewTransition", "_panX", "_panY", "_viewScale", "_viewType"]); // can play with these fields on someone else's @@ -367,11 +363,6 @@ export class MainView extends React.Component { } } - @action - public static changeLinkCreated = () => { - MainView.linkCreated = !MainView.linkCreated; - } - @action onPointerMove = (e: PointerEvent) => { this.flyoutWidth = Math.max(e.clientX, 0); @@ -616,21 +607,7 @@ export class MainView extends React.Component { {this.mainContent} - - -
Link Created
-
- + {DocumentLinksButton.EditLink ? : (null)} {LinkDocPreview.LinkInfo ? span { - //margin-top: 8px; - //margin-left: 4px; - //margin-bottom: 2px; background: $dark-color; color: $light-color; - //display: inline-block; border-radius: 18px; margin-right: 6px; - //height: 100%; cursor: pointer; } + .bottomPopup-background { + padding-right: 14px; + height: 35; + transform: translate3d(6px, 5px, 0px); + padding-top: 6.5px; + padding-bottom: 7px; + padding-left: 5px; + } + + .bottomPopup-text { + display: inline; + white-space: nowrap; + padding-left: 8px; + padding-right: 4px; + vertical-align: middle; + font-size: 12.5px; + } + + .bottomPopup-exit { + display: inline; + white-space: nowrap; + padding-left: 8px; + padding-right: 8px; + vertical-align: middle; + background-color: lightgrey; + border-radius: 5.5px; + color: black; + } + >label { margin-top: "auto"; margin-bottom: "auto"; diff --git a/src/client/views/collections/CollectionLinearView.tsx b/src/client/views/collections/CollectionLinearView.tsx index 7635dac24..7cbe5c19d 100644 --- a/src/client/views/collections/CollectionLinearView.tsx +++ b/src/client/views/collections/CollectionLinearView.tsx @@ -149,36 +149,14 @@ export class CollectionLinearView extends CollectionSubView(LinearDocument) { ; })} - {DocumentLinksButton.StartLink ? e.stopPropagation()} > - + Creating link from: {DocumentLinksButton.StartLink.title} - Exit + Exit {/* */} diff --git a/src/client/views/linking/LinkMenuItem.scss b/src/client/views/linking/LinkMenuItem.scss index c5becae7d..e3ce69cd7 100644 --- a/src/client/views/linking/LinkMenuItem.scss +++ b/src/client/views/linking/LinkMenuItem.scss @@ -31,21 +31,23 @@ font-size: 10.5px; } - // &:hover { - // .linkMenu-item-buttons { - // display: flex; - // } - // .linkMenu-item-content { - // &.expand-two p { - // width: calc(100% - 52px); - // background-color: lightgray; - // } - // &.expand-three p { - // width: calc(100% - 84px); - // background-color: lightgray; - // } - // } - // } + &:hover { + .linkMenu-item-buttons { + display: flex; + } + + .linkMenu-item-content { + &.expand-two p { + width: calc(100% - 52px); + background-color: lightgray; + } + + &.expand-three p { + width: calc(100% - 84px); + background-color: lightgray; + } + } + } } .linkMenu-item-buttons { @@ -53,7 +55,7 @@ top: 50%; right: 0; transform: translateY(-50%); - display: flex; + display: none; .button { width: 20px; diff --git a/src/client/views/nodes/DocumentLinksButton.tsx b/src/client/views/nodes/DocumentLinksButton.tsx index 6a6624aa0..bfd860f65 100644 --- a/src/client/views/nodes/DocumentLinksButton.tsx +++ b/src/client/views/nodes/DocumentLinksButton.tsx @@ -10,7 +10,7 @@ import React = require("react"); import { DocUtils } from "../../documents/Documents"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { LinkDocPreview } from "./LinkDocPreview"; -import { MainView } from "../MainView"; +import { LinkCreatedBox } from "./LinkCreatedBox"; const higflyout = require("@hig/flyout"); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -89,10 +89,13 @@ export class DocumentLinksButton extends React.Component { MainView.linkCreated = true; }); - runInAction(() => { setTimeout(function () { runInAction(() => MainView.linkCreated = false); }, 2500); }); - MainView.popupX = e.screenX; - MainView.popupY = e.screenY; + + runInAction(() => { + LinkCreatedBox.popupX = e.screenX; + LinkCreatedBox.popupY = e.screenY - 120; + LinkCreatedBox.linkCreated = true; + setTimeout(action(() => { LinkCreatedBox.linkCreated = false; }), 2500); + }); } } })); @@ -108,10 +111,13 @@ export class DocumentLinksButton extends React.Component { MainView.linkCreated = true; }); - runInAction(() => { setTimeout(function () { runInAction(() => MainView.linkCreated = false); }, 2000); }); - MainView.popupX = e.screenX - 25; - MainView.popupY = e.screenY - 140; + + runInAction(() => { + LinkCreatedBox.popupX = e.screenX; + LinkCreatedBox.popupY = e.screenY - 120; + LinkCreatedBox.linkCreated = true; + setTimeout(action(() => { LinkCreatedBox.linkCreated = false; }), 2500); + }); } } diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 3a9e4fcf0..b38db9a1e 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -42,7 +42,7 @@ import { RadialMenu } from './RadialMenu'; import React = require("react"); import { DocumentLinksButton } from './DocumentLinksButton'; import { MobileInterface } from '../../../mobile/MobileInterface'; -import { MainView } from '../MainView'; +import { LinkCreatedBox } from './LinkCreatedBox'; library.add(fa.faEdit, fa.faTrash, fa.faShare, fa.faDownload, fa.faExpandArrowsAlt, fa.faCompressArrowsAlt, fa.faLayerGroup, fa.faExternalLinkAlt, fa.faAlignCenter, fa.faCaretSquareRight, fa.faSquare, fa.faConciergeBell, fa.faWindowRestore, fa.faFolder, fa.faMapPin, fa.faLink, fa.faFingerprint, fa.faCrosshairs, fa.faDesktop, fa.faUnlock, fa.faLock, fa.faLaptopCode, fa.faMale, @@ -642,10 +642,12 @@ export class DocumentView extends DocComponent(Docu e.stopPropagation(); de.complete.annoDragData.linkedToDoc = true; - runInAction(() => MainView.popupX = de.x); - runInAction(() => MainView.popupY = de.y); - runInAction(() => { MainView.linkCreated = true; }); - runInAction(() => { setTimeout(function () { runInAction(() => MainView.linkCreated = false); }, 2500); }); + runInAction(() => { + LinkCreatedBox.popupX = de.x; + LinkCreatedBox.popupY = de.y; + LinkCreatedBox.linkCreated = true; + setTimeout(action(() => { LinkCreatedBox.linkCreated = false; }), 2500); + }); DocUtils.MakeLink({ doc: de.complete.annoDragData.annotationDocument }, { doc: this.props.Document }, "link"); } @@ -653,11 +655,13 @@ export class DocumentView extends DocComponent(Docu e.stopPropagation(); // const docs = await SearchUtil.Search(`data_l:"${destDoc[Id]}"`, true); // const views = docs.map(d => DocumentManager.Instance.getDocumentView(d)).filter(d => d).map(d => d as DocumentView); - runInAction(() => MainView.popupX = de.x); - runInAction(() => MainView.popupY = de.y); - runInAction(() => { MainView.linkCreated = true; }); - runInAction(() => { setTimeout(function () { runInAction(() => MainView.linkCreated = false); }, 2000); }); + runInAction(() => { + LinkCreatedBox.popupX = de.x; + LinkCreatedBox.popupY = de.y; + LinkCreatedBox.linkCreated = true; + setTimeout(action(() => { LinkCreatedBox.linkCreated = false; }), 2500); + }); de.complete.linkDragData.linkSourceDocument !== this.props.Document && (de.complete.linkDragData.linkDocument = DocUtils.MakeLink({ doc: de.complete.linkDragData.linkSourceDocument }, diff --git a/src/client/views/nodes/LinkCreatedBox.scss b/src/client/views/nodes/LinkCreatedBox.scss new file mode 100644 index 000000000..3cbd38b55 --- /dev/null +++ b/src/client/views/nodes/LinkCreatedBox.scss @@ -0,0 +1,21 @@ +.linkCreatedBox-fade { + border: 1px solid rgb(100, 100, 100); + + + width: auto; + position: absolute; + + height: auto; + z-index: 10000; + border-radius: 13px; + font-size: 13px; + white-space: nowrap; + + color: rgb(100, 100, 100); + background-color: rgba(250, 250, 250, 0.85); + padding-top: 6.5px; + padding-bottom: 6.5px; + font-weight: bold; + padding-left: 9px; + padding-right: 9px; +} \ No newline at end of file diff --git a/src/client/views/nodes/LinkCreatedBox.tsx b/src/client/views/nodes/LinkCreatedBox.tsx new file mode 100644 index 000000000..d157d3fca --- /dev/null +++ b/src/client/views/nodes/LinkCreatedBox.tsx @@ -0,0 +1,31 @@ +import React = require("react"); +import { observer } from "mobx-react"; +import { documentSchema } from "../../../fields/documentSchemas"; +import { makeInterface } from "../../../fields/Schema"; +import "./LinkCreatedBox.scss"; +import { observable, action } from "mobx"; +import { Fade } from "@material-ui/core"; + + +@observer +export class LinkCreatedBox extends React.Component<{}> { + + @observable public static linkCreated: boolean = false; + @observable public static popupX: number = 600; + @observable public static popupY: number = 250; + + @action + public static changeLinkCreated = () => { + LinkCreatedBox.linkCreated = !LinkCreatedBox.linkCreated; + } + + render() { + return +
Link Created
+
; + } +} \ No newline at end of file -- cgit v1.2.3-70-g09d2