From 938a9d94823064fa3487a8f8f378cdfb7d8db437 Mon Sep 17 00:00:00 2001 From: aidahosa1 Date: Tue, 14 May 2024 11:01:36 -0400 Subject: me vs the gpt API who will win --- .../views/collections/CollectionCardDeckView.tsx | 87 +++++----------------- 1 file changed, 18 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx index fc183b72b..7af6eb614 100644 --- a/src/client/views/collections/CollectionCardDeckView.tsx +++ b/src/client/views/collections/CollectionCardDeckView.tsx @@ -4,7 +4,7 @@ import * as React from 'react'; import { Utils, returnFalse, returnTrue, returnZero } from '../../../Utils'; import { Doc, DocListCast, Field, StrListCast } from '../../../fields/Doc'; import { Id } from '../../../fields/FieldSymbols'; -import { NumCast, ScriptCast, StrCast, BoolCast, DocCast } from '../../../fields/Types'; +import { NumCast, ScriptCast, StrCast, BoolCast, DocCast, RTFCast } from '../../../fields/Types'; import { DragManager } from '../../util/DragManager'; import { SelectionManager } from '../../util/SelectionManager'; import { StyleProp } from '../StyleProvider'; @@ -52,6 +52,9 @@ export class CollectionCardView extends CollectionSubView() { // console.log('good mornings'); this.setSelectedNodeIndex(index); } + + + }; isSelected = (index: number): boolean => { @@ -62,7 +65,11 @@ export class CollectionCardView extends CollectionSubView() { inactiveDocs = () => { const docs = this.myChildLayoutPairs; + + return docs.filter(d => !SelectionManager.IsSelected(d.layout)); + + }; middleIndex = Math.floor(this.inactiveDocs().length / 2); @@ -80,7 +87,7 @@ export class CollectionCardView extends CollectionSubView() { @observable customGroupDictionary: Map[] = [new Map(), new Map(), new Map()]; @computed get mapToField(): List { - const resultList = new List(); // Creating a new ListImpl instance for strings + const resultList = new List(); this.customGroupDictionary.forEach(map => { // Convert each map to a single string with entries formatted as "key:value" @@ -110,10 +117,11 @@ export class CollectionCardView extends CollectionSubView() { + + private _dropDisposer?: DragManager.DragDropDisposer; componentWillUnmount() { - console.log("hey hey hey") this._dropDisposer?.(); } @@ -238,7 +246,7 @@ export class CollectionCardView extends CollectionSubView() { // } case 'custom': - console.log('hiiiii'); + // console.log('hiiiii'); return this.sort(sorted, 'custom', desc); default: @@ -293,7 +301,7 @@ export class CollectionCardView extends CollectionSubView() { case 'custom': - console.log(this.customGroupDictionary[NumCast(this._props.Document.customSortNumber)]) + // console.log(this.customGroupDictionary[NumCast(this._props.Document.customSortNumber)]) typeA = this.customGroupDictionary[NumCast(this._props.Document.customSortNumber)].get(docs.indexOf(docA)) ?? '9999'; // console.log(typeA + "A") typeB = this.customGroupDictionary[NumCast(this._props.Document.customSortNumber)].get(docs.indexOf(docB)) ?? '9999'; @@ -467,6 +475,9 @@ export class CollectionCardView extends CollectionSubView() { @action toggleButton(childPairIndex: number, buttonID: number) { this.customGroupDictionary[NumCast(this._props.Document.customSortNumber)].set(childPairIndex, buttonID); this._props.Document.customHashMap = this.mapToField + + // const queryText = RTFCast(DocCast(this.dataDoc[this.fieldKey + '_1'])); + // console.log(queryText) } renderButtons(childPairIndex: number) { @@ -490,54 +501,6 @@ export class CollectionCardView extends CollectionSubView() { ); } - // @computed get content() { - // // const currentIndex = NumCast(this.layoutDoc._carousel_index); - // const amCards = this.inactiveDocs().length; - // console.log(amCards + "lol") - // // const sortedDocs = this.sortedDocsType.docs; // Retrieve sorted documents - - // // const myInactives = - - // return this.myChildLayoutPairs.map((childPair, index) => { - // const isSelected = this.isSelected(index); - // const isHovered = this.hoveredNodeIndex === index; - // const isOverflow = amCards > 8 && index > amCards / 2; - // // const inactiveIndex = this.sortedDocsType.docs.indexOf(childPair); - // const inactiveIndex = this.inactiveDocs().indexOf(childPair.layout); - // // const yOffset = this.verticalOffset(index); - - // const childScreenToLocal = () => { - // const dref = this.docRefs.get(childPair.layout); - // const { translateX, translateY, scale } = Utils.GetScreenTransform(dref?.ContentDiv); - // // the document view may center its contents and if so, will prepend that onto the screenToLocalTansform. so we have to subtract that off - // return new Transform(-translateX + (dref?.centeringX || 0) * scale, -translateY + (dref?.centeringY || 0) * scale, 1).scale(1 / scale).rotate(!isSelected ? -this.rotate(amCards, inactiveIndex) : 0); - // }; - - // return ( - //
this.setSelectedNodeIndex(index)} - - // onMouseEnter={() => this.setHoveredNodeIndex(index)}> - // {/* {this.lol(childPair.data, index)} */} - - // {this.displayDoc(childPair, childScreenToLocal)} - //
- // ); - // }); - // } @computed get translateWrapperX() { let translate = 0; @@ -546,8 +509,8 @@ export class CollectionCardView extends CollectionSubView() { translate += this.panelWidth() / 2; } - console.log('in' + this.inactiveDocs().length); - console.log('max' + this.maxRowCount); + // console.log('in' + this.inactiveDocs().length); + // console.log('max' + this.maxRowCount); // if (this.inactiveDocs().length > this.maxRowCount){ // translate += ((this.inactiveDocs().length % this.maxRowCount) * this.panelWidth()) / 2 @@ -586,20 +549,6 @@ export class CollectionCardView extends CollectionSubView() { onMouseLeave={() => this.setHoveredNodeIndex(-1)}> {this.contentSorted} - - {/* - - {header} - - - - - */} - - {/* {this.focusContent} */} ); } -- cgit v1.2.3-70-g09d2