From 74e72adabd59fc58107fd73590f1e7e9cbaf4bde Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 11 Sep 2023 23:19:59 -0400 Subject: clean up some runtime warnings about missing keys/values --- src/client/views/MainViewModal.tsx | 3 ++- src/client/views/collections/TreeView.tsx | 6 +++--- src/client/views/nodes/KeyValuePair.tsx | 2 +- src/client/views/search/SearchBox.tsx | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/views/MainViewModal.tsx b/src/client/views/MainViewModal.tsx index d0a79eb70..67b722e7a 100644 --- a/src/client/views/MainViewModal.tsx +++ b/src/client/views/MainViewModal.tsx @@ -3,6 +3,7 @@ import { observer } from 'mobx-react'; import * as React from 'react'; import { Doc } from '../../fields/Doc'; import { StrCast } from '../../fields/Types'; +import { SettingsManager } from '../util/SettingsManager'; import './MainViewModal.scss'; export interface MainViewOverlayProps { @@ -44,7 +45,7 @@ export class MainViewModal extends React.Component { className="overlay" onClick={this.props?.closeOnExternalClick} style={{ - backgroundColor: isDark(StrCast(Doc.UserDoc().userColor)) ? '#DFDFDF30' : '#32323230', + backgroundColor: isDark(SettingsManager.userColor) ? '#DFDFDF30' : '#32323230', ...(p.overlayStyle || {}), }} /> diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx index 71e9f4dfa..832e102bc 100644 --- a/src/client/views/collections/TreeView.tsx +++ b/src/client/views/collections/TreeView.tsx @@ -1015,8 +1015,8 @@ export class TreeView extends React.Component { ref={this._tref} title="click to edit title. Double Click or Drag to Open" style={{ - backgroundColor: Doc.IsSystem(this.props.document) || this.props.document.isFolder ? StrCast(Doc.UserDoc().userVariantColor) : undefined, - color: Doc.IsSystem(this.props.document) || this.props.document.isFolder ? lightOrDark(StrCast(Doc.UserDoc().userVariantColor)) : undefined, + backgroundColor: Doc.IsSystem(this.props.document) || this.props.document.isFolder ? SettingsManager.userVariantColor : undefined, + color: Doc.IsSystem(this.props.document) || this.props.document.isFolder ? lightOrDark(SettingsManager.userVariantColor) : undefined, fontWeight: Doc.IsSearchMatch(this.doc) !== undefined ? 'bold' : undefined, textDecoration: Doc.GetT(this.doc, 'title', 'string', true) ? 'underline' : undefined, outline: this.doc === Doc.ActiveDashboard ? 'dashed 1px #06123232' : undefined, @@ -1045,7 +1045,7 @@ export class TreeView extends React.Component {
{contents} diff --git a/src/client/views/nodes/KeyValuePair.tsx b/src/client/views/nodes/KeyValuePair.tsx index b0d041bdd..f22cb195f 100644 --- a/src/client/views/nodes/KeyValuePair.tsx +++ b/src/client/views/nodes/KeyValuePair.tsx @@ -111,7 +111,7 @@ export class KeyValuePair extends React.Component { X - pair[0].replace(/^_/, '') === props.fieldKey)?.[1].description}> + pair[0].replace(/^_/, '') === props.fieldKey)?.[1].description ?? ''}>
{'('.repeat(parenCount)} {props.fieldKey} diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 6b6b0f2ff..aa46e57dc 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -453,7 +453,7 @@ export class SearchBox extends ViewBoxBaseComponent() {
{resultsJSX.length > 0 && (
-
+
Results
{`${validResults}` + ' result' + (validResults === 1 ? '' : 's')}
@@ -462,7 +462,7 @@ export class SearchBox extends ViewBoxBaseComponent() { )} {recommendationsJSX.length > 0 && (
-
+
Recommendations
{`${validResults}` + ' result' + (validResults === 1 ? '' : 's')}
-- cgit v1.2.3-70-g09d2