From 386d640fe7fc4b443bc5f241f86e27424851dc4e Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 10 Oct 2024 16:24:00 -0400 Subject: adjusted placement of flaschard practice buttons to be closer to the bottom. Fixed being able to enter quiz mode for flaschards created as part of a stack by fixing embedContainer setting. --- src/client/documents/Documents.ts | 15 ++++++--------- src/client/views/collections/CollectionSubView.tsx | 1 - src/client/views/collections/FlashcardPracticeUI.scss | 16 +++++++++------- src/client/views/collections/FlashcardPracticeUI.tsx | 3 +-- 4 files changed, 16 insertions(+), 19 deletions(-) (limited to 'src/client') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 358bc227e..d529de8e5 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -723,6 +723,9 @@ export namespace Docs { updateCachedAcls(dataDoc); updateCachedAcls(viewDoc); + if (data instanceof List) { + data.map(item => item instanceof Doc && Doc.SetContainer(item, viewDoc)); + } return viewDoc; } @@ -907,15 +910,13 @@ export namespace Docs { } export function CalendarDocument(options: DocumentOptions, documents: Array) { - const inst = InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { + return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { _layout_nativeDimEditable: true, _layout_reflowHorizontal: true, _layout_reflowVertical: true, ...options, _type_collection: CollectionViewType.Calendar, }); - documents.forEach(d => Doc.SetContainer(d, inst)); - return inst; } // shouldn't ever need to create a KVP document-- instead set the LayoutTemplateString to be a KeyValueBox for the DocumentView (see addDocTab in TabDocView) @@ -924,9 +925,7 @@ export namespace Docs { // } export function FreeformDocument(documents: Array, options: DocumentOptions, id?: string) { - const inst = InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, _type_collection: CollectionViewType.Freeform }, id); - documents.forEach(d => Doc.SetContainer(d, inst)); - return inst; + return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, _type_collection: CollectionViewType.Freeform }, id); } export function ConfigDocument(options: DocumentOptions, id?: string) { @@ -1031,9 +1030,7 @@ export namespace Docs { } export function DockDocument(documents: Array, config: string, options: DocumentOptions, id?: string) { - const ret = InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { treeView_FreezeChildren: 'remove|add', ...options, type_collection: CollectionViewType.Docking, dockingConfig: config }, id); - documents.map(c => Doc.SetContainer(c, ret)); - return ret; + return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { treeView_FreezeChildren: 'remove|add', ...options, type_collection: CollectionViewType.Docking, dockingConfig: config }, id); } export function DelegateDocument(proto: Doc, options: DocumentOptions = {}) { diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index c057d2402..f85b0b433 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -551,7 +551,6 @@ export function CollectionSubView() { filteredChildDocs={this.filteredChildDocs} advance={answered} curDoc={curDoc} - practiceBtnOffset={this._sideBtnWidth * 4} layoutDoc={this.layoutDoc} uiBtnScaling={this.uiBtnScaling} ScreenToLocalBoxXf={this.ScreenToLocalBoxXf} diff --git a/src/client/views/collections/FlashcardPracticeUI.scss b/src/client/views/collections/FlashcardPracticeUI.scss index 2f99500f8..4ed27793d 100644 --- a/src/client/views/collections/FlashcardPracticeUI.scss +++ b/src/client/views/collections/FlashcardPracticeUI.scss @@ -16,13 +16,15 @@ .FlashcardPracticeUI-practice { position: absolute; width: 100%; - pointer-events: all; -} -.FlashcardPracticeUI-remove { - left: 52%; -} -.FlashcardPracticeUI-check { - right: 52%; + pointer-events: none; + .FlashcardPracticeUI-remove { + left: 52%; + pointer-events: all; + } + .FlashcardPracticeUI-check { + right: 52%; + pointer-events: all; + } } .FlashcardPracticeUI-menu { position: absolute; diff --git a/src/client/views/collections/FlashcardPracticeUI.tsx b/src/client/views/collections/FlashcardPracticeUI.tsx index 0e9fe89c9..4e424f5cd 100644 --- a/src/client/views/collections/FlashcardPracticeUI.tsx +++ b/src/client/views/collections/FlashcardPracticeUI.tsx @@ -37,7 +37,6 @@ interface PracticeUIProps { ScreenToLocalBoxXf: () => Transform; docViewProps: () => DocumentViewProps; setFilterFunc: (func?: (doc: Doc) => boolean) => void; - practiceBtnOffset?: number; } @observer export class FlashcardPracticeUI extends ObservableReactComponent { @@ -105,7 +104,7 @@ export class FlashcardPracticeUI extends ObservableReactComponent +
setupMoveUpEvents(this, e, returnFalse, emptyFunction, () => setPracticeVal(e, practiceVal.MISSED))}> -- cgit v1.2.3-70-g09d2