From 6de58d7ecbfd14beb7389c6ff56e764b5c00ba25 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 30 Apr 2024 01:10:20 -0400 Subject: changed acl- and some other field- to acl_ and field_ style --- src/client/views/DashboardView.tsx | 2 +- src/client/views/FilterPanel.tsx | 2 +- src/client/views/PropertiesView.tsx | 16 ++++++++-------- src/client/views/collections/CollectionCarouselView.tsx | 2 +- src/client/views/collections/CollectionMenu.tsx | 12 ++++++------ src/client/views/collections/CollectionView.tsx | 4 ++-- .../collectionFreeForm/CollectionFreeFormView.tsx | 2 +- src/client/views/linking/LinkMenuItem.tsx | 3 +-- .../views/nodes/CollectionFreeFormDocumentView.tsx | 4 ++-- src/client/views/nodes/ImageBox.tsx | 5 ++--- src/client/views/nodes/KeyValuePair.tsx | 2 +- src/client/views/nodes/trails/PresBox.tsx | 2 +- 12 files changed, 27 insertions(+), 29 deletions(-) (limited to 'src/client/views') diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx index 25415a4f0..c4855d2e7 100644 --- a/src/client/views/DashboardView.tsx +++ b/src/client/views/DashboardView.tsx @@ -165,7 +165,7 @@ export class DashboardView extends ObservableReactComponent<{}> { : this.getDashboards(this.selectedDashboardGroup).map(dashboard => { const href = ImageCast(dashboard.thumb)?.url?.href; const shared = Object.keys(dashboard[DocAcl]) - .filter(key => key !== `acl-${normalizeEmail(ClientUtils.CurrentUserEmail())}` && !['acl-Me', 'acl-Guest'].includes(key)) + .filter(key => key !== `acl_${normalizeEmail(ClientUtils.CurrentUserEmail())}` && !['acl_Me', 'acl_Guest'].includes(key)) .some(key => dashboard[DocAcl][key] !== AclPrivate); return (
{
- +
{/* THE FOLLOWING CODE SHOULD BE DEVELOPER FOR BOOLEAN EXPRESSION (AND / OR) */} {/*
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index 5e1c80f0c..f4ded8367 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -231,7 +231,7 @@ export class PropertiesView extends ObservableReactComponent key.indexOf('modificationDate') !== -1 || (key[0] === key[0].toUpperCase() && !key.startsWith('acl')), noviceReqFields); + return this.editableFields(key => key.indexOf('modificationDate') !== -1 || (key[0] === key[0].toUpperCase() && !key.startsWith('acl_')), noviceReqFields); } @undoBatch @@ -473,7 +473,7 @@ export class PropertiesView extends ObservableReactComponent { let userOnDoc = true; if (seldoc) { - if (Doc.GetT(seldoc, 'acl-' + normalizeEmail(eachUser.user.email), 'string', true) === '' || Doc.GetT(seldoc, 'acl-' + normalizeEmail(eachUser.user.email), 'string', true) === undefined) { + if (Doc.GetT(seldoc, 'acl_' + normalizeEmail(eachUser.user.email), 'string', true) === '' || Doc.GetT(seldoc, 'acl_' + normalizeEmail(eachUser.user.email), 'string', true) === undefined) { userOnDoc = false; } } @@ -485,7 +485,7 @@ export class PropertiesView extends ObservableReactComponent { - const userKey = `acl-${normalizeEmail(userEmail)}`; + const userKey = `acl_${normalizeEmail(userEmail)}`; const aclField = Doc.GetT(this.layoutDocAcls ? target : Doc.GetProto(target), userKey, 'string', true); const permission = StrCast(aclField); individualTableEntries.unshift(this.sharingItem(userEmail, showAdmin, permission!, false)); // adds each user @@ -494,7 +494,7 @@ export class PropertiesView extends ObservableReactComponent { if (group.title !== 'Guest' && this.selectedDoc) { - const groupKey = 'acl-' + normalizeEmail(StrCast(group.title)); + const groupKey = 'acl_' + normalizeEmail(StrCast(group.title)); if (this.selectedDoc[groupKey] !== '' && this.selectedDoc[groupKey] !== undefined) { let permission; if (this.layoutDocAcls) { @@ -529,7 +529,7 @@ export class PropertiesView extends ObservableReactComponent @@ -1733,8 +1733,8 @@ export class PropertiesView extends ObservableReactComponent 0; - const type = [DocumentType.AUDIO, DocumentType.VID].includes(DocCast(PresBox.Instance.activeItem?.annotationOn)?.type as any as DocumentType) - ? (DocCast(PresBox.Instance.activeItem?.annotationOn)?.type as any as DocumentType) + const type = [DocumentType.AUDIO, DocumentType.VID].find(dt => dt === DocCast(PresBox.Instance.activeItem?.annotationOn)?.type) + ? DocCast(PresBox.Instance.activeItem?.annotationOn)?.type : PresBox.targetRenderedDoc(PresBox.Instance.activeItem)?.type; return (
diff --git a/src/client/views/collections/CollectionCarouselView.tsx b/src/client/views/collections/CollectionCarouselView.tsx index 51352d3e2..fda320077 100644 --- a/src/client/views/collections/CollectionCarouselView.tsx +++ b/src/client/views/collections/CollectionCarouselView.tsx @@ -52,7 +52,7 @@ export class CollectionCarouselView extends CollectionSubView() { }; captionStyleProvider = (doc: Doc | undefined, captionProps: Opt, property: string): any => { // first look for properties on the document in the carousel, then fallback to properties on the container - const childValue = doc?.['caption-' + property] ? this._props.styleProvider?.(doc, captionProps, property) : undefined; + const childValue = doc?.['caption_' + property] ? this._props.styleProvider?.(doc, captionProps, property) : undefined; return childValue ?? this._props.styleProvider?.(this.layoutDoc, captionProps, property); }; panelHeight = () => this._props.PanelHeight() - (StrCast(this.layoutDoc._layout_showCaption) ? 50 : 0); diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx index 6dba9e155..f945a7aa4 100644 --- a/src/client/views/collections/CollectionMenu.tsx +++ b/src/client/views/collections/CollectionMenu.tsx @@ -53,7 +53,7 @@ export class CollectionMenu extends AntimodeMenu { makeObservable(this); CollectionMenu.Instance = this; this._canFade = false; // don't let the inking menu fade away - this.Pinned = Cast(Doc.UserDoc()['menuCollections-pinned'], 'boolean', true); + this.Pinned = Cast(Doc.UserDoc().menuCollections_pinned, 'boolean', true); this.jumpTo(300, 300); } @@ -71,7 +71,7 @@ export class CollectionMenu extends AntimodeMenu { @action toggleMenuPin = () => { - Doc.UserDoc()['menuCollections-pinned'] = this.Pinned = !this.Pinned; + Doc.UserDoc().menuCollections_pinned = this.Pinned = !this.Pinned; if (!this.Pinned && this._left < 0) { this.jumpTo(300, 300); } @@ -280,8 +280,8 @@ export class CollectionViewBaseChrome extends React.Component { this.target._childFilters = undefined; this.target._searchFilterDocs = undefined; @@ -289,8 +289,8 @@ export class CollectionViewBaseChrome extends React.Component { const activeDash = Doc.ActiveDashboard; if (activeDash) { - button['target-childFilters'] = (Doc.MySearcher._childFilters || activeDash._childFilters) instanceof ObjectField ? ObjectField.MakeCopy((Doc.MySearcher._childFilters || activeDash._childFilters) as any as ObjectField) : undefined; - button['target-searchFilterDocs'] = activeDash._searchFilterDocs instanceof ObjectField ? ObjectField.MakeCopy(activeDash._searchFilterDocs as any as ObjectField) : undefined; + button.target_childFilters = (Doc.MySearcher._childFilters || activeDash._childFilters) instanceof ObjectField ? ObjectField.MakeCopy((Doc.MySearcher._childFilters || activeDash._childFilters) as any as ObjectField) : undefined; + button.target_searchFilterDocs = activeDash._searchFilterDocs instanceof ObjectField ? ObjectField.MakeCopy(activeDash._searchFilterDocs as any as ObjectField) : undefined; } }, }; diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx index a0d84ab28..d6cbe0dab 100644 --- a/src/client/views/collections/CollectionView.tsx +++ b/src/client/views/collections/CollectionView.tsx @@ -70,7 +70,7 @@ export class CollectionView extends ViewBoxAnnotatableComponent (this._props.renderDepth ? this.ScreenToLocalBoxXf() : this.ScreenToLocalBoxXf().scale(this._props.PanelWidth() / this.bodyPanelWidth())); diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 986c1e357..c1a889539 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1664,7 +1664,7 @@ export class CollectionFreeFormView extends CollectionSubView { @observable _hover = false; docView = () => this._props.docView; render() { - const destinationIcon = Doc.toIcon(this._props.destinationDoc) as any as IconProp; + const destinationIcon = Doc.toIcon(this._props.destinationDoc); const title = StrCast(this._props.destinationDoc.title).length > 18 ? StrCast(this._props.destinationDoc.title).substr(0, 14) + '...' : this._props.destinationDoc.title; diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx index 6a86af6a7..7b1847ae4 100644 --- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx +++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx @@ -160,7 +160,7 @@ export class CollectionFreeFormDocumentView extends DocComponent { const findexed = Cast(d[`${val}_indexed`], listSpec('string'), []).slice(); - findexed[timecode] = vals[val] as any as string; + findexed[timecode] = vals[val] || ''; d[`${val}_indexed`] = new List(findexed); }); } @@ -169,7 +169,7 @@ export class CollectionFreeFormDocumentView extends DocComponent { const findexed = Cast(d[`${val}_indexed`], listSpec('number'), []).slice(); - findexed[timecode] = vals[val] as any as number; + findexed[timecode] = vals[val] || 0; d[`${val}_indexed`] = new List(findexed); }); } diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index db28d0a48..6d3d4be06 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -6,11 +6,10 @@ import { observer } from 'mobx-react'; import { extname } from 'path'; import * as React from 'react'; import { ClientUtils, DashColor, returnEmptyString, returnFalse, returnOne, returnZero, setupMoveUpEvents } from '../../../ClientUtils'; -import { Doc, Opt } from '../../../fields/Doc'; +import { Doc, DocListCast, Opt } from '../../../fields/Doc'; import { DocData } from '../../../fields/DocSymbols'; import { Id } from '../../../fields/FieldSymbols'; import { InkTool } from '../../../fields/InkField'; -import { List } from '../../../fields/List'; import { ObjectField } from '../../../fields/ObjectField'; import { Cast, ImageCast, NumCast, StrCast } from '../../../fields/Types'; import { ImageField } from '../../../fields/URLField'; @@ -341,7 +340,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() impl @computed get paths() { const field = Cast(this.dataDoc[this.fieldKey], ImageField, null); // retrieve the primary image URL that is being rendered from the data doc - const alts = this.dataDoc[this.fieldKey + '_alternates'] as any as List; // retrieve alternate documents that may be rendered as alternate images + const alts = DocListCast(this.dataDoc[this.fieldKey + '_alternates']); // retrieve alternate documents that may be rendered as alternate images const defaultUrl = new URL(ClientUtils.prepend('/assets/unknown-file-icon-hi.png')); const altpaths = alts diff --git a/src/client/views/nodes/KeyValuePair.tsx b/src/client/views/nodes/KeyValuePair.tsx index f96dd2b76..a9aa017a1 100644 --- a/src/client/views/nodes/KeyValuePair.tsx +++ b/src/client/views/nodes/KeyValuePair.tsx @@ -101,7 +101,7 @@ export class KeyValuePair extends ObservableReactComponent { pair[0].replace(/^_/, '') === this._props.keyName)?.[1].description ?? ''}> -
+
{'('.repeat(parenCount)} {this._props.keyName} {')'.repeat(parenCount)} diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx index ed9635bdd..4fe7ec993 100644 --- a/src/client/views/nodes/trails/PresBox.tsx +++ b/src/client/views/nodes/trails/PresBox.tsx @@ -1607,7 +1607,7 @@ export class PresBox extends ViewBoxBaseComponent() {
- {[DocumentType.AUDIO, DocumentType.VID].includes(targetType as any as DocumentType) ? null : ( + {[DocumentType.AUDIO, DocumentType.VID].find(dt => dt === targetType) ? null : ( <>
Slide Duration
-- cgit v1.2.3-70-g09d2