From 9bd44d6710ae0fb45a7a2d54e59bea9bdd05a3f7 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 28 Mar 2023 20:09:25 -0400 Subject: moved filter icon to style provider --- src/client/views/StyleProvider.scss | 21 ++++++++++++++++++- src/client/views/StyleProvider.tsx | 37 ++++++++++++++++++++++++++------- src/client/views/nodes/DocumentView.tsx | 12 ----------- 3 files changed, 49 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/client/views/StyleProvider.scss b/src/client/views/StyleProvider.scss index b1c97164a..b865c8ddd 100644 --- a/src/client/views/StyleProvider.scss +++ b/src/client/views/StyleProvider.scss @@ -3,7 +3,7 @@ width: 15; height: 15; position: absolute; - right: -0; + right: -15; top: 0; background: black; pointer-events: all; @@ -14,6 +14,25 @@ justify-content: center; cursor: default; } +.styleProvider-filter { + font-size: 10; + width: 15; + height: 15; + position: absolute; + right: 0; + top: 0; + background: black; + pointer-events: all; + opacity: 0.3; + display: flex; + color: gold; + border-radius: 3px; + justify-content: center; + cursor: default; +} +.styleProvider-filter:hover { + opacity: 1; +} .styleProvider-lock:hover { opacity: 1; } diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index bd0539069..def0eeef7 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -3,14 +3,14 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Shadows } from 'browndash-components'; import { action, runInAction } from 'mobx'; import { extname } from 'path'; -import { Doc, Opt } from '../../fields/Doc'; +import { Doc, Opt, StrListCast } from '../../fields/Doc'; import { BoolCast, Cast, ImageCast, NumCast, StrCast } from '../../fields/Types'; -import { DashColor, lightOrDark } from '../../Utils'; +import { DashColor, lightOrDark, Utils } from '../../Utils'; import { CollectionViewType, DocumentType } from '../documents/DocumentTypes'; import { DocFocusOrOpen } from '../util/DocumentManager'; import { LinkManager } from '../util/LinkManager'; import { SelectionManager } from '../util/SelectionManager'; -import { ColorScheme } from '../util/SettingsManager'; +import { ColorScheme, SettingsManager } from '../util/SettingsManager'; import { undoBatch, UndoManager } from '../util/UndoManager'; import { TreeSort } from './collections/TreeView'; import { Colors } from './global/globalEnums'; @@ -301,13 +301,34 @@ export function DefaultStyleProvider(doc: Opt, props: Opt toggleLockedPosition(doc)}> - + const lock = () => { + if (props?.ContainingCollectionDoc?._viewType === CollectionViewType.Freeform) { + return doc?.pointerEvents !== 'none' ? null : ( +
toggleLockedPosition(doc)}> + +
+ ); + } + }; + const filter = () => { + const showFilterIcon = + StrListCast(doc?._docFilters).length || StrListCast(doc?._docRangeFilters).length + ? '#18c718bd' //'hasFilter' + : docProps?.docFilters?.().filter(f => Utils.IsRecursiveFilter(f) && f !== Utils.noDragsDocFilter).length || docProps?.docRangeFilters().length + ? 'orange' //'inheritsFilter' + : undefined; + return !showFilterIcon ? null : ( +
(SettingsManager.propertiesWidth = 250))}> +
); - } + }; + return ( + <> + {lock()} + {filter()} + + ); } } diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index ab93ce87b..af32efe71 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1332,18 +1332,6 @@ export class DocumentViewInternal extends DocComponent )} - {this.showFilterIcon ? ( - { - this.props.select(false); - SettingsManager.propertiesWidth = 250; - e.stopPropagation(); - })} - /> - ) : null} ); } -- cgit v1.2.3-70-g09d2