aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionCardDeckView.tsx18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx
index a3ec3884b..ba68504d7 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -75,13 +75,13 @@ export class CollectionCardView extends CollectionSubView() {
}
/**
- * update's gpt's doc-text list and initializes callbacks
+ * update's gpt's doc-text list and initialize callbacks to respond to GPT output
*/
- childPairStringListAndUpdateSortDesc = () =>
- this.childPairStringList().then(sortDesc => {
- GPTPopup.Instance.setSortDesc(sortDesc.join());
+ updateDocumentDescriptions = () =>
+ this.childPairStringList().then(docDescriptions => {
+ GPTPopup.Instance.setDocumentDescriptions(docDescriptions.join());
GPTPopup.Instance.onGptResponse = this.processGptResponse;
- GPTPopup.Instance.onQuizRandom = this.quizMode;
+ GPTPopup.Instance.onQuizRandom = this.randomlyChooseDoc;
});
componentDidMount() {
@@ -89,7 +89,7 @@ export class CollectionCardView extends CollectionSubView() {
() => GPTPopup.Instance.Visible,
vis => !vis && this.onGptHide()
);
- GPTPopup.Instance.setRegenerateCallback(this.Document, this.childPairStringListAndUpdateSortDesc);
+ GPTPopup.Instance.setRetrieveDocDescriptionsCallback(this.Document, this.updateDocumentDescriptions);
this._props.setContentViewBox?.(this);
// if card deck moves, then the child doc views are hidden so their screen to local transforms will return empty rectangles
// when inquired from the dom (below in childScreenToLocal). When the doc is actually rendered, we need to act like the
@@ -112,10 +112,8 @@ export class CollectionCardView extends CollectionSubView() {
onGptHide = () => Doc.setDocFilter(this.Document, 'tags', '#chat', 'remove');
componentWillUnmount() {
- GPTPopup.Instance.setSortDesc('');
GPTPopup.Instance.onGptResponse = undefined;
GPTPopup.Instance.onQuizRandom = undefined;
- GPTPopup.Instance.setRegenerateCallback(undefined, null);
Object.keys(this._disposers).forEach(key => this._disposers[key]?.());
this._dropDisposer?.();
}
@@ -169,9 +167,7 @@ export class CollectionCardView extends CollectionSubView() {
/**
* When in quiz mode, randomly selects a document
*/
- quizMode = () => {
- this.layoutDoc._card_curDoc = this.childDocs[Math.floor(Math.random() * this.childDocs.length)];
- };
+ randomlyChooseDoc = () => (this.layoutDoc._card_curDoc = this.childDocs[Math.floor(Math.random() * this.childDocs.length)]);
setHoveredNodeIndex = action((index: number) => {
if (!SnappingManager.IsDragging) this._hoveredNodeIndex = index;