diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionCardDeckView.tsx | 45 | ||||
-rw-r--r-- | src/client/views/nodes/IconTagBox.tsx | 5 |
2 files changed, 11 insertions, 39 deletions
diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx index bcb42111f..d9c27254a 100644 --- a/src/client/views/collections/CollectionCardDeckView.tsx +++ b/src/client/views/collections/CollectionCardDeckView.tsx @@ -3,7 +3,7 @@ import { observer } from 'mobx-react'; import * as React from 'react'; import { ClientUtils, DashColor, returnFalse, returnZero } from '../../../ClientUtils'; import { emptyFunction } from '../../../Utils'; -import { Doc, StrListCast } from '../../../fields/Doc'; +import { Doc } from '../../../fields/Doc'; import { DocData } from '../../../fields/DocSymbols'; import { Id } from '../../../fields/FieldSymbols'; import { List } from '../../../fields/List'; @@ -18,6 +18,7 @@ import { SnappingManager } from '../../util/SnappingManager'; import { Transform } from '../../util/Transform'; import { undoable } from '../../util/UndoManager'; import { StyleProp } from '../StyleProp'; +import { TagItem } from '../TagsView'; import { DocumentView } from '../nodes/DocumentView'; import { GPTPopup, GPTPopupMode } from '../pdf/GPTPopup/GPTPopup'; import './CollectionCardDeckView.scss'; @@ -242,7 +243,6 @@ export class CollectionCardView extends CollectionSubView() { const currRow = Math.floor((mouseY - 100) / rowHeight); //rows start at 0 if (adjustedX < 0) { - console.log('DROP INDEX NO '); return 0; // Before the first column } @@ -257,7 +257,6 @@ export class CollectionCardView extends CollectionSubView() { index = Math.floor(adjustedX / cardWidth) + currRow * this._maxRowCount; } - console.log('DROP INDEX = ' + index); return index; }; @@ -327,35 +326,11 @@ export class CollectionCardView extends CollectionSubView() { * @returns its value based on its tags */ - tagValue = (doc: Doc) => { - const keys = Doc.MyFilterHotKeys; - - const isTagActive = (key: Doc) => BoolCast(key.active); - - let base = ''; - let fraction = ''; - - keys.forEach(key => { - if (isTagActive(key)) { - if (base === '') { - base = StrCast(key.toolType); // First active tag becomes the base - } else { - fraction += StrCast(key.toolType); // Subsequent active tags become part of the fraction - } - } - }); - - // If no tag was active, return 0 by default - if (base === '') { - return 0; - } - - // Construct the final number by appending the fraction if it exists - const numberString = fraction ? `${base}.${fraction}` : base; - - // Convert the result to a number and return - return Number(numberString); - }; + tagValue = (doc: Doc) => + Doc.MyFilterHotKeys.map((key, i) => ({ has: TagItem.docHasTag(doc, StrCast(key.toolType)), i })) + .filter(({ has }) => has) + .map(({ i }) => i) + .join('.'); /** * Called in the sortedDocsType method. Compares the cards' value in regards to the desired sort type-- earlier cards are move to the @@ -492,7 +467,7 @@ export class CollectionCardView extends CollectionSubView() { }; const docTextPromises = this.childDocsWithoutLinks.map(async doc => { const docText = (await docToText(doc)) ?? ''; - doc['gptInputText'] = docText; + doc.gptInputText = docText; this._textToDoc.set(docText.replace(/\n/g, ' ').trim(), doc); return `======${docText.replace(/\n/g, ' ').trim()}======`; }); @@ -532,7 +507,7 @@ export class CollectionCardView extends CollectionSubView() { if (questionType === '2' || questionType === '4') { this.childDocs.forEach(d => { - d['chatFilter'] = false; + d.chatFilter = false; }); } @@ -573,7 +548,7 @@ export class CollectionCardView extends CollectionSubView() { } case '2': case '4': - doc['chatFilter'] = true; + doc.chatFilter = true; Doc.setDocFilter(DocCast(this.Document.embedContainer), 'chatFilter', true, 'match'); break; } diff --git a/src/client/views/nodes/IconTagBox.tsx b/src/client/views/nodes/IconTagBox.tsx index 292f9b523..8faf8ffa5 100644 --- a/src/client/views/nodes/IconTagBox.tsx +++ b/src/client/views/nodes/IconTagBox.tsx @@ -1,18 +1,15 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Tooltip } from '@mui/material'; -import { action, computed, makeObservable } from 'mobx'; +import { computed, makeObservable } from 'mobx'; import { observer } from 'mobx-react'; import React from 'react'; import { returnFalse, setupMoveUpEvents } from '../../../ClientUtils'; import { emptyFunction } from '../../../Utils'; import { Doc } from '../../../fields/Doc'; import { StrCast } from '../../../fields/Types'; -import { SnappingManager } from '../../util/SnappingManager'; import { undoable } from '../../util/UndoManager'; -import { MainView } from '../MainView'; import { ObservableReactComponent } from '../ObservableReactComponent'; -import { PropertiesView } from '../PropertiesView'; import { TagItem } from '../TagsView'; import { DocumentView } from './DocumentView'; import './IconTagBox.scss'; |