From ba61f7fb706b17f5b186ac32e2f8844715899886 Mon Sep 17 00:00:00 2001 From: alyssaf16 Date: Sun, 10 Mar 2024 00:02:39 -0500 Subject: flashcards --- src/client/views/nodes/ComparisonBox.tsx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx index eaf7419fc..fa0ab61bc 100644 --- a/src/client/views/nodes/ComparisonBox.tsx +++ b/src/client/views/nodes/ComparisonBox.tsx @@ -16,6 +16,7 @@ import { DocumentView } from './DocumentView'; import { FieldView, FieldViewProps } from './FieldView'; import { PinProps, PresBox } from './trails'; import { IntegerType } from 'mongodb'; +import { FormattedTextBox } from './formattedText/FormattedTextBox'; @observer export class ComparisonBox extends ViewBoxAnnotatableComponent() implements ViewBoxInterface { @@ -160,14 +161,9 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent() remDoc2 = (doc: Doc | Doc[]) => (doc instanceof Doc ? [doc] : doc).reduce((res, doc) => res && this.remDoc(doc, this.fieldKey + '_2'), true); _closeRef = React.createRef(); - cycleAlternateText = () => { + flipFlashcard = () => { const usePath = this.layoutDoc[`_${this._props.fieldKey}_usePath`]; this.layoutDoc[`_${this._props.fieldKey}_usePath`] = usePath === undefined ? 'alternate' : undefined; - //: usePath === 'alternate' ? 'alternate:hover' : undefined; - //usePath === undefined ? 'alternate' : - //undefined; - //: usePath === 'alternate' ? 'alternate:hover' : undefined; - // console.log('CYCLE' + this.layoutDoc[`_${this._props.fieldKey}_usePath`]); }; @computed get overlayAlternateIcon() { @@ -177,17 +173,13 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent() className="formattedTextBox-alternateButton" onPointerDown={e => setupMoveUpEvents(e.target, e, returnFalse, emptyFunction, e => { - //side = side === 1 ? 0 : 1; - this.cycleAlternateText(); - console.log('HEREEEEE'); + this.flipFlashcard(); }) } style={{ //display: this._props.isContentActive() && !SnappingManager.IsDragging ? 'flex' : 'none', background: usepath === 'alternate' ? 'white' : 'black', - //usePath === undefined ? 'white' : usePath === 'alternate' ? 'black' : 'gray', color: usepath === 'alternate' ? 'black' : 'white', - //usePath === undefined ? 'black' : 'white', }}> @@ -245,7 +237,10 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent() if (this.Document._layout_isFlashcard) { const side = this.layoutDoc[`_${this._props.fieldKey}_usePath`] === 'alternate' ? 1 : 0; - console.log('SIDEEEE' + side); + + if (!this.dataDoc[this.fieldKey + '_0']) this.dataDoc[this.fieldKey + '_0'] = DocUtils.copyDragFactory(Doc.UserDoc().emptyNote as Doc); + if (!this.dataDoc[this.fieldKey + '_1']) this.dataDoc[this.fieldKey + '_1'] = DocUtils.copyDragFactory(Doc.UserDoc().emptyNote as Doc); + return (
{displayBox(`${this.fieldKey}_${side}`, side, this._props.PanelWidth() - 3)} -- cgit v1.2.3-70-g09d2