From 1e673454f8cabf894e8dfec36734d2cb41caa7b1 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 3 Feb 2025 10:23:56 -0500
Subject: changed filter 'check' to be exact match and 'match' to be substring.
  fixed GPTpopup filtering to use a #chat tag instead of a chatFilter field.

---
 src/client/views/collections/CollectionCardDeckView.tsx | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'src/client/views/collections/CollectionCardDeckView.tsx')

diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx
index f24673c39..43464e50c 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -85,6 +85,10 @@ export class CollectionCardView extends CollectionSubView() {
         });
 
     componentDidMount() {
+        this._disposers.chatVis = reaction(
+            () => GPTPopup.Instance.Visible,
+            vis => !vis && this.onGptHide()
+        );
         GPTPopup.Instance.setRegenerateCallback(this.Document, this.childPairStringListAndUpdateSortDesc);
         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
@@ -106,6 +110,7 @@ export class CollectionCardView extends CollectionSubView() {
         );
     }
 
+    onGptHide = () => Doc.setDocFilter(this.Document, 'tags', '#chat', 'remove');
     componentWillUnmount() {
         GPTPopup.Instance.setSortDesc('');
         GPTPopup.Instance.onSortComplete = undefined;
@@ -445,7 +450,7 @@ export class CollectionCardView extends CollectionSubView() {
 
             if (questionType === '2' || questionType === '4') {
                 this.childDocs.forEach(d => {
-                    d.chatFilter = false;
+                    TagItem.removeTagFromDoc(d, '#chat');
                 });
             }
 
@@ -471,8 +476,8 @@ export class CollectionCardView extends CollectionSubView() {
                             break;
                         case '2':
                         case '4':
-                            doc.chatFilter = true;
-                            Doc.setDocFilter(DocCast(this.Document), 'chatFilter', true, 'check');
+                            TagItem.addTagToDoc(doc, '#chat');
+                            Doc.setDocFilter(this.Document, 'tags', '#chat', 'check');
                             break;
                     }
                 } else {
-- 
cgit v1.2.3-70-g09d2

