diff options
author | aidahosa1 <aisosa_idahosa@brown.edu> | 2024-05-14 11:01:36 -0400 |
---|---|---|
committer | aidahosa1 <aisosa_idahosa@brown.edu> | 2024-05-14 11:01:36 -0400 |
commit | 938a9d94823064fa3487a8f8f378cdfb7d8db437 (patch) | |
tree | 2e2a0a85c6682732c807cf1ed48a97c80a67c4c8 /src | |
parent | 377c4da04a67bd781ac3a192313ee92e9fdb984b (diff) |
me vs the gpt API who will win
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionCardDeckView.tsx | 87 |
1 files changed, 18 insertions, 69 deletions
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<number, number>[] = [new Map<number, number>(), new Map<number, number>(), new Map<number, number>()]; @computed get mapToField(): List<string> { - const resultList = new List<string>(); // Creating a new ListImpl instance for strings + const resultList = new List<string>(); 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 ( - // <div - // key={childPair.layout[Id]} - // className={`card-item${isSelected ? '-active' : ''}`} - // style={{ - // width: this.panelWidth(), - // height: this.panelHeight(childPair.layout)(), - // transform: ` - // rotate(${!isSelected ? this.rotate(amCards, inactiveIndex) : 0}deg) - // translateY(${isHovered ? this.translateHover(index) : isSelected ? 50 * this.fitContentScale : this.translateY(amCards, inactiveIndex)}px) - // translateX(${isSelected ? (this._props.PanelWidth() / 2) * this.fitContentScale - this.childDocumentWidth : 0}px) - // scale(${isSelected ? 1.25 : 1}) - - // `, //scale has to be applied last or selected offset gets messed up - // }} - // // onClick={() => this.setSelectedNodeIndex(index)} - - // onMouseEnter={() => this.setHoveredNodeIndex(index)}> - // {/* {this.lol(childPair.data, index)} */} - - // {this.displayDoc(childPair, childScreenToLocal)} - // </div> - // ); - // }); - // } @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} </div> - - {/* <Card className={`custom-modal-position step-${step}`}> - <Card.Header> - {header} - <Button variant="close" className= "tut-close"onClick={store.toggleTutorial} style={{ position: 'absolute', top: 0, right: 0 }} /> - </Card.Header> - <Card.Body>{body} - <Button className= 'next-step' variant="primary" onClick={store.nextStep}>Next Step!</Button> - </Card.Body> - - - </Card> */} - - {/* {this.focusContent} */} </div> ); } |