From 68b00ed7e782fd237cdcdcb30f55814874854187 Mon Sep 17 00:00:00 2001
From: aidahosa1 <aisosa_idahosa@brown.edu>
Date: Sat, 18 May 2024 02:49:43 -0400
Subject: perchance time to pull

---
 .../views/collections/CollectionCardDeckView.tsx   | 23 ++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 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 8a63fc6d9..2ca03a40d 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -26,6 +26,7 @@ import { GPTPopupMode } from '../pdf/GPTPopup/GPTPopup';
 import { reaction } from 'mobx';
 import { NumListCast } from '../../../fields/Doc';
 import { undoBatch } from '../../util/UndoManager';
+import { CalendarContainer } from 'react-datepicker';
 @observer
 export class CollectionCardView extends CollectionSubView() {
 
@@ -52,7 +53,7 @@ export class CollectionCardView extends CollectionSubView() {
                     return false;
                 }
                 // Get the group number for the current index from the customGroupDictionary
-                const groupNumber = this.customGroupDictionary[currCustom].get(index);
+                const groupNumber = this.getButtonGroup(currCustom, l.layout)
                 // Check if the group number is in the active groups
                 return groupNumber !== undefined && activeGroups.includes(groupNumber);
             });
@@ -319,8 +320,8 @@ export class CollectionCardView extends CollectionSubView() {
                     break;
 
                 case 'custom':
-                    typeA = this.customGroupDictionary[NumCast(this._props.Document.customSortNumber)].get(docs.indexOf(docA)) ?? '9999';
-                    typeB = this.customGroupDictionary[NumCast(this._props.Document.customSortNumber)].get(docs.indexOf(docB)) ?? '9999';
+                    typeA = this.getButtonGroup(NumCast(this._props.Document.customSortNumber), docA.layout) ?? '9999'
+                    typeB = this.getButtonGroup(NumCast(this._props.Document.customSortNumber), docB.layout) ?? '9999'
                     break;   
                     
                 case 'gpt':
@@ -411,6 +412,7 @@ export class CollectionCardView extends CollectionSubView() {
      * @returns 
      */
     translateOverflowX(realIndex: number, calcIndex: number, calcRowCards: number) {
+        
         if (realIndex < this.maxRowCount) {
             return 0;
         }
@@ -683,7 +685,7 @@ export class CollectionCardView extends CollectionSubView() {
         const groupNumber = NumCast(this._props.Document.customSortNumber);
     
         let amButtons = 4;
-        let activeButtonIndex = this.customGroupDictionary[groupNumber].get(childPairIndex);
+        let activeButtonIndex = this.getButtonGroup(groupNumber, doc)
     
         if (isChat && doc) {
             if (this.amGPTGroups > 4){
@@ -711,6 +713,19 @@ export class CollectionCardView extends CollectionSubView() {
         );
     }
 
+    getButtonGroup(groupNumber: number, doc: Doc) {
+        switch (groupNumber){
+            case 0:
+                return NumCast(doc.custom1Group)
+            case 1:
+                return NumCast(doc.custom2Group)
+            case 2:
+                return NumCast(doc.custom3Group)
+            default:
+                break
+        }
+    }
+
 
     @computed get translateWrapperX() {
         let translate = 0;
-- 
cgit v1.2.3-70-g09d2

