From e7ebcd064a89c3f7c246bca680cea9634f87625b Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Mon, 21 Dec 2020 09:21:31 -0800 Subject: hardcoded lock/hide buttons --- src/client/views/collections/TreeView.scss | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/client/views/collections/TreeView.scss') diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss index 7a654c7cf..1cd7cf82a 100644 --- a/src/client/views/collections/TreeView.scss +++ b/src/client/views/collections/TreeView.scss @@ -98,7 +98,12 @@ width: unset; } - >svg { + >svg, .treeView-lock, .treeView-hide, .treeView-lock-active, .treeView-hide-active { + margin-left: 0.25rem; + margin-right: 0.25rem; + } + + >svg, .treeView-lock, .treeView-hide { display: none; } @@ -125,6 +130,10 @@ margin-left: 3px; } } + + .treeView-lock, .treeView-hide { + display: inherit; + } } .treeView-header-above { -- cgit v1.2.3-70-g09d2 From 57552e7b8640bbb6896e8d484aea9656b264e548 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Wed, 23 Dec 2020 13:20:51 -0800 Subject: move lock/hide buttons to StyleProvider --- src/client/views/MainView.tsx | 5 ++-- src/client/views/StyleProvider.tsx | 37 ++++++++++++++++++++++++++++++ src/client/views/collections/TreeView.scss | 6 ++--- src/client/views/collections/TreeView.tsx | 30 ++---------------------- 4 files changed, 45 insertions(+), 33 deletions(-) (limited to 'src/client/views/collections/TreeView.scss') diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 5eb8429f0..daa059a49 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -58,7 +58,7 @@ import { PDFMenu } from './pdf/PDFMenu'; import { PreviewCursor } from './PreviewCursor'; import { PropertiesView } from './PropertiesView'; import { SearchBox } from './search/SearchBox'; -import { DefaultStyleProvider } from './StyleProvider'; +import { DefaultStyleProvider, DashboardStyleProvider } from './StyleProvider'; const _global = (window /* browser */ || global /* node */) as any; @observer @@ -296,6 +296,7 @@ export class MainView extends React.Component { } @computed get flyout() { + console.log(this._sidebarContent.title); return !this._flyoutWidth ?
{this.docButtons}
: @@ -314,7 +315,7 @@ export class MainView extends React.Component { PanelHeight={this.getContentsHeight} renderDepth={0} focus={emptyFunction} - styleProvider={DefaultStyleProvider} + styleProvider={this._sidebarContent.title === "My Dashboards" ? DashboardStyleProvider : DefaultStyleProvider} parentActive={returnTrue} whenActiveChanged={emptyFunction} bringToFront={emptyFunction} diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index 312cfc73e..10cad5806 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -160,6 +160,43 @@ export function DefaultStyleProvider(doc: Opt, props: Opt : (null); } + } +} + +function toggleHidden(e: React.MouseEvent, doc: Doc) { + UndoManager.RunInBatch(() => runInAction(() => { + e.stopPropagation(); + doc.hidden = doc.hidden ? undefined : true; + }), "toggleHidden"); +} + +function toggleLock(e: React.MouseEvent, doc: Doc) { + UndoManager.RunInBatch(() => runInAction(() => { + e.stopPropagation(); + doc.lockedPosition = doc.lockedPosition ? undefined : true; + }), "toggleHidden"); +} + +/** + * add lock and hide button decorations for the "Dashboards" flyout TreeView + */ +export function DashboardStyleProvider(doc: Opt, props: Opt, property: string) { + switch (property.split(":")[0]) { + case StyleProp.Decorations: + if (doc) { + const hidden = doc.hidden; + const locked = doc.lockedPosition; + return doc._viewType == CollectionViewType.Docking || (Doc.IsSystem(doc) && Doc.UserDoc().noviceMode) ? (null) : + <> +
toggleHidden(e, doc)}> + +
+
toggleLock(e, doc)}> + +
+ + } + default: return DefaultStyleProvider(doc, props, property); } } diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss index 1cd7cf82a..45dec2661 100644 --- a/src/client/views/collections/TreeView.scss +++ b/src/client/views/collections/TreeView.scss @@ -98,12 +98,12 @@ width: unset; } - >svg, .treeView-lock, .treeView-hide, .treeView-lock-active, .treeView-hide-active { + >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide, .styleProvider-treeView-lock-active, .styleProvider-treeView-hide-active { margin-left: 0.25rem; margin-right: 0.25rem; } - >svg, .treeView-lock, .treeView-hide { + >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide { display: none; } @@ -131,7 +131,7 @@ } } - .treeView-lock, .treeView-hide { + .styleProvider-treeView-lock, .styleProvider-treeView-hide { display: inherit; } } diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx index bc0fd287b..8d25cc295 100644 --- a/src/client/views/collections/TreeView.tsx +++ b/src/client/views/collections/TreeView.tsx @@ -466,33 +466,6 @@ export class TreeView extends React.Component { } ; } - - @action - toggleHidden = (e: React.MouseEvent) => { - e.stopPropagation(); - this.doc.hidden = this.doc.hidden ? undefined : true; - } - - @action - toggleLock = (e: React.MouseEvent) => { - e.stopPropagation(); - this.doc.lockedPosition = this.doc.lockedPosition ? undefined : true; - } - - @computed get renderRightButtons() { - TraceMobx(); - const hidden = this.doc.hidden; - const locked = this.doc.lockedPosition; - return this.doc._viewType == CollectionViewType.Docking || (Doc.IsSystem(this.doc) && Doc.UserDoc().noviceMode) ? (null) : - <> -
- -
-
- -
- - } @computed get showTitleEditorControl() { return ["*", this._uniqueId, this.props.treeView._uniqueId].includes(Doc.GetT(this.doc, "editTitle", "string", true) || ""); } @computed get headerElements() { @@ -612,7 +585,8 @@ export class TreeView extends React.Component { }} > {view} - {this.renderRightButtons} + {/* hide and lock buttons */} + {this.props.styleProvider?.(this.doc, this.props.treeView.props, StyleProp.Decorations)} {this.headerElements} ; } -- cgit v1.2.3-70-g09d2 From 7aba0a9b1b1a3e7d72e24118ecbb05b98165d3b9 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Wed, 23 Dec 2020 14:39:29 -0800 Subject: UI styling changes --- src/client/views/MainView.scss | 1 - src/client/views/MainView.tsx | 5 ++--- src/client/views/collections/TreeView.scss | 27 +++++++++++++++------------ src/client/views/collections/TreeView.tsx | 7 ++++--- src/client/views/search/SearchBox.scss | 29 ++++++++--------------------- src/client/views/search/SearchBox.tsx | 2 +- 6 files changed, 30 insertions(+), 41 deletions(-) (limited to 'src/client/views/collections/TreeView.scss') diff --git a/src/client/views/MainView.scss b/src/client/views/MainView.scss index 33bd7e77e..d6a455a22 100644 --- a/src/client/views/MainView.scss +++ b/src/client/views/MainView.scss @@ -369,7 +369,6 @@ height: 55px; top: 50%; left: -10px; - border: 1px solid black; border-radius: 8px; position: relative; z-index: 41; // lm_maximised has a z-index of 40 and this needs to be above that diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index daa059a49..48cc6f36d 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -296,7 +296,6 @@ export class MainView extends React.Component { } @computed get flyout() { - console.log(this._sidebarContent.title); return !this._flyoutWidth ?
{this.docButtons}
: @@ -387,8 +386,8 @@ export class MainView extends React.Component { {this.menuPanel}
{this.flyout} - < div className="mainView-libraryHandle" style={{ display: !this._flyoutWidth ? "none" : undefined, }} onPointerDown={this.onFlyoutPointerDown} > - +
+
{this.dockingContent} diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss index 45dec2661..3c1e16f6c 100644 --- a/src/client/views/collections/TreeView.scss +++ b/src/client/views/collections/TreeView.scss @@ -98,15 +98,20 @@ width: unset; } - >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide, .styleProvider-treeView-lock-active, .styleProvider-treeView-hide-active { + .right-buttons-container { + display: flex; + align-items: center; margin-left: 0.25rem; - margin-right: 0.25rem; - } - >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide { - display: none; + >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide, .styleProvider-treeView-lock-active, .styleProvider-treeView-hide-active { + margin-left: 0.25rem; + margin-right: 0.25rem; + } + + >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide { + display: none; + } } - } .treeView-header:hover { @@ -114,10 +119,6 @@ display: inherit; } - >svg { - display: inherit; - } - .treeView-openRight { display: inline-block; height: 17px; @@ -131,8 +132,10 @@ } } - .styleProvider-treeView-lock, .styleProvider-treeView-hide { - display: inherit; + .right-buttons-container { + >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide { + display: inherit; + } } } diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx index 8d25cc295..bce0ba9e2 100644 --- a/src/client/views/collections/TreeView.tsx +++ b/src/client/views/collections/TreeView.tsx @@ -585,9 +585,10 @@ export class TreeView extends React.Component { }} > {view}
- {/* hide and lock buttons */} - {this.props.styleProvider?.(this.doc, this.props.treeView.props, StyleProp.Decorations)} - {this.headerElements} +
+ {this.props.styleProvider?.(this.doc, this.props.treeView.props, StyleProp.Decorations)} {/* hide and lock buttons */} + {this.headerElements} +
; } diff --git a/src/client/views/search/SearchBox.scss b/src/client/views/search/SearchBox.scss index 13d4a6d5a..76f9b66eb 100644 --- a/src/client/views/search/SearchBox.scss +++ b/src/client/views/search/SearchBox.scss @@ -30,42 +30,29 @@ .searchBox-lozenge-user, .searchBox-lozenge-dashboard, .searchBox-lozenge { - background-color: #313131; - border-radius: 5px; height: 18px; padding: 4px; - box-shadow: lightgrey 0.15em 0.15em 0.1em; - margin: 2px; - margin-bottom: 4px; - border-top: dimgrey 1px solid; - border-left: dimgrey 1px solid; + margin-right: 5px; display: flex; + align-items: center; + border: grey 1px solid; .searchBox-logoff, .searchBox-dashboards { border-radius: 3px; background: olivedrab; color: white; - position: relative; display: none; - margin-left: 3px; - padding-left: 2px; - padding-right: 2px; - padding-bottom: 11px; - cursor: default; + margin-left: 5px; + padding: 1px 2px 1px 2px; + cursor: pointer; } .searchBox-logoff { background: red; } .searchBox-dashSelect{ - background-color: black; - color: white; - font-size: 9; - margin-right: 6; - border-radius: 5px; - position: relative; - height: 15px; - transform: translate(0,-3px); + border: none; + background-color: transparent; &:hover { cursor: pointer; diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index d3fee85a7..d10afdcf9 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -466,7 +466,7 @@ export class SearchBox extends ViewBoxBaseComponent + return
-- cgit v1.2.3-70-g09d2 From f23ab533da30ebf10b927b8d3b40b86f047f9c20 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Wed, 23 Dec 2020 14:43:30 -0800 Subject: minor styling fix --- src/client/views/collections/TreeView.scss | 1 + 1 file changed, 1 insertion(+) (limited to 'src/client/views/collections/TreeView.scss') diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss index 3c1e16f6c..067675038 100644 --- a/src/client/views/collections/TreeView.scss +++ b/src/client/views/collections/TreeView.scss @@ -102,6 +102,7 @@ display: flex; align-items: center; margin-left: 0.25rem; + opacity: 0.75; >svg, .styleProvider-treeView-lock, .styleProvider-treeView-hide, .styleProvider-treeView-lock-active, .styleProvider-treeView-hide-active { margin-left: 0.25rem; -- cgit v1.2.3-70-g09d2